summaryrefslogtreecommitdiffstats
path: root/src/server/sessionnamewindow/sessionnamewindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/sessionnamewindow/sessionnamewindow.cpp')
-rw-r--r--src/server/sessionnamewindow/sessionnamewindow.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/server/sessionnamewindow/sessionnamewindow.cpp b/src/server/sessionnamewindow/sessionnamewindow.cpp
new file mode 100644
index 0000000..1d8c699
--- /dev/null
+++ b/src/server/sessionnamewindow/sessionnamewindow.cpp
@@ -0,0 +1,68 @@
+/*
+ # Copyright (c) 2009 - OpenSLX Project, Computer Center University of Freiburg
+ #
+ # This program is free software distributed under the GPL version 2.
+ # See http://openslx.org/COPYING
+ #
+ # If you have any feedback please consult http://openslx.org/feedback and
+ # send your suggestions, praise, or complaints to feedback@openslx.org
+ #
+ # General information about OpenSLX can be found at http://openslx.org/
+ # -----------------------------------------------------------------------------
+ # mainWindow.cpp
+ This is the Main class for the pvsManager. The GUI is contructed here.
+ # -----------------------------------------------------------------------------
+ */
+
+#include <QtGui>
+#include "sessionnamewindow.h"
+#include "../util/global.h"
+
+#include "ui_sessionname.h"
+
+SessionNameWindow::SessionNameWindow(QWidget *parent) :
+ QDialog(parent), ui(new Ui::SessionName)
+
+{
+ ui->setupUi(this);
+ connect(ui->bboxOkCancel, SIGNAL(accepted()), this, SLOT(onOkClicked()));
+ connect(ui->bboxOkCancel, SIGNAL(rejected()), this, SLOT(close()));
+ connect(ui->cmdRandom, SIGNAL(clicked(bool)), this, SLOT(onGenerateRandomName()));
+}
+
+SessionNameWindow::~SessionNameWindow()
+{
+ delete ui;
+}
+
+void SessionNameWindow::show(const QString& name)
+{
+ ui->txtName->setText(name);
+ this->showNormal();
+}
+
+/*
+ * Overridden methods
+ */
+
+void SessionNameWindow::closeEvent(QCloseEvent *e)
+{
+ e->ignore();
+ this->hide();
+}
+
+/**
+ * Slots
+ */
+
+void SessionNameWindow::onOkClicked()
+{
+ Global::setSessionName(ui->txtName->text());
+ emit updateSessionName();
+ this->hide();
+}
+
+void SessionNameWindow::onGenerateRandomName()
+{
+ ui->txtName->setText(QString::number(qrand() % 9000 + 1000));
+}