Changeset 7ed8b57eea in tspsg


Ignore:
Timestamp:
Aug 31, 2013, 11:52:34 PM (11 years ago)
Author:
Oleksii Serdiuk
Branches:
appveyor, imgbot, master, readme
Children:
2a5e50e0a9
Parents:
1241232377
Message:

[BB10] UI fixes:

  • added proxy style and stylesheet to fix some UI issues on BlackBerry?;
  • removed style selection option because most styles have UI issues and removed About Qt menu item because About Qt dialog is too big;
  • load bigger (128x128) icons on BlackBerry? 10;
  • removed printing related items from menu as there's no printer;
  • made dialogs to be shown maximized;
  • made solution graph smaller;
  • made font smaller;
  • made output text color black;
  • start editing table cells on single tap;
  • don't show keyboard in about dialog.

Cherry-picks from
aa64ad40827cde0a444cd8198b0f3457aa191f8f
95b0ef73dcb4517ac2ae08867494204bbe8d7ea6
ccdffe3a5f84f12fba2e2f19ab249c31f1fcf35d
628500a5d687889823197e476953859d529af4f0

Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • src/defaults.h

    r1241232377 r7ed8b57eea  
    8686//! Default for "Embed solution graph into HTML"
    8787#define DEF_EMBED_GRAPH_INTO_HTML false
    88 //! Default solution graph size in centimeters (HQ size is this size * HQ_FACTOR)
    89 #define DEF_GRAPH_WIDTH 4.5
     88/*!
     89 * \def DEF_GRAPH_WIDTH
     90 * \brief Default solution graph size in centimeters (HQ size is this size * HQ_FACTOR)
     91 */
     92#ifdef Q_OS_BLACKBERRY
     93#   define DEF_GRAPH_WIDTH 2.5
     94#else
     95#   define DEF_GRAPH_WIDTH 4.5
     96#endif
    9097//! Default for "Show solution steps' matrices for every solution step"
    9198#define DEF_SHOW_MATRIX true
     
    104111#ifdef Q_OS_SYMBIAN
    105112#   define DEF_FONT_SIZE 8
     113#elif defined(Q_OS_BLACKBERRY)
     114#   define DEF_FONT_SIZE 7
    106115#else
    107116#   define DEF_FONT_SIZE 10
    108117#endif // Q_OS_SYMBIAN
    109 //! Default solution text color
    110 #define DEF_TEXT_COLOR QApplication::palette().color(QPalette::Text)
     118/*!
     119 * \def DEF_TEXT_COLOR
     120 * \brief Default solution text color
     121 */
     122#ifdef Q_OS_BLACKBERRY
     123#   define DEF_TEXT_COLOR Qt::black
     124#else
     125#   define DEF_TEXT_COLOR QApplication::palette().color(QPalette::Text)
     126#endif
    111127//! Default selected candidate color
    112128#define DEF_SELECTED_COLOR "#008000"
  • src/globals.h

    r1241232377 r7ed8b57eea  
    120120#ifndef DOXYGEN_EXCLUDE
    121121
    122 #ifdef HANDHELD
     122#if defined(HANDHELD) && !defined(Q_OS_BLACKBERRY)
    123123#   define ICON_SIZE "48x48"
    124124#   define ICON_FORMAT "png"
  • src/main.cpp

    r1241232377 r7ed8b57eea  
    2323
    2424#include "mainwindow.h"
     25#include "version.h"
     26
     27#ifdef Q_OS_BLACKBERRY
     28#   include "bb10proxystyle.h"
     29#endif // Q_OS_BLACKBERRY
    2530
    2631#include <QDateTime>
     
    2833#include <QTextCodec>
    2934#include <QTranslator>
    30 #include "version.h"
    3135
    3236#if QT_VERSION < QT_VERSION_CHECK(4,6,0)
     
    6468    app.setApplicationName("TSP Solver and Generator");
    6569    app.setApplicationVersion(BUILD_VERSION);
     70
     71#ifdef Q_OS_BLACKBERRY
     72    QApplication::setStartDragDistance(42);
     73    QApplication::setStyle(new BB10ProxyStyle);
     74    app.setStyleSheet(CSS_FIX);
     75#endif // Q_OS_BLACKBERRY
    6676
    6777    // Seeding random number generator
  • src/mainwindow.cpp

    r1241232377 r7ed8b57eea  
    149149    setAcceptDrops(true);
    150150
     151#ifdef Q_OS_BLACKBERRY
     152    taskView->setEditTriggers(QAbstractItemView::AllEditTriggers);
     153#endif
     154
    151155    initDocStyleSheet();
    152156
     
    182186    connect(actionFileSaveAsTask, SIGNAL(triggered()), SLOT(actionFileSaveAsTaskTriggered()));
    183187    connect(actionFileSaveAsSolution, SIGNAL(triggered()), SLOT(actionFileSaveAsSolutionTriggered()));
    184 #ifndef QT_NO_PRINTER
     188#ifndef QT_NO_PRINTDIALOG
    185189    connect(actionFilePrintPreview, SIGNAL(triggered()), SLOT(actionFilePrintPreviewTriggered()));
    186190    connect(actionFilePageSetup, SIGNAL(triggered()), SLOT(actionFilePageSetupTriggered()));
     
    483487}
    484488
    485 #ifndef QT_NO_PRINTER
     489#ifndef QT_NO_PRINTDIALOG
    486490void MainWindow::actionFilePrintPreviewTriggered()
    487491{
     
    541545    QApplication::restoreOverrideCursor();
    542546}
    543 #endif // QT_NO_PRINTER
     547#endif // QT_NO_PRINTDIALOG
    544548
    545549void MainWindow::actionSettingsPreferencesTriggered()
     
    744748    txtAbout->moveCursor(QTextCursor::Start);
    745749    txtAbout->setFrameShape(QFrame::NoFrame);
     750#ifdef Q_OS_BLACKBERRY
     751    txtAbout->setAttribute(Qt::WA_InputMethodEnabled, false);
     752#endif
    746753
    747754//      txtCredits->setWordWrapMode(QTextOption::NoWrap);
     
    750757    txtCredits->moveCursor(QTextCursor::Start);
    751758    txtCredits->setFrameShape(QFrame::NoFrame);
     759#ifdef Q_OS_BLACKBERRY
     760    txtCredits->setAttribute(Qt::WA_InputMethodEnabled, false);
     761#endif
    752762
    753763    txtLicense->setWordWrapMode(QTextOption::NoWrap);
     
    756766    txtLicense->moveCursor(QTextCursor::Start);
    757767    txtLicense->setFrameShape(QFrame::NoFrame);
     768#ifdef Q_OS_BLACKBERRY
     769    txtLicense->setAttribute(Qt::WA_InputMethodEnabled, false);
     770#endif
    758771
    759772    bb->button(QDialogButtonBox::Ok)->setCursor(QCursor(Qt::PointingHandCursor));
     
    807820#ifndef HANDHELD
    808821    dlg->resize(450, 350);
    809 #elif defined(Q_OS_SYMBIAN)
     822#elif defined(Q_OS_SYMBIAN) || defined(Q_OS_BLACKBERRY)
    810823    dlg->setWindowState(Qt::WindowMaximized);
    811824#endif
     
    857870    pd.setCancelButton(cancel);
    858871    pd.setMaximum(n);
     872    pd.setAutoClose(false);
    859873    pd.setAutoReset(false);
    860874    pd.setLabelText(tr("Calculating optimal route..."));
     
    17371751        Ui_MainWindow::retranslateUi(this);
    17381752
     1753#ifdef Q_OS_BLACKBERRY
     1754    menuSettings->removeAction(menuSettingsStyle->menuAction());
     1755#else
    17391756    loadStyleList();
     1757#endif
    17401758    loadToolbarList();
    17411759
    1742 #ifndef QT_NO_PRINTER
     1760#ifndef QT_NO_PRINTDIALOG
    17431761    actionFilePrintPreview->setText(tr("P&rint Preview..."));
    17441762#ifndef QT_NO_TOOLTIP
     
    17641782    actionFilePrint->setStatusTip(tr("Print current solution results"));
    17651783#endif // QT_NO_STATUSTIP
     1784#ifndef QT_NO_SHORTCUT
    17661785    actionFilePrint->setShortcut(tr("Ctrl+P"));
    1767 #endif // QT_NO_PRINTER
     1786#endif // QT_NO_SHORTCUT
     1787#endif // QT_NO_PRINTDIALOG
    17681788
    17691789#ifndef QT_NO_STATUSTIP
     
    18461866    actionFileOpen->setIcon(GET_ICON("document-open"));
    18471867    actionFileSave->setIcon(GET_ICON("document-save"));
    1848 #ifndef HANDHELD
     1868#if !defined(HANDHELD) || defined(Q_OS_BLACKBERRY)
    18491869    menuFileSaveAs->setIcon(GET_ICON("document-save-as"));
    18501870#endif
    18511871    actionFileExit->setIcon(GET_ICON("application-exit"));
    18521872    // Settings Menu
    1853 #ifndef HANDHELD
     1873#if !defined(HANDHELD) || defined(Q_OS_BLACKBERRY)
    18541874    menuSettingsLanguage->setIcon(GET_ICON("preferences-desktop-locale"));
    18551875#if QT_VERSION >= QT_VERSION_CHECK(4,6,0)
     
    18621882    actionSettingsPreferences->setIcon(GET_ICON("preferences-system"));
    18631883    // Help Menu
    1864 #ifndef HANDHELD
     1884#if !defined(HANDHELD) || defined(Q_OS_BLACKBERRY)
    18651885    actionHelpContents->setIcon(GET_ICON("help-contents"));
    18661886    actionHelpContextual->setIcon(GET_ICON("help-contextual"));
     
    18681888    actionHelpReportBug->setIcon(GET_ICON("tools-report-bug"));
    18691889    actionHelpAbout->setIcon(GET_ICON("help-about"));
     1890#ifdef Q_OS_BLACKBERRY
     1891    // Qt about dialog is too big for the screen
     1892    // and it's impossible to close it.
     1893    menuHelp->removeAction(actionHelpAboutQt);
     1894#else // Q_OS_BLACKBERRY
    18701895#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
    18711896    actionHelpAboutQt->setIcon(QIcon(":/trolltech/qmessagebox/images/qtlogo-64.png"));
    1872 #else
     1897#else // QT_VERSION < QT_VERSION_CHECK(5,0,0)
    18731898    actionHelpAboutQt->setIcon(QIcon(":/qt-project.org/qmessagebox/images/qtlogo-64.png"));
    18741899#endif // QT_VERSION < QT_VERSION_CHECK(5,0,0)
     1900#endif // Q_OS_BLACKBERRY
    18751901#endif // HANDHELD
    18761902    // Buttons
     
    19221948    solutionText->setWordWrapMode(QTextOption::WordWrap);
    19231949
    1924 #ifndef QT_NO_PRINTER
     1950#ifndef QT_NO_PRINTDIALOG
    19251951    actionFilePrintPreview = new QAction(this);
    19261952    actionFilePrintPreview->setObjectName("actionFilePrintPreview");
     
    19481974
    19491975    toolBarMain->insertAction(actionSettingsPreferences, actionFilePrint);
    1950 #endif // QT_NO_PRINTER
     1976#endif // QT_NO_PRINTDIALOG
    19511977
    19521978    groupSettingsLanguageList = new QActionGroup(this);
     
    20212047    actionFileSaveAsSolution->setEnabled(enable);
    20222048    solutionText->setEnabled(enable);
    2023 #ifndef QT_NO_PRINTER
     2049#ifndef QT_NO_PRINTDIALOG
    20242050    actionFilePrint->setEnabled(enable);
    20252051    actionFilePrintPreview->setEnabled(enable);
    2026 #endif // QT_NO_PRINTER
     2052#endif // QT_NO_PRINTDIALOG
    20272053}
    20282054
  • src/mainwindow.h

    r1241232377 r7ed8b57eea  
    7171    void actionFileSaveAsTaskTriggered();
    7272    void actionFileSaveAsSolutionTriggered();
    73 #ifndef QT_NO_PRINTER
     73#ifndef QT_NO_PRINTDIALOG
    7474    void actionFilePrintPreviewTriggered();
    7575    void actionFilePageSetupTriggered();
    7676    void actionFilePrintTriggered();
    77 #endif // QT_NO_PRINTER
     77#endif // QT_NO_PRINTDIALOG
    7878    void actionSettingsPreferencesTriggered();
    7979    void actionSettingsLanguageAutodetectTriggered(bool checked);
     
    118118#ifndef QT_NO_PRINTER
    119119    QPrinter *printer;
     120#ifndef QT_NO_PRINTDIALOG
    120121    QAction *actionFilePrintPreview;
    121122    QAction *actionFilePageSetup;
    122123    QAction *actionFilePrint;
     124#endif // QT_NO_PRINTDIALOG
    123125#endif // QT_NO_PRINTER
    124126    QAction *actionHelpCheck4Updates;
  • src/settingsdialog.cpp

    r1241232377 r7ed8b57eea  
    546546void SettingsDialog::buttonFontClicked()
    547547{
    548 bool ok;
    549 QFont font = QFontDialog::getFont(&ok, this->font, this);
    550     if (ok && (this->font != font)) {
    551         this->font = font;
    552         QFont f = font;
    553         f.setPointSize(labelFontExample->font().pointSize());
    554         labelFontExample->setFont(f);
    555         labelFontExample->setText(font.family());
    556         _fontChanged = true;
    557     }
     548    QFont newFont;
     549#ifdef Q_OS_BLACKBERRY
     550    QFontDialog fd(font, this);
     551    fd.setWindowState(Qt::WindowMaximized);
     552    if ((fd.exec() != QDialog::Accepted) || (fd.selectedFont() == font))
     553        return;
     554    newFont = fd.selectedFont();
     555#else
     556    bool ok;
     557    newFont = QFontDialog::getFont(&ok, font, this);
     558    if (!ok || (font == newFont))
     559        return;
     560#endif
     561    font = newFont;
     562    QFont f = font;
     563    f.setPointSize(labelFontExample->font().pointSize());
     564    labelFontExample->setFont(f);
     565    labelFontExample->setText(font.family());
     566    _fontChanged = true;
    558567}
    559568
  • tspsg.pri

    r1241232377 r7ed8b57eea  
    3232    src/qtwin.cpp
    3333
     34blackberry {
     35    HEADERS += src/bb10proxystyle.h
     36    SOURCES += src/bb10proxystyle.cpp
     37}
     38
    3439#Forms
    3540FORMS += ui/mainwindow.ui \
     
    4045    l10n/l10n.qrc
    4146
    42 handheld {
     47blackberry {
     48    RESOURCES += resources/desktop.qrc
     49} else:handheld {
    4350    RESOURCES += resources/handheld.qrc
    4451} else {
  • tspsg.pro

    r1241232377 r7ed8b57eea  
    2323wincewm*|symbian|maemo*|simulator|blackberry {
    2424    CONFIG += handheld
     25}
     26blackberry {
     27#    DEFINES += QT_NO_SHORTCUT
     28    DEFINES += QT_NO_PRINTDIALOG
     29    DEFINES += QT_NO_PRINTPREVIEWDIALOG
    2530}
    2631
Note: See TracChangeset for help on using the changeset viewer.