Changeset 33 in tspsg-svn for trunk/src/mainwindow.cpp


Ignore:
Timestamp:
Jun 30, 2009, 7:14:52 PM (15 years ago)
Author:
laleppa
Message:

Code tweaks to compile without errors using Qt < 4.5.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mainwindow.cpp

    r31 r33  
    196196{
    197197QPrintDialog pd(printer,this);
     198#if QT_VERSION >= 0x040500
     199        // No such methods in Qt < 4.5
    198200        pd.setOption(QAbstractPrintDialog::PrintSelection,false);
    199201        pd.setOption(QAbstractPrintDialog::PrintPageRange,false);
     202#endif
    200203        pd.exec();
    201204}
     
    253256{
    254257QSettings langinfo("i18n/languages.ini",QSettings::IniFormat);
     258#if QT_VERSION >= 0x040500
     259        // In Qt < 4.5 QSettings doesn't have method setIniCodec.
    255260        langinfo.setIniCodec("UTF-8");
     261#endif
    256262QDir dir("i18n","*.qm",QDir::Name | QDir::IgnoreCase,QDir::Files);
    257263        if (!dir.exists())
     
    264270                QFileInfo lang = langs.at(k);
    265271                if (!lang.completeBaseName().startsWith("qt_") && lang.completeBaseName().compare("en")) {
     272#if QT_VERSION >= 0x040500
    266273                        a = menuSettingsLanguage->addAction(langinfo.value(lang.completeBaseName() + "/NativeName",lang.completeBaseName()).toString());
     274#else
     275                        // We use Name if Qt < 4.5 because NativeName is in UTF-8, QSettings
     276                        // reads .ini file as ASCII and there is no way to set file encoding.
     277                        a = menuSettingsLanguage->addAction(langinfo.value(lang.completeBaseName() + "/Name",lang.completeBaseName()).toString());
     278#endif
    267279                        a->setData(lang.completeBaseName());
    268280                        a->setCheckable(true);
Note: See TracChangeset for help on using the changeset viewer.