Changeset e2abfd326f in tspsg for src/mainwindow.cpp


Ignore:
Timestamp:
Mar 12, 2010, 8:28:42 PM (14 years ago)
Author:
Oleksii Serdiuk
Branches:
0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
Children:
394216e468
Parents:
f19df0a3e5
Message:

+ Translatable About dialog.

  • Improved installation rules in .pro file.
  • Disabled SVG and JPEG support. They aren't needed at this point.
  • Fixed a bug when labels were hardly visible under Windows Vista/7 whith translucency on and a dark background behind the application.
  • Fixed a bug when Main Window area was blank if the application was compiled using Qt < 4.6.0.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mainwindow.cpp

    rf19df0a3e5 re2abfd326f  
    295295                if (untitled)
    296296                        setFileName();
     297#ifdef Q_OS_WIN32
     298                if (QtWin::isCompositionEnabled() && settings->value("UseTranslucency", DEF_USE_TRANSLUCENCY).toBool())  {
     299                        toggleStyle(labelVariant, true);
     300                        toggleStyle(labelCities, true);
     301                }
     302#endif
    297303                QApplication::restoreOverrideCursor();
    298304        }
     
    304310QString title;
    305311#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
    306         title += QString::fromUtf8("<b>TSPSG<br>TSP Solver and Generator</b><br>");
     312        title += QString("<b>TSPSG<br>TSP Solver and Generator</b><br>");
    307313#else
    308         title += QString::fromUtf8("<b>TSPSG: TSP Solver and Generator</b><br>");
    309 #endif // Q_OS_WINCE
    310         title += QString::fromUtf8("Version: <b>"BUILD_VERSION"</b><br>");
    311         title += QString::fromUtf8("<b>&copy; 2007-%1 Lёppa</b><br>").arg(QDate::currentDate().toString("yyyy"));
    312         title += QString::fromUtf8("<b><a href=\"http://tspsg.sourceforge.net/\">http://tspsg.sf.net/</a></b><br>");
     314        title += QString("<b>TSPSG: TSP Solver and Generator</b><br>");
     315#endif // Q_OS_WINCE || Q_OS_SYMBIAN
     316        title += QString("%1: <b>%2</b><br>").arg(tr("Version"), BUILD_VERSION);
     317#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
     318        title += QString("<b>&copy; 2007-%1 Oleksii \"Lёppa\" Serdiuk</b><br>").arg(QDate::currentDate().toString("yyyy"));
     319        title += QString("<b><a href=\"http://tspsg.sourceforge.net/\">http://tspsg.sourceforge.net/</a></b>");
     320#else
     321        title += QString("<b><a href=\"http://tspsg.sourceforge.net/\">http://tspsg.sf.net/</a></b>");
     322#endif // Q_OS_WINCE && Q_OS_SYMBIAN
     323
    313324QString about;
    314         about += QString::fromUtf8("Target OS (ARCH): <b>%1</b><br>").arg(OS);
     325        about += QString("%1: <b>%2</b><br>").arg(tr("Target OS (ARCH)"), OS);
    315326#ifndef STATIC_BUILD
    316         about += "Qt library (shared):<br>";
    317         about += QString::fromUtf8("&nbsp;&nbsp;&nbsp;&nbsp;Build time: <b>%1</b><br>").arg(QT_VERSION_STR);
    318         about += QString::fromUtf8("&nbsp;&nbsp;&nbsp;&nbsp;Runtime: <b>%1</b><br>").arg(qVersion());
     327        about += QString("%1 (%2):<br>").arg(tr("Qt library"), tr("shared"));
     328        about += QString("&nbsp;&nbsp;&nbsp;&nbsp;%1: <b>%2</b><br>").arg(tr("Build time"), QT_VERSION_STR);
     329        about += QString("&nbsp;&nbsp;&nbsp;&nbsp;%1: <b>%2</b><br>").arg(tr("Runtime"), qVersion());
    319330#else
    320         about += QString::fromUtf8("Qt library: <b>%1</b> (static)<br>").arg(QT_VERSION_STR);
     331        about += QString("%1: <b>%2</b> (%3)<br>").arg(tr("Qt library"), QT_VERSION_STR, tr("static"));
    321332#endif // STATIC_BUILD
    322         about += QString::fromUtf8("Built on <b>%1</b> at <b>%2</b><br>").arg(__DATE__).arg(__TIME__);
    323 //      about += "<br>";
    324 //      about += QString::fromUtf8("Id: <b>"VERSIONID"</b><br>");
    325         about += QString::fromUtf8("Algorithm: <b>%1</b><br>").arg(CTSPSolver::getVersionId());
     333        about += tr("Buid <b>%1</b>, built on <b>%2</b> at <b>%3</b>").arg(BUILD_NUMBER).arg(__DATE__).arg(__TIME__) + "<br>";
     334        about += QString("%1: <b>%2</b><br>").arg(tr("Algorithm"), CTSPSolver::getVersionId());
    326335        about += "<br>";
    327         about += "TSPSG is free software: you can redistribute it and/or modify it<br>"
     336        about += tr("TSPSG is free software: you can redistribute it and/or modify it<br>"
    328337                "under the terms of the GNU General Public License as published<br>"
    329338                "by the Free Software Foundation, either version 3 of the License,<br>"
     
    336345                "<br>"
    337346                "You should have received a copy of the GNU General Public License<br>"
    338                 "along with TSPSG.  If not, see <a href=\"http://www.gnu.org/licenses/\">http://www.gnu.org/licenses/</a>.";
     347                "along with TSPSG.  If not, see <a href=\"http://www.gnu.org/licenses/\">http://www.gnu.org/licenses/</a>.");
    339348
    340349QDialog *dlg = new QDialog(this);
    341350QLabel *lblIcon = new QLabel(dlg),
    342         *lblTitle = new QLabel(dlg);
     351        *lblTitle = new QLabel(dlg),
     352        *lblTranslated = new QLabel(dlg);
     353#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
     354QLabel *lblSubTitle = new QLabel(QString("<b>&copy; 2007-%1 Oleksii \"Lёppa\" Serdiuk</b>").arg(QDate::currentDate().toString("yyyy")), dlg);
     355#endif // Q_OS_WINCE || Q_OS_SYMBIAN
    343356QTextBrowser *txtAbout = new QTextBrowser(dlg);
    344357QVBoxLayout *vb = new QVBoxLayout();
    345 QHBoxLayout *hb = new QHBoxLayout();
     358QHBoxLayout *hb1 = new QHBoxLayout(),
     359        *hb2 = new QHBoxLayout();
    346360QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, dlg);
    347361
    348362        lblIcon->setPixmap(QPixmap(":/images/tspsg.png").scaledToWidth(logicalDpiX() * 2 / 3, Qt::SmoothTransformation));
    349363        lblIcon->setAlignment(Qt::AlignTop);
     364#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
     365        lblIcon->setStyleSheet(QString("QLabel {background-color: %1; border-color: %2; border-width: 1px; border-style: solid; border-radius: 3px;}").arg(palette().window().color().name(), palette().windowText().color().name()));
     366#endif
     367
    350368        lblTitle->setOpenExternalLinks(true);
    351369        lblTitle->setText(title);
    352 
    353         hb->addWidget(lblIcon);
    354         hb->addWidget(lblTitle);
    355         hb->addStretch();
    356 
    357 //      txtAbout->setTextInteractionFlags(txtAbout->textInteractionFlags() ^ Qt::TextEditable);
     370        lblTitle->setAlignment(Qt::AlignTop);
     371        lblTitle->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
     372#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
     373        lblTitle->setStyleSheet(QString("QLabel {background-color: %1; border-color: %2; border-width: 1px; border-style: solid; border-radius: 3px;}").arg(palette().window().color().name(), palette().shadow().color().name()));
     374#endif
     375
     376        hb1->addWidget(lblIcon);
     377        hb1->addWidget(lblTitle);
     378
    358379        txtAbout->setWordWrapMode(QTextOption::NoWrap);
    359380        txtAbout->setOpenExternalLinks(true);
    360381        txtAbout->setHtml(about);
    361382        txtAbout->moveCursor(QTextCursor::Start);
     383#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
     384        txtAbout->setStyleSheet(QString("QTextBrowser {border-color: %1; border-width: 1px; border-style: solid; border-radius: 3px;}").arg(palette().shadow().color().name()));
     385#endif
    362386
    363387        bb->button(QDialogButtonBox::Ok)->setCursor(QCursor(Qt::PointingHandCursor));
    364388
    365         vb->addLayout(hb);
     389        lblTranslated->setText(QApplication::translate("--------", "TRANSLATION", "Please, provide translator credits here."));
     390        if (lblTranslated->text() == "TRANSLATION")
     391                lblTranslated->hide();
     392        else {
     393                lblTranslated->setOpenExternalLinks(true);
     394#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
     395                lblTranslated->setStyleSheet(QString("QLabel {background-color: %1; border-color: %2; border-width: 1px; border-style: solid; border-radius: 3px;}").arg(palette().window().color().name(), palette().shadow().color().name()));
     396#endif
     397                hb2->addWidget(lblTranslated);
     398        }
     399
     400        hb2->addWidget(bb);
     401
     402#if defined(Q_OS_WINCE)
     403        vb->setMargin(3);
     404#endif
     405        vb->addLayout(hb1);
     406#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
     407        vb->addWidget(lblSubTitle);
     408#endif // Q_OS_WINCE || Q_OS_SYMBIAN
    366409        vb->addWidget(txtAbout);
    367         vb->addWidget(bb);
    368 
    369         dlg->setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
     410        vb->addLayout(hb2);
     411
     412        dlg->setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::MSWindowsFixedSizeDialogHint);
    370413        dlg->setWindowTitle(tr("About TSPSG"));
    371414        dlg->setLayout(vb);
     
    380423#endif // Q_OS_WIN32
    381424
    382         dlg->resize(450, 400);
     425        dlg->resize(450, 350);
     426
    383427        dlg->exec();
    384428
     
    825869        scrollArea->setWidget(tabWidget);
    826870        setCentralWidget(scrollArea);
     871#else
     872        setCentralWidget(tabWidget);
    827873#endif // Q_OS_WINCE
    828874
     
    890936{
    891937#ifdef Q_OS_WIN32
     938        toggleStyle(labelVariant, enable);
     939        toggleStyle(labelCities, enable);
     940        toggleStyle(statusBar(), enable);
    892941        tabWidget->setDocumentMode(enable);
    893942        QtWin::enableBlurBehindWindow(this, enable);
Note: See TracChangeset for help on using the changeset viewer.