- Timestamp:
- Jun 22, 2010, 3:38:24 PM (14 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/globals.h
r119 r121 42 42 43 43 #ifndef HANDHELD 44 #include <QtToolBarDialog>44 #include "qttoolbardialog.h" 45 45 #endif 46 46 -
trunk/src/main.cpp
r116 r121 56 56 if (en.load("tspsg_en", PATH_L10N)) 57 57 app.installTranslator(&en); 58 else if (en.load("tspsg_en", ":/l10n")) 59 app.installTranslator(&en); 58 60 59 61 MainWindow mainwindow; -
trunk/src/mainwindow.cpp
r119 r121 23 23 24 24 #include "mainwindow.h" 25 26 #ifdef _T_T_L_ 27 #include "_.h" 28 _B_ _I_ _N_ _G_ _O_ 29 #endif 25 30 26 31 /*! … … 510 515 bb->button(QDialogButtonBox::Ok)->setCursor(QCursor(Qt::PointingHandCursor)); 511 516 512 lblTranslated->setText(QApplication::translate("--------", " TRANSLATION", "Please, provide translator credits here."));513 if (lblTranslated->text() == " TRANSLATION")517 lblTranslated->setText(QApplication::translate("--------", "AUTHORS", "Please, provide translator credits here.")); 518 if (lblTranslated->text() == "AUTHORS") 514 519 lblTranslated->hide(); 515 520 else { … … 520 525 hb2->addWidget(lblTranslated); 521 526 } 527 528 // This one isn't displayed anywhere, yet. Provided as a placeholder for future use. 529 QApplication::translate("--------", "VERSION", "Please, provide your translation version here."); 522 530 523 531 hb2->addWidget(bb); … … 535 543 dlg->setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); 536 544 dlg->setWindowTitle(tr("About %1").arg(QApplication::applicationName())); 537 dlg->setWindowIcon(QIcon (":/images/icons/help-about.png"));545 dlg->setWindowIcon(QIcon::fromTheme("help-about", QIcon(":/images/icons/help-about.png"))); 538 546 dlg->setLayout(vb); 539 547 … … 635 643 cur.insertText(tr("Task:")); 636 644 outputMatrix(cur, matrix); 637 if (settings->value("Output/ShowGraph", DEF_SHOW_GRAPH).toBool()) 645 if (settings->value("Output/ShowGraph", DEF_SHOW_GRAPH).toBool()) { 646 #ifdef _T_T_L_ 647 _m_ _a_ _g_ _i_ _c_(pic) 648 #endif 638 649 drawNode(pic, 0); 650 } 639 651 cur.insertHtml("<hr>"); 640 652 cur.insertBlock(fmt_paragraph); … … 880 892 y = r * (3 * nstep + 1); 881 893 894 #ifdef _T_T_L_ 895 if (nstep == -481124) { 896 _t_t_l_(pic, r, x); 897 return; 898 } 899 #endif 900 882 901 pic.drawEllipse(QPointF(x, y), r, r); 883 902 … … 979 998 void MainWindow::loadLangList() 980 999 { 981 QDir dir(PATH_L10N, "tspsg_*.qm", QDir::Name | QDir::IgnoreCase, QDir::Files); 982 if (!dir.exists()) 983 return; 984 QFileInfoList langs = dir.entryInfoList(); 985 if (langs.size() <= 0) 986 return; 1000 QMap<QString, QStringList> langlist; 1001 QFileInfoList langs; 1002 QFileInfo lang; 1003 QString name; 1004 QStringList language, dirs; 1005 QTranslator t; 1006 QDir dir; 1007 dir.setFilter(QDir::Files); 1008 dir.setNameFilters(QStringList("tspsg_*.qm")); 1009 dir.setSorting(QDir::NoSort); 1010 1011 dirs << PATH_L10N << ":/l10n"; 1012 foreach (QString dirname, dirs) { 1013 dir.setPath(dirname); 1014 if (dir.exists()) { 1015 langs = dir.entryInfoList(); 1016 for (int k = 0; k < langs.size(); k++) { 1017 lang = langs.at(k); 1018 if (lang.completeBaseName().compare("tspsg_en", Qt::CaseInsensitive) && !langlist.contains(lang.completeBaseName().mid(6)) && t.load(lang.completeBaseName(), dirname)) { 1019 1020 language.clear(); 1021 language.append(lang.completeBaseName().mid(6)); 1022 language.append(t.translate("--------", "COUNTRY", "Please, provide an ISO 3166-1 alpha-2 country code for this translation language here (eg., UA).").toLower()); 1023 language.append(t.translate("--------", "LANGNAME", "Please, provide a native name of your translation language here.")); 1024 language.append(t.translate("MainWindow", "Set application language to %1", "").arg(name)); 1025 1026 langlist.insert(language.at(0), language); 1027 } 1028 } 1029 } 1030 } 1031 987 1032 QAction *a; 988 QTranslator t; 989 QString name; 990 for (int k = 0; k < langs.size(); k++) { 991 QFileInfo lang = langs.at(k); 992 if (lang.completeBaseName().compare("tspsg_en", Qt::CaseInsensitive) && t.load(lang.completeBaseName(), PATH_L10N)) { 993 name = t.translate("--------", "LANGNAME", "Please, provide a native name of your translation language here."); 994 a = menuSettingsLanguage->addAction(name); 995 a->setStatusTip(t.translate("MainWindow", "Set application language to %1", "").arg(name)); 996 a->setData(lang.completeBaseName().mid(6)); 997 a->setCheckable(true); 998 a->setActionGroup(groupSettingsLanguageList); 999 if (settings->value("Language", QLocale::system().name()).toString().startsWith(lang.completeBaseName().mid(6))) 1000 a->setChecked(true); 1001 } 1033 foreach (language, langlist) { 1034 a = menuSettingsLanguage->addAction(language.at(2)); 1035 a->setStatusTip(language.at(3)); 1036 a->setIcon(QIcon::fromTheme(QString("flag-%1").arg(language.at(1))/*, QIcon(QString(":/images/icons/l10n/%1.png").arg(language.at(1)))*/)); 1037 a->setData(language.at(0)); 1038 a->setCheckable(true); 1039 a->setActionGroup(groupSettingsLanguageList); 1040 if (settings->value("Language", QLocale::system().name()).toString().startsWith(language.at(0))) 1041 a->setChecked(true); 1002 1042 } 1003 1043 } … … 1034 1074 else { 1035 1075 // No luck. Let's try to load a bundled one. 1036 if (qtTranslator->load("qt_" + lng, PATH_L10N)) 1076 if (qtTranslator->load("qt_" + lng, PATH_L10N)) { 1077 // We have a translation in the localization direcotry. 1037 1078 qApp->installTranslator(qtTranslator); 1038 else { 1039 // Qt library translation unavailable 1079 } else if (qtTranslator->load("qt_" + lng, ":/l10n")) { 1080 // We have a translation "built-in" into application resources. 1081 qApp->installTranslator(qtTranslator); 1082 } else { 1083 // Qt library translation unavailable for this language. 1040 1084 delete qtTranslator; 1041 1085 qtTranslator = NULL; … … 1045 1089 // Now let's load application translation. 1046 1090 translator = new QTranslator(this); 1047 if (translator->load("tspsg_" + lng, PATH_L10N)) 1091 if (translator->load("tspsg_" + lng, PATH_L10N)) { 1092 // We have a translation in the localization directory. 1048 1093 qApp->installTranslator(translator); 1049 else { 1094 } else if (translator->load("tspsg_" + lng, ":/l10n")) { 1095 // We have a translation "built-in" into application resources. 1096 qApp->installTranslator(translator); 1097 } else { 1050 1098 delete translator; 1051 1099 translator = NULL; … … 1053 1101 settings->remove("Language"); 1054 1102 QApplication::setOverrideCursor(QCursor(Qt::ArrowCursor)); 1055 if (isVisible()) 1056 QMessageBox::warning(this, tr("Language Change"), tr("Unable to load the translation language.\nFalling back to autodetection.")); 1057 else 1058 QMessageBox::warning(NULL, tr("Language Change"), tr("Unable to load the translation language.\nFalling back to autodetection.")); 1103 QMessageBox::warning(isVisible() ? this : NULL, tr("Language Change"), tr("Unable to load the translation language.\nFalling back to autodetection.")); 1059 1104 QApplication::restoreOverrideCursor(); 1060 1105 } … … 1236 1281 Ui::MainWindow::setupUi(this); 1237 1282 1283 // File Menu 1284 actionFileNew->setIcon(QIcon::fromTheme("document-new", QIcon(":/images/icons/document-new.png"))); 1285 actionFileOpen->setIcon(QIcon::fromTheme("document-open", QIcon(":/images/icons/document-open.png"))); 1286 actionFileSave->setIcon(QIcon::fromTheme("document-save", QIcon(":/images/icons/document-save.png"))); 1287 menuFileSaveAs->setIcon(QIcon::fromTheme("document-save-as", QIcon(":/images/icons/document-save-as.png"))); 1288 actionFileExit->setIcon(QIcon::fromTheme("application-exit", QIcon(":/images/icons/application-exit.png"))); 1289 // Settings Menu 1290 menuSettingsLanguage->setIcon(QIcon::fromTheme("preferences-desktop-locale", QIcon(":/images/icons/preferences-desktop-locale.png"))); 1291 actionSettingsLanguageEnglish->setIcon(QIcon::fromTheme("flag-gb"/*, QIcon(":/images/icons/l10n/gb.png")*/)); 1292 menuSettingsStyle->setIcon(QIcon::fromTheme("preferences-desktop-theme", QIcon(":/images/icons/preferences-desktop-theme.png"))); 1293 actionSettingsPreferences->setIcon(QIcon::fromTheme("preferences-system", QIcon(":/images/icons/preferences-system.png"))); 1294 // Help Menu 1295 actionHelpContents->setIcon(QIcon::fromTheme("help-contents", QIcon(":/images/icons/help-contents.png"))); 1296 actionHelpContextual->setIcon(QIcon::fromTheme("help-contextual", QIcon(":/images/icons/help-contextual.png"))); 1297 actionHelpAbout->setIcon(QIcon::fromTheme("help-about", QIcon(":/images/icons/help-about.png"))); 1298 // Buttons 1299 buttonRandom->setIcon(QIcon::fromTheme("roll", QIcon(":/images/icons/roll.png"))); 1300 buttonSolve->setIcon(QIcon::fromTheme("dialog-ok", QIcon(":/images/icons/dialog-ok.png"))); 1301 buttonSaveSolution->setIcon(QIcon::fromTheme("document-save-as", QIcon(":/images/icons/document-save-as.png"))); 1302 buttonBackToTask->setIcon(QIcon::fromTheme("go-previous", QIcon(":/images/icons/go-previous.png"))); 1303 1304 // action->setIcon(QIcon::fromTheme("", QIcon(":/images/icons/.png"))); 1305 1238 1306 #if QT_VERSION >= 0x040600 1239 1307 setToolButtonStyle(Qt::ToolButtonFollowStyle); … … 1276 1344 actionFilePrintPreview->setObjectName("actionFilePrintPreview"); 1277 1345 actionFilePrintPreview->setEnabled(false); 1278 actionFilePrintPreview->setIcon(QIcon (":/images/icons/document-print-preview.png"));1346 actionFilePrintPreview->setIcon(QIcon::fromTheme("document-print-preview", QIcon(":/images/icons/document-print-preview.png"))); 1279 1347 1280 1348 actionFilePrint = new QAction(this); 1281 1349 actionFilePrint->setObjectName("actionFilePrint"); 1282 1350 actionFilePrint->setEnabled(false); 1283 actionFilePrint->setIcon(QIcon (":/images/icons/document-print.png"));1351 actionFilePrint->setIcon(QIcon::fromTheme("document-print", QIcon(":/images/icons/document-print.png"))); 1284 1352 1285 1353 menuFile->insertAction(actionFileExit,actionFilePrintPreview); … … 1301 1369 #ifndef HANDHELD 1302 1370 actionSettingsToolbarsConfigure = new QAction(this); 1303 actionSettingsToolbarsConfigure->setIcon(QIcon (":/images/icons/configure-toolbars.png"));1371 actionSettingsToolbarsConfigure->setIcon(QIcon::fromTheme("configure-toolbars", QIcon(":/images/icons/configure-toolbars.png"))); 1304 1372 #endif // HANDHELD 1305 1373 1306 1374 #ifdef Q_OS_WIN32 1307 1375 actionHelpCheck4Updates = new QAction(this); 1308 actionHelpCheck4Updates->setIcon(QIcon (":/images/icons/system-software-update.png"));1376 actionHelpCheck4Updates->setIcon(QIcon::fromTheme("system-software-update", QIcon(":/images/icons/system-software-update.png"))); 1309 1377 actionHelpCheck4Updates->setEnabled(hasUpdater()); 1310 1378 menuHelp->insertAction(actionHelpAboutQt, actionHelpCheck4Updates); -
trunk/src/settingsdialog.cpp
r119 r121 35 35 setupUi(this); 36 36 37 buttonBox->button(QDialogButtonBox::Save)->setIcon(QIcon(":/images/icons/dialog-ok.png")); 38 buttonBox->button(QDialogButtonBox::Save)->setStatusTip(tr("Save new preferences")); 39 buttonBox->button(QDialogButtonBox::Save)->setCursor(QCursor(Qt::PointingHandCursor)); 40 buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QIcon(":/images/icons/dialog-cancel.png")); 37 setWindowIcon(QIcon::fromTheme("preferences-system", QIcon(":/images/icons/preferences-system.png"))); 38 39 buttonBox->button(QDialogButtonBox::Ok)->setIcon(QIcon::fromTheme("dialog-ok", QIcon(":/images/icons/dialog-ok.png"))); 40 buttonBox->button(QDialogButtonBox::Ok)->setStatusTip(tr("Save new preferences")); 41 buttonBox->button(QDialogButtonBox::Ok)->setCursor(QCursor(Qt::PointingHandCursor)); 42 buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QIcon::fromTheme("dialog-cancel", QIcon(":/images/icons/dialog-cancel.png"))); 41 43 buttonBox->button(QDialogButtonBox::Cancel)->setStatusTip(tr("Close without saving preferences")); 42 44 buttonBox->button(QDialogButtonBox::Cancel)->setCursor(QCursor(Qt::PointingHandCursor)); 45 46 buttonColor->setIcon(QIcon::fromTheme("format-text-color", QIcon(":/images/icons/format-text-color.png"))); 47 buttonFont->setIcon(QIcon::fromTheme("preferences-desktop-font", QIcon(":/images/icons/preferences-desktop-font.png"))); 48 buttonHelp->setIcon(QIcon::fromTheme("help-hint", QIcon(":/images/icons/help-hint.png"))); 43 49 44 50 QPalette p = bgWhite->palette(); … … 108 114 imgIcon->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Expanding); 109 115 imgIcon->setFrameShape(QFrame::NoFrame); 110 imgIcon->setPixmap(Q Pixmap(":/images/icons/preferences-system.png"));116 imgIcon->setPixmap(QIcon::fromTheme("preferences-system", QIcon(":/images/icons/preferences-system.png")).pixmap(128, 128)); 111 117 imgIcon->setStyleSheet("background-color: #0080C0; padding-top: 11px;"); 112 118 imgIcon->setAlignment(Qt::AlignTop | Qt::AlignHCenter); -
trunk/src/settingsdialog.h
r116 r121 61 61 #ifdef Q_OS_WINCE_WM 62 62 QRect currentGeometry; 63 #elif !defined( Q_OS_SYMBIAN)63 #elif !defined(HANDHELD) 64 64 QCheckBox *cbSaveState; 65 65 QLabel *imgIcon;
Note: See TracChangeset
for help on using the changeset viewer.