From eae95a57b7b6206be327ee9e0c4403ceff744b25 Mon Sep 17 00:00:00 2001 From: Mohammed Nafees Date: Fri, 4 Apr 2014 23:12:56 +0530 Subject: [PATCH] UI alignment changes --- interface/interface_en.ts | 30 +++++----- interface/src/Application.cpp | 2 +- interface/src/ui/RunningScriptsWidget.cpp | 27 +++++++-- interface/src/ui/ScriptsTableWidget.cpp | 4 +- interface/ui/runningScriptsWidget.ui | 72 +++++++++++++---------- 5 files changed, 81 insertions(+), 54 deletions(-) diff --git a/interface/interface_en.ts b/interface/interface_en.ts index 5256944949..a497ed6ca7 100644 --- a/interface/interface_en.ts +++ b/interface/interface_en.ts @@ -162,51 +162,51 @@ RunningScriptsWidget - + Form - - + + <html><head/><body><p><span style=" font-size:18pt;">Running Scripts</span></p></body></html> - - + + <html><head/><body><p><span style=" font-weight:600;">Currently running</span></p></body></html> - - + + Reload all Reload All - - + + Stop all Stop All - - + + <html><head/><body><p><span style=" font-weight:600;">Recently loaded</span></p></body></html> - - + + (click a script or use the 1-9 keys to load and run it) - - + + There are no scripts currently running. diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 01cccbde47..b806563c9c 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3635,7 +3635,7 @@ void Application::toggleRunningScriptsWidget() if (!_runningScriptsWidget->toggleViewAction()->isChecked()) { _runningScriptsWidget->setGeometry(_window->geometry().topLeft().x(), _window->geometry().topLeft().y(), - 310, _window->height()); + _runningScriptsWidget->width(), _window->height()); _runningScriptsWidget->toggleViewAction()->trigger(); _runningScriptsWidget->grabKeyboard(); _runningScriptsWidget->show(); diff --git a/interface/src/ui/RunningScriptsWidget.cpp b/interface/src/ui/RunningScriptsWidget.cpp index f27ea9a831..b3b42bfa6b 100644 --- a/interface/src/ui/RunningScriptsWidget.cpp +++ b/interface/src/ui/RunningScriptsWidget.cpp @@ -27,7 +27,7 @@ RunningScriptsWidget::RunningScriptsWidget(QDockWidget *parent) : _runningScriptsTable = new ScriptsTableWidget(ui->runningScriptsTableWidget); _runningScriptsTable->setColumnCount(2); - _runningScriptsTable->setColumnWidth(0, 252); + _runningScriptsTable->setColumnWidth(0, 245); _runningScriptsTable->setColumnWidth(1, 22); connect(_runningScriptsTable, &QTableWidget::cellClicked, this, &RunningScriptsWidget::stopScript); @@ -73,6 +73,21 @@ void RunningScriptsWidget::setRunningScripts(const QStringList& list) _runningScriptsTable->setItem(i, 1, closeIcon); } + int y = ui->runningScriptsTableWidget->y() + 12; + for (int i = 0; i < _runningScriptsTable->rowCount(); ++i) { + y += _runningScriptsTable->rowHeight(i); + } + + ui->runningScriptsTableWidget->resize(ui->runningScriptsTableWidget->width(), y - 12); + _runningScriptsTable->resize(_runningScriptsTable->width(), y - 12); + ui->reloadAllButton->move(ui->reloadAllButton->x(), y); + ui->stopAllButton->move(ui->stopAllButton->x(), y); + ui->recentlyLoadedLabel->move(ui->recentlyLoadedLabel->x(), + ui->stopAllButton->y() + ui->stopAllButton->height() + 61); + ui->recentlyLoadedScriptsTableWidget->move(ui->recentlyLoadedScriptsTableWidget->x(), + ui->recentlyLoadedLabel->y() + 19); + + createRecentlyLoadedScriptsTable(); } @@ -143,18 +158,18 @@ void RunningScriptsWidget::keyPressEvent(QKeyEvent *e) void RunningScriptsWidget::paintEvent(QPaintEvent *) { QPainter painter(this); - painter.setPen(QColor::fromRgb(225, 225, 225)); + painter.setPen(QColor::fromRgb(225, 225, 225)); // #e1e1e1 if (ui->currentlyRunningLabel->isVisible()) { // line below the 'Currently Running' label - painter.drawLine(21, ui->currentlyRunningLabel->y() + ui->currentlyRunningLabel->height(), - width() - 22, ui->currentlyRunningLabel->y() + ui->currentlyRunningLabel->height()); + painter.drawLine(36, ui->currentlyRunningLabel->y() + ui->currentlyRunningLabel->height(), + 300, ui->currentlyRunningLabel->y() + ui->currentlyRunningLabel->height()); } if (ui->recentlyLoadedLabel->isVisible()) { // line below the 'Recently loaded' label - painter.drawLine(21, ui->recentlyLoadedLabel->y() + ui->recentlyLoadedLabel->height(), - width() - 22, ui->recentlyLoadedLabel->y() + ui->recentlyLoadedLabel->height()); + painter.drawLine(36, ui->recentlyLoadedLabel->y() + ui->recentlyLoadedLabel->height(), + 300, ui->recentlyLoadedLabel->y() + ui->recentlyLoadedLabel->height()); } painter.end(); diff --git a/interface/src/ui/ScriptsTableWidget.cpp b/interface/src/ui/ScriptsTableWidget.cpp index ac4dc88fee..6800b56db2 100644 --- a/interface/src/ui/ScriptsTableWidget.cpp +++ b/interface/src/ui/ScriptsTableWidget.cpp @@ -28,11 +28,11 @@ ScriptsTableWidget::ScriptsTableWidget(QWidget *parent) : void ScriptsTableWidget::paintEvent(QPaintEvent *event) { QPainter painter(viewport()); - painter.setPen(QColor::fromRgb(225, 225, 225)); + painter.setPen(QColor::fromRgb(225, 225, 225)); // #e1e1e1 int y = 0; for (int i = 0; i < rowCount(); ++i) { - painter.drawLine(6, rowHeight(i) + y, width(), rowHeight(i) + y); + painter.drawLine(5, rowHeight(i) + y, width(), rowHeight(i) + y); y += rowHeight(i); } painter.end(); diff --git a/interface/ui/runningScriptsWidget.ui b/interface/ui/runningScriptsWidget.ui index f81f30537b..78b16cacff 100644 --- a/interface/ui/runningScriptsWidget.ui +++ b/interface/ui/runningScriptsWidget.ui @@ -6,7 +6,7 @@ 0 0 - 310 + 323 651 @@ -24,15 +24,16 @@ QWidget { - 20 - 10 + 37 + 29 251 - 31 + 20 color: #0e7077; -font-size: 20pt; +font-size: 20pt; +background: transparent; <html><head/><body><p><span style=" font-size:18pt;">Running Scripts</span></p></body></html> @@ -47,15 +48,16 @@ font-size: 20pt; - 20 - 40 + 36 + 70 270 20 color: #0e7077; -font: bold 14pt; +font: bold 14pt; +background: transparent; <html><head/><body><p><span style=" font-weight:600;">Currently running</span></p></body></html> @@ -64,7 +66,7 @@ font: bold 14pt; - 20 + 36 230 111 35 @@ -93,9 +95,9 @@ font: bold 14pt; - 144 + 160 230 - 101 + 93 35 @@ -119,9 +121,9 @@ font: bold 14pt; - 20 + 36 280 - 301 + 265 20 @@ -136,10 +138,10 @@ font: bold 14pt; - 20 + 36 590 - 271 - 41 + 203 + 31 @@ -156,10 +158,10 @@ font-size: 14pt; - 270 - 10 - 31 - 31 + 285 + 29 + 16 + 16 @@ -174,8 +176,8 @@ font-size: 14pt; - 20 - 20 + 16 + 16 @@ -185,8 +187,8 @@ font-size: 14pt; - 20 - 60 + 36 + 70 271 51 @@ -198,15 +200,15 @@ font-size: 14pt; There are no scripts currently running. - Qt::AlignCenter + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - 14 + 30 300 - 276 + 272 280 @@ -218,9 +220,9 @@ font-size: 14pt; - 14 - 60 - 276 + 30 + 88 + 272 161 @@ -229,6 +231,16 @@ font-size: 14pt; font-size: 14pt; + widgetTitle + currentlyRunningLabel + recentlyLoadedLabel + recentlyLoadedInstruction + hideWidgetButton + recentlyLoadedScriptsTableWidget + runningScriptsTableWidget + noRunningScriptsLabel + reloadAllButton + stopAllButton