Mercurial > trustbridge
comparison ui/mainwindow.cpp @ 1110:b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 15 Sep 2014 19:10:57 +0200 |
parents | 6594e8e63a25 |
children | df2297e741ad |
comparison
equal
deleted
inserted
replaced
1109:6594e8e63a25 | 1110:b6cb4fd7ee20 |
---|---|
90 #ifdef WIN32 | 90 #ifdef WIN32 |
91 #define HELP_PATH "/doc/index.html" | 91 #define HELP_PATH "/doc/index.html" |
92 #else | 92 #else |
93 #define HELP_PATH "/../share/doc/trustbridge/index.html" | 93 #define HELP_PATH "/../share/doc/trustbridge/index.html" |
94 #endif | 94 #endif |
95 | |
96 #define NEW_INSTALL_TT "Certificate will be installed." | |
97 #define NOT_INSTALL_TT "Certificate will not be installed." | |
98 #define NEW_REMOVE_TT "Certificate will be removed." | |
99 #define NOT_REMOVE_TT "Certificate will not be removed." | |
100 #define IS_INSTALLED_TT "Certificate is installed." | |
101 #define IS_NOT_INSTALLED_TT "Certifcate is not installed." | |
102 #define IS_REMOVED_TT "Certificate has been removed." | |
103 #define IS_NOT_REMOVED_TT "Certificate has not been removed." | |
104 | 95 |
105 static void activateDetailsButton(QPushButton *); | 96 static void activateDetailsButton(QPushButton *); |
106 static void deactivateDetailsButton(QPushButton *); | 97 static void deactivateDetailsButton(QPushButton *); |
107 | 98 |
108 MainWindow::MainWindow(bool trayMode): | 99 MainWindow::MainWindow(bool trayMode): |
1151 QToolButton* actionBtn = new QToolButton(); | 1142 QToolButton* actionBtn = new QToolButton(); |
1152 QIcon btnIcon; | 1143 QIcon btnIcon; |
1153 if (!state) { | 1144 if (!state) { |
1154 btnIcon.addFile(":/img/write-into-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); | 1145 btnIcon.addFile(":/img/write-into-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1155 btnIcon.addFile(":/img/security-low.png", QSize(48, 48), QIcon::Normal, QIcon::On); | 1146 btnIcon.addFile(":/img/security-low.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1156 actionBtn->setProperty("ToolTip_Off", tr(NEW_INSTALL_TT)); | 1147 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be installed.")); |
1157 actionBtn->setProperty("ToolTip_On", tr(IS_NOT_INSTALLED_TT)); | 1148 actionBtn->setProperty("ToolTip_On", tr("Certifcate is not installed.")); |
1158 } else { | 1149 } else { |
1159 actionBtn->setProperty("ToolTip_Off", tr(IS_INSTALLED_TT)); | 1150 actionBtn->setProperty("ToolTip_Off", tr("Certificate is installed.")); |
1160 actionBtn->setProperty("ToolTip_On", tr(NEW_REMOVE_TT)); | 1151 actionBtn->setProperty("ToolTip_On", tr("Certificate will be removed.")); |
1161 btnIcon.addFile(":/img/security-high.png", QSize(48, 48), QIcon::Normal, QIcon::Off); | 1152 btnIcon.addFile(":/img/security-high.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1162 btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); | 1153 btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1163 } | 1154 } |
1164 actionBtn->setIcon(btnIcon); | 1155 actionBtn->setIcon(btnIcon); |
1165 mInstallList->addCertificate(cert, state, actionBtn); | 1156 mInstallList->addCertificate(cert, state, actionBtn); |
1166 } | 1157 } |
1167 else { | 1158 else { |
1168 oldRemoveCerts.append(cert); | 1159 oldRemoveCerts.append(cert); |
1169 QToolButton* actionBtn = new QToolButton(); | 1160 QToolButton* actionBtn = new QToolButton(); |
1170 QIcon btnIcon; | 1161 QIcon btnIcon; |
1171 actionBtn->setProperty("ToolTip_Off", tr(NEW_REMOVE_TT)); | 1162 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed.")); |
1172 actionBtn->setProperty("ToolTip_On", tr(IS_NOT_REMOVED_TT)); | 1163 actionBtn->setProperty("ToolTip_On", tr("Certificate has not been removed.")); |
1173 btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); | 1164 btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1174 btnIcon.addFile(":/img/security-medium.png", QSize(48, 48), QIcon::Normal, QIcon::On); | 1165 btnIcon.addFile(":/img/security-medium.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1175 btnIcon.addFile(":/img/trash-empty.png", QSize(48, 48), QIcon::Disabled, QIcon::Off); | 1166 btnIcon.addFile(":/img/trash-empty.png", QSize(48, 48), QIcon::Disabled, QIcon::Off); |
1176 actionBtn->setIcon(btnIcon); | 1167 actionBtn->setIcon(btnIcon); |
1177 if (state) { | 1168 if (state) { |
1178 actionBtn->setEnabled(false); | 1169 actionBtn->setEnabled(false); |
1179 actionBtn->setToolTip(tr(IS_REMOVED_TT)); | 1170 actionBtn->setToolTip(tr("Certificate has been removed.")); |
1180 } | 1171 } |
1181 mRemoveList->addCertificate(cert, state, actionBtn); | 1172 mRemoveList->addCertificate(cert, state, actionBtn); |
1182 } | 1173 } |
1183 } | 1174 } |
1184 } | 1175 } |
1191 if (mInstalledList.getCertificates().contains(cert)) { | 1182 if (mInstalledList.getCertificates().contains(cert)) { |
1192 // Was in the old list. | 1183 // Was in the old list. |
1193 oldInstallCerts.append(cert); | 1184 oldInstallCerts.append(cert); |
1194 QToolButton* actionBtn = new QToolButton(); | 1185 QToolButton* actionBtn = new QToolButton(); |
1195 QIcon btnIcon; | 1186 QIcon btnIcon; |
1196 actionBtn->setProperty("ToolTip_Off", tr(IS_INSTALLED_TT)); | 1187 actionBtn->setProperty("ToolTip_Off", tr("Certificate is installed.")); |
1197 actionBtn->setProperty("ToolTip_On", tr(IS_NOT_INSTALLED_TT)); | 1188 actionBtn->setProperty("ToolTip_On", tr("Certifcate is not installed.")); |
1198 btnIcon.addFile(":/img/security-high.png", QSize(48, 48), QIcon::Normal, QIcon::Off); | 1189 btnIcon.addFile(":/img/security-high.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1199 btnIcon.addFile(":/img/security-low.png", QSize(48, 48), QIcon::Normal, QIcon::On); | 1190 btnIcon.addFile(":/img/security-low.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1200 actionBtn->setIcon(btnIcon); | 1191 actionBtn->setIcon(btnIcon); |
1201 mInstallList->addCertificate(cert, state, actionBtn); | 1192 mInstallList->addCertificate(cert, state, actionBtn); |
1202 } | 1193 } |
1203 else { | 1194 else { |
1204 // Is a brand new certificate | 1195 // Is a brand new certificate |
1205 newInstallCerts.append(cert); | 1196 newInstallCerts.append(cert); |
1206 QToolButton* actionBtn = new QToolButton(); | 1197 QToolButton* actionBtn = new QToolButton(); |
1207 QIcon btnIcon; | 1198 QIcon btnIcon; |
1208 actionBtn->setProperty("ToolTip_Off", tr(NEW_INSTALL_TT)); | 1199 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be installed.")); |
1209 actionBtn->setProperty("ToolTip_On", tr(NOT_INSTALL_TT)); | 1200 actionBtn->setProperty("ToolTip_On", tr("Certificate will not be installed.")); |
1210 btnIcon.addFile(":/img/write-into-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); | 1201 btnIcon.addFile(":/img/write-into-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1211 btnIcon.addFile(":/img/security-low.png", QSize(48, 48), QIcon::Normal, QIcon::On); | 1202 btnIcon.addFile(":/img/security-low.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1212 actionBtn->setIcon(btnIcon); | 1203 actionBtn->setIcon(btnIcon); |
1213 mUpdatesNew->addCertificate(cert, state, actionBtn); | 1204 mUpdatesNew->addCertificate(cert, state, actionBtn); |
1214 } | 1205 } |
1219 // Was in the old list. | 1210 // Was in the old list. |
1220 oldRemoveCerts.append(cert); | 1211 oldRemoveCerts.append(cert); |
1221 // Is removed, so set editable to false. | 1212 // Is removed, so set editable to false. |
1222 QToolButton* actionBtn = new QToolButton(); | 1213 QToolButton* actionBtn = new QToolButton(); |
1223 QIcon btnIcon; | 1214 QIcon btnIcon; |
1224 actionBtn->setProperty("ToolTip_Off", tr(NEW_REMOVE_TT)); | 1215 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed.")); |
1225 actionBtn->setProperty("ToolTip_On", tr(IS_NOT_REMOVED_TT)); | 1216 actionBtn->setProperty("ToolTip_On", tr("Certificate has not been removed.")); |
1226 btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); | 1217 btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1227 btnIcon.addFile(":/img/security-medium.png", QSize(48, 48), QIcon::Normal, QIcon::On); | 1218 btnIcon.addFile(":/img/security-medium.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1228 btnIcon.addFile(":/img/trash-empty.png", QSize(48, 48), QIcon::Disabled, QIcon::Off); | 1219 btnIcon.addFile(":/img/trash-empty.png", QSize(48, 48), QIcon::Disabled, QIcon::Off); |
1229 actionBtn->setIcon(btnIcon); | 1220 actionBtn->setIcon(btnIcon); |
1230 if (state) { | 1221 if (state) { |
1231 actionBtn->setEnabled(false); | 1222 actionBtn->setEnabled(false); |
1232 actionBtn->setToolTip(tr(IS_REMOVED_TT)); | 1223 actionBtn->setToolTip(tr("Certificate has been removed.")); |
1233 } | 1224 } |
1234 mRemoveList->addCertificate(cert, state, actionBtn); | 1225 mRemoveList->addCertificate(cert, state, actionBtn); |
1235 } | 1226 } |
1236 else { | 1227 else { |
1237 // Was in the old list with status "install" and now has the | 1228 // Was in the old list with status "install" and now has the |
1238 // status "remove". | 1229 // status "remove". |
1239 newRemoveCerts.append(cert); | 1230 newRemoveCerts.append(cert); |
1240 QToolButton* actionBtn = new QToolButton(); | 1231 QToolButton* actionBtn = new QToolButton(); |
1241 QIcon btnIcon; | 1232 QIcon btnIcon; |
1242 actionBtn->setProperty("ToolTip_Off", tr(NEW_REMOVE_TT)); | 1233 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed.")); |
1243 actionBtn->setProperty("ToolTip_On", tr(NOT_REMOVE_TT)); | 1234 actionBtn->setProperty("ToolTip_On", tr("Certificate will not be removed.")); |
1244 btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); | 1235 btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1245 btnIcon.addFile(":/img/security-medium.png", QSize(48, 48), QIcon::Normal, QIcon::On); | 1236 btnIcon.addFile(":/img/security-medium.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1246 actionBtn->setIcon(btnIcon); | 1237 actionBtn->setIcon(btnIcon); |
1247 mUpdatesRemove->addCertificate(cert, state, actionBtn); | 1238 mUpdatesRemove->addCertificate(cert, state, actionBtn); |
1248 } | 1239 } |
1415 if (!mUpdatesManual->contains(cert)) { | 1406 if (!mUpdatesManual->contains(cert)) { |
1416 QToolButton* actionBtn = new QToolButton(); | 1407 QToolButton* actionBtn = new QToolButton(); |
1417 QIcon btnIcon; | 1408 QIcon btnIcon; |
1418 btnIcon.addFile(":/img/write-into-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); | 1409 btnIcon.addFile(":/img/write-into-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1419 btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); | 1410 btnIcon.addFile(":/img/write-remove-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1420 actionBtn->setProperty("ToolTip_On", tr(NEW_INSTALL_TT)); | 1411 actionBtn->setProperty("ToolTip_On", tr("Certificate will be installed.")); |
1421 actionBtn->setProperty("ToolTip_Off", tr(NEW_REMOVE_TT)); | 1412 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed.")); |
1422 actionBtn->setIcon(btnIcon); | 1413 actionBtn->setIcon(btnIcon); |
1423 mUpdatesManual->addCertificate(cert, state, actionBtn); | 1414 mUpdatesManual->addCertificate(cert, state, actionBtn); |
1424 } | 1415 } |
1425 else { | 1416 else { |
1426 mUpdatesManual->removeCertificate(cert); | 1417 mUpdatesManual->removeCertificate(cert); |