Changeset 31694c8b58 in tspsg for src/globals.cpp


Ignore:
Timestamp:
Sep 16, 2012, 10:40:01 PM (12 years ago)
Author:
Oleksii Serdiuk
Branches:
appveyor, imgbot, master, readme
Children:
1b0d08aa2e
Parents:
0784c85e46
git-author:
Oleksii Serdiuk <contacts@…> (09/16/12 22:40:01)
git-committer:
Oleksii Serdiuk <contacts@…> (09/16/12 22:41:39)
Message:

Fixed wrong placement of tspsg.ini on Windows Mobile.

Also, Main Window stopped showing maximized on Windows Mobile. Made a
workaround for this.

Closes #15 - Try to fix wrong placement of tspsg.ini.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/globals.cpp

    r0784c85e46 r31694c8b58  
    2424#include "globals.h"
    2525
     26#ifdef Q_OS_WINCE_WM
     27#   include <shellapi.h>
     28#endif
     29
     30QSettings *initSettings(QObject *parent)
     31{
     32#ifdef Q_OS_WINCE_WM
     33    /*!
     34     * \hack HACK: On Windows Mobile the way Qt tries to get path for saving
     35     *  settings doesn't always work. This workaround tries to fix it.
     36     */
     37    if (!QDesktopServices::storageLocation(QDesktopServices::DataLocation).isEmpty()) {
     38#endif // Q_OS_WINCE_WM
     39    return new QSettings(QSettings::IniFormat, QSettings::UserScope, "TSPSG", "tspsg", parent);
     40#ifdef Q_OS_WINCE_WM
     41    } else {
     42        wchar_t path[MAX_PATH];
     43        SHGetSpecialFolderPath(0, path, 0x001a, FALSE);
     44        QString fileName = QString::fromWCharArray(path);
     45        fileName.append("\\TSPSG\\tspsg.ini");
     46        return new QSettings(fileName, QSettings::IniFormat, parent);
     47    }
     48#endif // Q_OS_WINCE_WM
     49}
     50
    2651#ifndef HANDHELD
    2752void toggleStyle(QWidget *widget, bool enable)
Note: See TracChangeset for help on using the changeset viewer.