diff options
author | Manuel Schneider | 2014-05-06 18:45:03 +0200 |
---|---|---|
committer | Manuel Schneider | 2014-05-06 18:45:03 +0200 |
commit | 03bb2a73d30e9d138d85dafe5b0c37296feb5e9c (patch) | |
tree | a8abe332c737bc6d7cf4fa11b614dcdeca53eaba | |
parent | Clipped the green checkmark's white space. (diff) | |
download | pvs2-03bb2a73d30e9d138d85dafe5b0c37296feb5e9c.tar.gz pvs2-03bb2a73d30e9d138d85dafe5b0c37296feb5e9c.tar.xz pvs2-03bb2a73d30e9d138d85dafe5b0c37296feb5e9c.zip |
Changes the ConnectionWidows gui to a relative layout. Added a stacked widget to
change between checkmark and the rest. Changed the non expressive names of ui
elements.
-rw-r--r-- | gui/client/connect.ui | 291 | ||||
-rw-r--r-- | gui/server_normal/sessionname.ui | 2 | ||||
-rw-r--r-- | src/client/connectwindow/connectwindow.cpp | 48 | ||||
-rw-r--r-- | src/client/connectwindow/connectwindow.h | 4 | ||||
-rw-r--r-- | src/client/toolbar/toolbar.cpp | 15 | ||||
-rw-r--r-- | src/server/sessionnamewindow/sessionnamewindow.cpp | 8 |
6 files changed, 216 insertions, 152 deletions
diff --git a/gui/client/connect.ui b/gui/client/connect.ui index a7cb621..a108fe8 100644 --- a/gui/client/connect.ui +++ b/gui/client/connect.ui @@ -2,137 +2,186 @@ <ui version="4.0"> <class>ConnectWindow</class> <widget class="QWidget" name="ConnectWindow"> + <property name="windowModality"> + <enum>Qt::WindowModal</enum> + </property> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>512</width> - <height>128</height> + <height>92</height> </rect> </property> + <property name="minimumSize"> + <size> + <width>512</width> + <height>92</height> + </size> + </property> <property name="windowTitle"> <string>Connect to PVS session</string> </property> - <widget class="QGroupBox" name="grpSetname"> - <property name="geometry"> - <rect> - <x>3</x> - <y>10</y> - <width>504</width> - <height>61</height> - </rect> - </property> - <property name="title"> - <string>Session Name</string> - </property> - <widget class="QPushButton" name="cmdOK"> - <property name="geometry"> - <rect> - <x>396</x> - <y>20</y> - <width>101</width> - <height>31</height> - </rect> - </property> - <property name="text"> - <string>Connect</string> - </property> - <property name="default"> - <bool>true</bool> - </property> - </widget> - <widget class="QLineEdit" name="txtName"> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>371</width> - <height>31</height> - </rect> - </property> - <property name="font"> - <font> - <pointsize>14</pointsize> - <weight>75</weight> - <italic>true</italic> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string notr="true"/> - </property> - </widget> - </widget> - <widget class="QLabel" name="lblError"> - <property name="geometry"> - <rect> - <x>20</x> - <y>80</y> - <width>381</width> - <height>21</height> - </rect> - </property> - <property name="text"> - <string notr="true"/> - </property> - </widget> - <widget class="QLabel" name="lblStatus"> - <property name="geometry"> - <rect> - <x>10</x> - <y>90</y> - <width>381</width> - <height>21</height> - </rect> - </property> - <property name="text"> - <string notr="true"/> - </property> - </widget> - <widget class="QPushButton" name="cmdCancel"> - <property name="geometry"> - <rect> - <x>399</x> - <y>80</y> - <width>101</width> - <height>31</height> - </rect> - </property> - <property name="text"> - <string>Hide</string> - </property> - <property name="autoDefault"> - <bool>false</bool> - </property> - <property name="default"> - <bool>false</bool> - </property> - </widget> - <widget class="QLabel" name="lblCheckmark"> - <property name="geometry"> - <rect> - <x>120</x> - <y>0</y> - <width>221</width> - <height>121</height> - </rect> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="../../pvsclient.qrc">:/dark-green-check-mark.svg</pixmap> - </property> - <property name="scaledContents"> - <bool>true</bool> - </property> - </widget> + <layout class="QHBoxLayout" name="mainLayout"> + <item> + <widget class="QStackedWidget" name="stackedWidget"> + <property name="acceptDrops"> + <bool>false</bool> + </property> + <property name="currentIndex"> + <number>1</number> + </property> + <widget class="QWidget" name="page0"> + <layout class="QVBoxLayout" name="sl_p0_vl"> + <property name="spacing"> + <number>0</number> + </property> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="lblSessionName"> + <property name="text"> + <string>Session Name:</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="lineEditName"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>14</pointsize> + </font> + </property> + <property name="text"> + <string notr="true"/> + </property> + </widget> + </item> + <item> + <spacer name="sw_p0_spacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="lblStatus"> + <property name="text"> + <string>Ready to connect; please enter session name.</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="page1"> + <layout class="QHBoxLayout" name="sw_p1_hl"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="lblCheckmark"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>94</width> + <height>72</height> + </size> + </property> + <property name="pixmap"> + <pixmap resource="../../pvsclient.qrc">:/dark-green-check-mark.svg</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + <item> + <layout class="QVBoxLayout" name="buttons"> + <property name="spacing"> + <number>6</number> + </property> + <item> + <widget class="QPushButton" name="btn_connection"> + <property name="text"> + <string>Connect</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btn_hide"> + <property name="text"> + <string>Hide</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + <property name="default"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <spacer name="btns_spacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> </widget> <resources> <include location="../../pvsclient.qrc"/> diff --git a/gui/server_normal/sessionname.ui b/gui/server_normal/sessionname.ui index 6171b60..e0c813e 100644 --- a/gui/server_normal/sessionname.ui +++ b/gui/server_normal/sessionname.ui @@ -61,7 +61,7 @@ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> </property> </widget> - <widget class="QLineEdit" name="txtName"> + <widget class="QLineEdit" name="lineEditName"> <property name="geometry"> <rect> <x>10</x> diff --git a/src/client/connectwindow/connectwindow.cpp b/src/client/connectwindow/connectwindow.cpp index 61d375d..9736dc7 100644 --- a/src/client/connectwindow/connectwindow.cpp +++ b/src/client/connectwindow/connectwindow.cpp @@ -29,9 +29,11 @@ ConnectWindow::ConnectWindow(QWidget *parent) : // Initialize the GUI _ui->setupUi(this); - connect(_ui->cmdOK, SIGNAL(clicked()), this, SLOT(onOkClick())); - connect(_ui->cmdCancel, SIGNAL(clicked()), this, SLOT(onCancelClick())); - int tries = 10; + // Set actions of buttons + connect(_ui->btn_connection, SIGNAL(clicked()), this, SLOT(onBtnConnection())); + connect(_ui->btn_hide, SIGNAL(clicked()), this, SLOT(onBtnHide())); + + int tries = 10; while (tries-- != 0) { const quint16 port = (quint16)(qrand() % 10000) + 10000; @@ -40,15 +42,11 @@ ConnectWindow::ConnectWindow(QWidget *parent) : if (tries == 0) qFatal("Could not bind to any UDP port for server discovery."); } - connect(&_discoverySocket, SIGNAL(readyRead()), this, SLOT(onUdpReadyRead())); + connect(&_discoverySocket, SIGNAL(readyRead()), this, SLOT(onUdpReadyRead())); this->setState(Idle); - lblCheckmark->hide(); } -ConnectWindow::~ConnectWindow() -{ - -} +ConnectWindow::~ConnectWindow(){} /** * Set Client as Connected (true) or Disconnected (false). @@ -86,22 +84,22 @@ void ConnectWindow::setState(const ConnectionState state) */ void ConnectWindow::updateState() { - _ui->txtName->setEnabled(_state == Idle && !_connected); + _ui->lineEditName->setEnabled(_state == Idle && !_connected); if (_connected) { - _ui->lblCheckmark->setVisible(true); - _ui->cmdOK->setEnabled(true); - _ui->cmdOK->setText(tr("&Disconnect")); + _ui->btn_connection->setEnabled(true); + _ui->btn_connection->setText(tr("&Disconnect")); _ui->lblStatus->setText(tr("Connected.")); - _ui->txtName->setEnabled(false); + _ui->lineEditName->setEnabled(false); + _ui->stackedWidget->setCurrentIndex(1); return; } if (_state != Idle) - _ui->cmdOK->setText(tr("&Stop")); + _ui->btn_connection->setText(tr("&Stop")); else - _ui->cmdOK->setText(tr("&Connect")); + _ui->btn_connection->setText(tr("&Connect")); switch (_state) { @@ -109,7 +107,7 @@ void ConnectWindow::updateState() _ui->lblStatus->setText(tr("Ready to connect; please enter session name.")); break; case Scanning: - _ui->lblStatus->setText(tr("Scanning for session %1.").arg(_ui->txtName->text())); + _ui->lblStatus->setText(tr("Scanning for session %1.").arg(_ui->lineEditName->text())); _timerDiscover = startTimer(_discoveryInterval); break; case Connecting: @@ -131,7 +129,7 @@ void ConnectWindow::updateState() case InvalidHash: case InvalidCert: case InvalidSslHash: - _ui->lblError->setText(tr("Invalid hash: %1; invalid cert: %2; invalid iplist: %3; invalid sslhash: %4") + _ui->lblStatus->setText(tr("Invalid hash: %1; invalid cert: %2; invalid iplist: %3; invalid sslhash: %4") .arg(_hashErrorCount).arg(_certErrorCount).arg(_ipErrorCount).arg(_hashSslErrorCount)); break; } @@ -196,7 +194,7 @@ void ConnectWindow::timerEvent(QTimerEvent* event) killTimer(_timerHide); _timerHide = 0; this->hide(); - lblCheckmark->hide(); + _ui->stackedWidget->setCurrentIndex(0); } else // Unknown/Old timer id, kill it @@ -219,7 +217,7 @@ void ConnectWindow::closeEvent(QCloseEvent *e) */ void ConnectWindow::showEvent(QShowEvent* event) { - _ui->txtName->setFocus(); + _ui->lineEditName->setFocus(); } /* @@ -231,10 +229,12 @@ void ConnectWindow::showEvent(QShowEvent* event) * If already connected --> Stop/disconnect. * Else scanning for given sessionId. */ -void ConnectWindow::onOkClick() +void ConnectWindow::onBtnConnection() { - if (_timerHide) + if (_timerHide){ killTimer(_timerHide); + _ui->stackedWidget->setCurrentIndex(0); + } _timerHide = 0; if (_timerDiscover) killTimer(_timerDiscover); @@ -249,7 +249,7 @@ void ConnectWindow::onOkClick() { // Connect (scan for session) _discoveryInterval = 800; - _nameBytes = _ui->txtName->text().toUtf8(); + _nameBytes = _ui->lineEditName->text().toUtf8(); _timerDiscover = startTimer(_discoveryInterval); _hashErrorCount = _hashSslErrorCount = _certErrorCount = _ipErrorCount = 0; this->setState(Scanning); @@ -260,7 +260,7 @@ void ConnectWindow::onOkClick() * Handle click on Cancel/Hide Button. * Just hide the window. */ -void ConnectWindow::onCancelClick() +void ConnectWindow::onBtnHide() { this->hide(); } diff --git a/src/client/connectwindow/connectwindow.h b/src/client/connectwindow/connectwindow.h index 8d4a436..299a339 100644 --- a/src/client/connectwindow/connectwindow.h +++ b/src/client/connectwindow/connectwindow.h @@ -90,8 +90,8 @@ protected: void showEvent(QShowEvent* event); protected slots: - void onOkClick(); - void onCancelClick(); + void onBtnConnection(); + void onBtnHide(); void onUdpReadyRead(); void onConnectionStateChange(ConnectWindow::ConnectionState state); void onConnectionClosed(QObject* connection); diff --git a/src/client/toolbar/toolbar.cpp b/src/client/toolbar/toolbar.cpp index f45d63a..816d5f4 100644 --- a/src/client/toolbar/toolbar.cpp +++ b/src/client/toolbar/toolbar.cpp @@ -20,6 +20,21 @@ Toolbar::Toolbar(QWidget *parent) : // Initialize the GUI _ui->setupUi(this); +// QWidget *firstPageWidget = new QWidget; +// QWidget *secondPageWidget = new QWidget; + +// QStackedLayout *stackedLayout = new QStackedLayout; +// stackedLayout->addWidget(firstPageWidget); +// stackedLayout->addWidget(secondPageWidget); + +// QVBoxLayout *mainLayout = new QVBoxLayout; +// mainLayout->addLayout(stackedLayout); +// setLayout(mainLayout); + + + + + setWindowFlags(Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint | Qt::FramelessWindowHint); setAttribute(Qt::WA_AlwaysShowToolTips); setAttribute(Qt::WA_QuitOnClose); diff --git a/src/server/sessionnamewindow/sessionnamewindow.cpp b/src/server/sessionnamewindow/sessionnamewindow.cpp index 01ac910..f0ca532 100644 --- a/src/server/sessionnamewindow/sessionnamewindow.cpp +++ b/src/server/sessionnamewindow/sessionnamewindow.cpp @@ -28,7 +28,7 @@ SessionNameWindow::SessionNameWindow(QWidget *parent) : 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())); - ui->txtName->setFocus(); + ui->lineEditName->setFocus(); } SessionNameWindow::~SessionNameWindow() @@ -38,7 +38,7 @@ SessionNameWindow::~SessionNameWindow() void SessionNameWindow::show(const QString& name) { - ui->txtName->setText(name); + ui->lineEditName->setText(name); this->showNormal(); } @@ -58,12 +58,12 @@ void SessionNameWindow::closeEvent(QCloseEvent *e) void SessionNameWindow::onOkClicked() { - Global::setSessionName(ui->txtName->text()); + Global::setSessionName(ui->lineEditName->text()); emit updateSessionName(); this->hide(); } void SessionNameWindow::onGenerateRandomName() { - ui->txtName->setText(QString::number(qrand() % 9000 + 1000)); + ui->lineEditName->setText(QString::number(qrand() % 9000 + 1000)); } |