Changeset 33 in tspsg-svn for trunk/src


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.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/main.cpp

    r31 r33  
    2727{
    2828QApplication app(argc, argv);
     29        QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf8"));
     30        QTextCodec::setCodecForCStrings(QTextCodec::codecForName("utf8"));
     31        QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8"));
    2932        app.setOrganizationName("..::Lёppsville::..");
    3033        app.setOrganizationDomain("www.leppsville.com");
    3134        app.setApplicationName("TSPSG");
    32         QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8"));
    3335MainWindow mainwindow;
    3436        mainwindow.show();
  • 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.