diff ui/mainwindow.cpp @ 653:39f03316f675 trustbridge-refactor

Change button text when toggling details and select the first list item.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 25 Jun 2014 14:56:19 +0200
parents f65503c1833b
children 129e611eaf50
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Wed Jun 25 14:54:45 2014 +0200
+++ b/ui/mainwindow.cpp	Wed Jun 25 14:56:19 2014 +0200
@@ -998,44 +998,42 @@
 
 void MainWindow::toggleUpdatesNew() {
     if (!mUpdatesNew->isVisible()) {
+        mUpdatesDetailsNew->setText(tr("Hide Details"));
         mUpdatesNew->show();
-        if (mUpdatesNewSize == 0) {
-            mUpdatesNewSize = mUpdatesNew->height();
-        }
-        mUpdatesWidget->resize(old.width(), old.height() + mUpdatesNewSize);
+        mUpdatesNew->setSelected(0);
     }
     else {
+        mUpdatesNew->hide();
+        mUpdatesDetailsNew->setText(tr("Show Details"));
+        QSize old = mUpdatesWidget->size();
         mUpdatesWidget->resize(old.width(), old.height() - mUpdatesNew->height());
-        mUpdatesNew->hide();
     }
 }
 
 void MainWindow::toggleUpdatesRemove() {
-    QSize old = mUpdatesWidget->size();
     if (!mUpdatesRemove->isVisible()) {
+        mUpdatesDetailsRemove->setText(tr("Hide Details"));
         mUpdatesRemove->show();
-        if (mUpdatesRemoveSize == 0) {
-            mUpdatesRemoveSize = mUpdatesRemove->height();
-        }
-        mUpdatesWidget->resize(old.width(), old.height() + mUpdatesRemoveSize);
+        mUpdatesRemove->setSelected(0);
     }
     else {
+        mUpdatesRemove->hide();
+        mUpdatesDetailsRemove->setText(tr("Show Details"));
+        QSize old = mUpdatesWidget->size();
         mUpdatesWidget->resize(old.width(), old.height() - mUpdatesRemove->height());
-        mUpdatesRemove->hide();
     }
 }
 
 void MainWindow::toggleUpdatesManual() {
-    QSize old = mUpdatesWidget->size();
     if (!mUpdatesManual->isVisible()) {
+        mUpdatesDetailsManual->setText(tr("Hide Details"));
         mUpdatesManual->show();
-        if (mUpdatesManualSize == 0) {
-            mUpdatesManualSize = mUpdatesManual->height();
-        }
-        mUpdatesWidget->resize(old.width(), old.height() + mUpdatesManualSize);
+        mUpdatesManual->setSelected(0);
     }
     else {
+        mUpdatesDetailsManual->setText(tr("Show Details"));
+        mUpdatesManual->hide();
+        QSize old = mUpdatesWidget->size();
         mUpdatesWidget->resize(old.width(), old.height() - mUpdatesManual->height());
-        mUpdatesManual->hide();
     }
 }

http://wald.intevation.org/projects/trustbridge/