Changeset 2fb523720a in tspsg for src/mainwindow.cpp


Ignore:
Timestamp:
Aug 23, 2009, 1:26:42 AM (15 years ago)
Author:
Oleksii Serdiuk
Branches:
0.1.3.145-beta1-symbian, 0.1.4.170-beta2-bb10, appveyor, imgbot, master, readme
Children:
5a81a64d74
Parents:
281303f1f7
Message:

+ Created installation (INSTALLS and DEPLOYMENT) entries for *nix, windows and wince platforms in tspsg.pro file. Now qmake generates install rules in Makefile.
+ Automatic resize of columns after their content changes can be turned on/off in settings now.

  • Different search path for translations on different platforms.
  • Updated translations.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mainwindow.cpp

    r281303f1f7 r2fb523720a  
    9696        taskView->setModel(tspmodel);
    9797        connect(tspmodel,SIGNAL(numCitiesChanged(int)),this,SLOT(numCitiesChanged(int)));
    98         connect(tspmodel,SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),this,SLOT(dataChanged()));
     98        connect(tspmodel,SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),this,SLOT(dataChanged(const QModelIndex &, const QModelIndex &)));
    9999        connect(tspmodel,SIGNAL(layoutChanged()),this,SLOT(dataChanged()));
    100100        if ((QCoreApplication::arguments().count() > 1) && (tspmodel->loadTask(QCoreApplication::arguments().at(1))))
     
    148148                else
    149149                        // No luck. Let's try to load bundled one.
    150                         if (qtTranslator->load("qt_" + lang,"i18n"))
     150                        if (qtTranslator->load("qt_" + lang,PATH_I18N))
    151151                                qApp->installTranslator(qtTranslator);
    152152                        else {
     
    156156                        }
    157157                // Now let's load application translation.
    158                 if (translator->load(lang,"i18n"))
     158                if (translator->load(lang,PATH_I18N))
    159159                        qApp->installTranslator(translator);
    160160                else {
     
    191191int count = tspmodel->numCities();
    192192        tspmodel->setNumCities(n);
    193         if (n > count)
     193        if ((n > count) && settings->value("Autosize",true).toBool())
    194194                for (int k = count; k < n; k++) {
    195195                        taskView->resizeColumnToContents(k);
     
    217217        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
    218218        tspmodel->clear();
    219         taskView->resizeColumnsToContents();
    220         taskView->resizeRowsToContents();
    221219        setFileName();
    222220        setWindowModified(false);
     
    250248        }
    251249        setFileName(files.first());
    252         taskView->resizeColumnsToContents();
    253         taskView->resizeRowsToContents();
    254250        tabWidget->setCurrentIndex(0);
    255251        setWindowModified(false);
     
    411407        QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
    412408        tspmodel->randomize();
    413         setWindowModified(true);
    414         taskView->resizeColumnsToContents();
    415         taskView->resizeRowsToContents();
    416409        QApplication::restoreOverrideCursor();
    417410}
     
    521514void MainWindow::loadLangList()
    522515{
    523 QSettings langinfo("i18n/languages.ini",QSettings::IniFormat);
     516QSettings langinfo(PATH_I18N"/languages.ini",QSettings::IniFormat);
    524517#if QT_VERSION >= 0x040500
    525518        // In Qt < 4.5 QSettings doesn't have method setIniCodec.
    526519        langinfo.setIniCodec("UTF-8");
    527520#endif
    528 QDir dir("i18n","*.qm",QDir::Name | QDir::IgnoreCase,QDir::Files);
     521QDir dir(PATH_I18N,"*.qm",QDir::Name | QDir::IgnoreCase,QDir::Files);
    529522        if (!dir.exists())
    530523                return;
     
    606599}
    607600
     601void MainWindow::dataChanged(const QModelIndex &tl, const QModelIndex &br)
     602{
     603        setWindowModified(true);
     604        if (settings->value("Autosize",true).toBool()) {
     605                for (int k = tl.row(); k <= br.row(); k++)
     606                        taskView->resizeRowToContents(k);
     607                for (int k = tl.column(); k <= br.column(); k++)
     608                        taskView->resizeColumnToContents(k);
     609        }
     610}
     611
    608612void MainWindow::numCitiesChanged(int nCities)
    609613{
Note: See TracChangeset for help on using the changeset viewer.