[PATCH 6 of 7] (issue115) Move tooltips into body to make qt tr work

Wald Commits scm-commit at wald.intevation.org
Mon Sep 15 19:11:24 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1410801057 -7200
# Node ID b6cb4fd7ee206da81bfa8ff5f2509f775d5ec878
# Parent  6594e8e63a2595d9bdf78c0cb76782c336ef7985
(issue115) Move tooltips into body to make qt tr work

diff -r 6594e8e63a25 -r b6cb4fd7ee20 ui/mainwindow.cpp
--- a/ui/mainwindow.cpp	Mon Sep 15 19:02:17 2014 +0200
+++ b/ui/mainwindow.cpp	Mon Sep 15 19:10:57 2014 +0200
@@ -93,15 +93,6 @@
 #define HELP_PATH "/../share/doc/trustbridge/index.html"
 #endif
 
-#define NEW_INSTALL_TT "Certificate will be installed."
-#define NOT_INSTALL_TT "Certificate will not be installed."
-#define NEW_REMOVE_TT "Certificate will be removed."
-#define NOT_REMOVE_TT "Certificate will not be removed."
-#define IS_INSTALLED_TT "Certificate is installed."
-#define IS_NOT_INSTALLED_TT "Certifcate is not installed."
-#define IS_REMOVED_TT "Certificate has been removed."
-#define IS_NOT_REMOVED_TT "Certificate has not been removed."
-
 static void activateDetailsButton(QPushButton *);
 static void deactivateDetailsButton(QPushButton *);
 
@@ -1153,11 +1144,11 @@
                 if (!state) {
                     btnIcon.addFile(":/img/write-into-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off);
                     btnIcon.addFile(":/img/security-low.png", QSize(48, 48), QIcon::Normal, QIcon::On);
-                    actionBtn->setProperty("ToolTip_Off", tr(NEW_INSTALL_TT));
-                    actionBtn->setProperty("ToolTip_On", tr(IS_NOT_INSTALLED_TT));
+                    actionBtn->setProperty("ToolTip_Off", tr("Certificate will be installed."));
+                    actionBtn->setProperty("ToolTip_On", tr("Certifcate is not installed."));
                 } else {
-                    actionBtn->setProperty("ToolTip_Off", tr(IS_INSTALLED_TT));
-                    actionBtn->setProperty("ToolTip_On", tr(NEW_REMOVE_TT));
+                    actionBtn->setProperty("ToolTip_Off", tr("Certificate is installed."));
+                    actionBtn->setProperty("ToolTip_On", tr("Certificate will be removed."));
                     btnIcon.addFile(":/img/security-high.png", QSize(48, 48), QIcon::Normal, QIcon::Off);
                     btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::On);
                 }
@@ -1168,15 +1159,15 @@
                 oldRemoveCerts.append(cert);
                 QToolButton* actionBtn = new QToolButton();
                 QIcon btnIcon;
-                actionBtn->setProperty("ToolTip_Off", tr(NEW_REMOVE_TT));
-                actionBtn->setProperty("ToolTip_On", tr(IS_NOT_REMOVED_TT));
+                actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed."));
+                actionBtn->setProperty("ToolTip_On", tr("Certificate has not been removed."));
                 btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off);
                 btnIcon.addFile(":/img/security-medium.png", QSize(48, 48), QIcon::Normal, QIcon::On);
                 btnIcon.addFile(":/img/trash-empty.png", QSize(48, 48), QIcon::Disabled, QIcon::Off);
                 actionBtn->setIcon(btnIcon);
                 if (state) {
                     actionBtn->setEnabled(false);
-                    actionBtn->setToolTip(tr(IS_REMOVED_TT));
+                    actionBtn->setToolTip(tr("Certificate has been removed."));
                 }
                 mRemoveList->addCertificate(cert, state, actionBtn);
             }
@@ -1193,8 +1184,8 @@
                     oldInstallCerts.append(cert);
                     QToolButton* actionBtn = new QToolButton();
                     QIcon btnIcon;
