From c8b8518608ba7b73406d947c17617077d527fddb Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 16 Jul 2010 15:42:32 +0000 Subject: [PATCH] Windows compilation fixes --- src/qinisettings.h | 30 ++++++++++++++++++------------ src/src.pro | 24 ++++++++++++------------ 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/qinisettings.h b/src/qinisettings.h index fb052ae6f..ae7880afe 100644 --- a/src/qinisettings.h +++ b/src/qinisettings.h @@ -45,17 +45,22 @@ public: } + QIniSettings(const QString &fileName, Format format, QObject *parent = 0 ) : QSettings(fileName, format, parent) { + + } + #ifdef Q_WS_WIN - QVariant value(const QString & key, const QVariant &defaultValue = QVariant()) const { - QVariant ret = QSettings::value(key); + QVariant value(const QString & key, const QVariant &defaultValue = QVariant()) { + QString key_tmp(key); + QVariant ret = QSettings::value(key_tmp); if(format() == QSettings::NativeFormat) { if(ret.isNull()) { // Fallback on Windows, use \ in key instead of / - if(key.contains("/")) { - ret = QSettings::value(key.replace("/", "\\")); + if(key_tmp.contains("/")) { + ret = QSettings::value(key_tmp.replace("/", "\\")); } else { - if(key.contains("\\")) { - ret = QSettings::value(key.replace("\\", "/")); + if(key_tmp.contains("\\")) { + ret = QSettings::value(key_tmp.replace("\\", "/")); } } } @@ -63,10 +68,10 @@ public: // Keep compatibility with qBittorrent < 2.3.0 // Import the setting from the registry QSettings old_settings(organizationName(), applicationName()); - ret = old_settings.value(key); - if(!ret.isEmpty()) { - setValue(key, ret); - old_settings.remove(key); + ret = old_settings.value(key_tmp); + if(!ret.isNull()) { + setValue(key_tmp, ret); + old_settings.remove(key_tmp); } } if(ret.isNull()) @@ -75,9 +80,10 @@ public: } void setValue(const QString &key, const QVariant &val) { + QString key_tmp(key); if(format() == QSettings::NativeFormat) - key = key.replace("/", "\\"); - QSettings::setValue(key, val); + key_tmp = key_tmp.replace("/", "\\"); + QSettings::setValue(key_tmp, val); } #endif }; diff --git a/src/src.pro b/src/src.pro index e7cfa0a1c..10f42b8e1 100644 --- a/src/src.pro +++ b/src/src.pro @@ -3,7 +3,7 @@ LANG_PATH = lang ICONS_PATH = Icons # Set the following variable to 1 to enable debug -DEBUG_MODE = 0 +DEBUG_MODE = 1 # Global TEMPLATE = app @@ -22,9 +22,9 @@ DEFINES += VERSION_BUGFIX=0 win32 { # Adapt these paths on Windows - INCLUDEPATH += $$quote(C:/qbittorrent/msvc/boost_1_42_0) - INCLUDEPATH += $$quote(C:/qbittorrent/msvc/libtorrent-rasterbar-0.14.10/include) - INCLUDEPATH += $$quote(C:/qbittorrent/msvc/libtorrent-rasterbar-0.14.10/zlib) + INCLUDEPATH += $$quote(C:/qbittorrent/boost_1_42_0) + INCLUDEPATH += $$quote(C:/qbittorrent/libtorrent-rasterbar-0.14.10/include) + INCLUDEPATH += $$quote(C:/qbittorrent/libtorrent-rasterbar-0.14.10/zlib) LIBS += -LC:/OpenSSL/lib/VC @@ -174,16 +174,16 @@ win32 { # Adapt these paths on Windows contains(DEBUG_MODE, 1) { - LIBS += C:/qbittorrent/msvc/libs/libtorrentd.lib \ - C:/qbittorrent/msvc/libs/libboost_system-vc90-mt-gd.lib \ - C:/qbittorrent/msvc/libs/libboost_filesystem-vc90-mt-gd.lib \ - C:/qbittorrent/msvc/libs/libboost_thread-vc90-mt-gd.lib + LIBS += C:/qbittorrent/libs/libtorrentd.lib \ + C:/qbittorrent/libs/libboost_system-vc90-mt-gd.lib \ + C:/qbittorrent/libs/libboost_filesystem-vc90-mt-gd.lib \ + C:/qbittorrent/libs/libboost_thread-vc90-mt-gd.lib } contains(DEBUG_MODE, 0) { - LIBS += C:/qbittorrent/msvc/libs/libtorrent.lib \ - C:/qbittorrent/msvc/libs/libboost_system-vc90-mt.lib \ - C:/qbittorrent/msvc/libs/libboost_filesystem-vc90-mt.lib \ - C:/qbittorrent/msvc/libs/libboost_thread-vc90-mt.lib + LIBS += C:/qbittorrent/libs/libtorrent.lib \ + C:/qbittorrent/libs/libboost_system-vc90-mt.lib \ + C:/qbittorrent/libs/libboost_filesystem-vc90-mt.lib \ + C:/qbittorrent/libs/libboost_thread-vc90-mt.lib } LIBS += advapi32.lib shell32.lib