-                    actionBtn->setProperty("ToolTip_Off", tr(IS_INSTALLED_TT));
-                    actionBtn->setProperty("ToolTip_On", tr(IS_NOT_INSTALLED_TT));
+                    actionBtn->setProperty("ToolTip_Off", tr("Certificate is installed."));
+                    actionBtn->setProperty("ToolTip_On", tr("Certifcate is not installed."));
                     btnIcon.addFile(":/img/security-high.png", QSize(48, 48), QIcon::Normal, QIcon::Off);
                     btnIcon.addFile(":/img/security-low.png", QSize(48, 48), QIcon::Normal, QIcon::On);
                     actionBtn->setIcon(btnIcon);
@@ -1205,8 +1196,8 @@
                     newInstallCerts.append(cert);
                     QToolButton* actionBtn = new QToolButton();
                     QIcon btnIcon;
-                    actionBtn->setProperty("ToolTip_Off", tr(NEW_INSTALL_TT));
-                    actionBtn->setProperty("ToolTip_On", tr(NOT_INSTALL_TT));
+                    actionBtn->setProperty("ToolTip_Off", tr("Certificate will be installed."));
+                    actionBtn->setProperty("ToolTip_On", tr("Certificate will not be installed."));
                     btnIcon.addFile(":/img/write-into-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off);
                     btnIcon.addFile(":/img/security-low.png", QSize(48, 48), QIcon::Normal, QIcon::On);
                     actionBtn->setIcon(btnIcon);
@@ -1221,15 +1212,15 @@
                     // Is removed, so set editable to false.
                     QToolButton* actionBtn = new QToolButton();
                     QIcon btnIcon;
-                    actionBtn->setProperty("ToolTip_Off", tr(NEW_REMOVE_TT));
-                    actionBtn->setProperty("ToolTip_On", tr(IS_NOT_REMOVED_TT));
+                    actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed."));
+                    actionBtn->setProperty("ToolTip_On", tr("Certificate has not been removed."));
                     btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off);
                     btnIcon.addFile(":/img/security-medium.png", QSize(48, 48), QIcon::Normal, QIcon::On);
                     btnIcon.addFile(":/img/trash-empty.png", QSize(48, 48), QIcon::Disabled, QIcon::Off);
                     actionBtn->setIcon(btnIcon);
                     if (state) {
                         actionBtn->setEnabled(false);
-                        actionBtn->setToolTip(tr(IS_REMOVED_TT));
+                        actionBtn->setToolTip(tr("Certificate has been removed."));
                     }
                     mRemoveList->addCertificate(cert, state, actionBtn);
                 }
@@ -1239,8 +1230,8 @@
                     newRemoveCerts.append(cert);
                     QToolButton* actionBtn = new QToolButton();
                     QIcon btnIcon;
-                    actionBtn->setProperty("ToolTip_Off", tr(NEW_REMOVE_TT));
-                    actionBtn->setProperty("ToolTip_On", tr(NOT_REMOVE_TT));
+                    actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed."));
+                    actionBtn->setProperty("ToolTip_On", tr("Certificate will not be removed."));
                     btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off);
                     btnIcon.addFile(":/img/security-medium.png", QSize(48, 48), QIcon::Normal, QIcon::On);
                     actionBtn->setIcon(btnIcon);
@@ -1417,8 +1408,8 @@
         QIcon btnIcon;
         btnIcon.addFile(":/img/write-into-48.png", QSize(48, 48), QIcon::Normal, QIcon::On);
         btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off);
-        actionBtn->setProperty("ToolTip_On", tr(NEW_INSTALL_TT));
-        actionBtn->setProperty("ToolTip_Off", tr(NEW_REMOVE_TT));
+        actionBtn->setProperty("ToolTip_On", tr("Certificate will be installed."));
+        actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed."));
         actionBtn->setIcon(btnIcon);
         mUpdatesManual->addCertificate(cert, state, actionBtn);
     }


More information about the Trustbridge-commits mailing list