summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/component_p.cpp
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2012-12-06 15:47:26 +0100
committerKarsten Heimrich <karsten.heimrich@digia.com>2012-12-07 13:15:35 +0100
commit40b40e6274e4db14531461c455c88378d12d85f2 (patch)
tree71b74c31dd349aae200a857050747fdcc7397910 /src/libs/installer/component_p.cpp
parentfd4c75df63d65e5a97ebc71c8247713ace45ffc9 (diff)
Finally IFW compiles with Qt5 (use private headers)
Change-Id: I2604c77418e4a930bd0f76092db581fef1e45817 Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
Diffstat (limited to 'src/libs/installer/component_p.cpp')
-rw-r--r--src/libs/installer/component_p.cpp76
1 files changed, 53 insertions, 23 deletions
diff --git a/src/libs/installer/component_p.cpp b/src/libs/installer/component_p.cpp
index ba6800247..3879d72b6 100644
--- a/src/libs/installer/component_p.cpp
+++ b/src/libs/installer/component_p.cpp
@@ -37,11 +37,16 @@
#include "packagemanagercore.h"
#include <QApplication>
-#include <QtGui/QDesktopServices>
+#if QT_VERSION < 0x050000
+# include <QDesktopServices>
+#else
+# include <QStandardPaths>
+#endif
namespace QInstaller {
+
// -- ComponentPrivate
ComponentPrivate::ComponentPrivate(PackageManagerCore *core, Component *qq)
@@ -88,26 +93,6 @@ QScriptEngine *ComponentPrivate::scriptEngine()
// register QMessageBox::StandardButton enum in the script connection
registerMessageBox(m_scriptEngine);
- // register QDesktopServices in the script connection
- QScriptValue desktopServices = m_scriptEngine->newArray();
- setProperty(desktopServices, QLatin1String("DesktopLocation"), QDesktopServices::DesktopLocation);
- setProperty(desktopServices, QLatin1String("DocumentsLocation"), QDesktopServices::DocumentsLocation);
- setProperty(desktopServices, QLatin1String("FontsLocation"), QDesktopServices::FontsLocation);
- setProperty(desktopServices, QLatin1String("ApplicationsLocation"), QDesktopServices::ApplicationsLocation);
- setProperty(desktopServices, QLatin1String("MusicLocation"), QDesktopServices::MusicLocation);
- setProperty(desktopServices, QLatin1String("MoviesLocation"), QDesktopServices::MoviesLocation);
- setProperty(desktopServices, QLatin1String("PicturesLocation"), QDesktopServices::PicturesLocation);
- setProperty(desktopServices, QLatin1String("TempLocation"), QDesktopServices::TempLocation);
- setProperty(desktopServices, QLatin1String("HomeLocation"), QDesktopServices::HomeLocation);
- setProperty(desktopServices, QLatin1String("DataLocation"), QDesktopServices::DataLocation);
- setProperty(desktopServices, QLatin1String("CacheLocation"), QDesktopServices::CacheLocation);
-
- desktopServices.setProperty(QLatin1String("openUrl"), m_scriptEngine->newFunction(qDesktopServicesOpenUrl));
- desktopServices.setProperty(QLatin1String("displayName"),
- m_scriptEngine->newFunction(qDesktopServicesDisplayName));
- desktopServices.setProperty(QLatin1String("storageLocation"),
- m_scriptEngine->newFunction(qDesktopServicesStorageLocation));
-
// register ::WizardPage enum in the script connection
QScriptValue qinstaller = m_scriptEngine->newArray();
setProperty(qinstaller, QLatin1String("Introduction"), PackageManagerCore::Introduction);
@@ -138,11 +123,14 @@ QScriptEngine *ComponentPrivate::scriptEngine()
m_scriptEngine->globalObject().setProperty(QLatin1String("QInstaller"), qinstaller);
m_scriptEngine->globalObject().setProperty(QLatin1String("installer"), installerObject);
- m_scriptEngine->globalObject().setProperty(QLatin1String("QDesktopServices"), desktopServices);
+
+ // register QDesktopServices in the script connection
+ m_scriptEngine->globalObject().setProperty(QLatin1String("QDesktopServices"), getDesktopServices());
m_scriptEngine->globalObject().setProperty(QLatin1String("component"), m_scriptEngine->newQObject(q));
QScriptValue fileDialog = m_scriptEngine->newArray();
- fileDialog.setProperty(QLatin1String("getExistingDirectory"), m_scriptEngine->newFunction(qFileDialogGetExistingDirectory));
+ fileDialog.setProperty(QLatin1String("getExistingDirectory"),
+ m_scriptEngine->newFunction(qFileDialogGetExistingDirectory));
m_scriptEngine->globalObject().setProperty(QLatin1String("QFileDialog"), fileDialog);
return m_scriptEngine;
@@ -153,6 +141,48 @@ void ComponentPrivate::setProperty(QScriptValue &scriptValue, const QString &pro
scriptValue.setProperty(propertyName, m_scriptEngine->newVariant(value));
}
+// -- private
+
+QScriptValue ComponentPrivate::getDesktopServices()
+{
+ QScriptValue desktopServices = m_scriptEngine->newArray();
+#if QT_VERSION < 0x050000
+ setProperty(desktopServices, QLatin1String("DesktopLocation"), QDesktopServices::DesktopLocation);
+ setProperty(desktopServices, QLatin1String("DesktopLocation"), QDesktopServices::DesktopLocation);
+ setProperty(desktopServices, QLatin1String("DocumentsLocation"), QDesktopServices::DocumentsLocation);
+ setProperty(desktopServices, QLatin1String("FontsLocation"), QDesktopServices::FontsLocation);
+ setProperty(desktopServices, QLatin1String("ApplicationsLocation"), QDesktopServices::ApplicationsLocation);
+ setProperty(desktopServices, QLatin1String("MusicLocation"), QDesktopServices::MusicLocation);
+ setProperty(desktopServices, QLatin1String("MoviesLocation"), QDesktopServices::MoviesLocation);
+ setProperty(desktopServices, QLatin1String("PicturesLocation"), QDesktopServices::PicturesLocation);
+ setProperty(desktopServices, QLatin1String("TempLocation"), QDesktopServices::TempLocation);
+ setProperty(desktopServices, QLatin1String("HomeLocation"), QDesktopServices::HomeLocation);
+ setProperty(desktopServices, QLatin1String("DataLocation"), QDesktopServices::DataLocation);
+ setProperty(desktopServices, QLatin1String("CacheLocation"), QDesktopServices::CacheLocation);
+#else
+ setProperty(desktopServices, QLatin1String("DesktopLocation"), QStandardPaths::DesktopLocation);
+ setProperty(desktopServices, QLatin1String("DesktopLocation"), QStandardPaths::DesktopLocation);
+ setProperty(desktopServices, QLatin1String("DocumentsLocation"), QStandardPaths::DocumentsLocation);
+ setProperty(desktopServices, QLatin1String("FontsLocation"), QStandardPaths::FontsLocation);
+ setProperty(desktopServices, QLatin1String("ApplicationsLocation"), QStandardPaths::ApplicationsLocation);
+ setProperty(desktopServices, QLatin1String("MusicLocation"), QStandardPaths::MusicLocation);
+ setProperty(desktopServices, QLatin1String("MoviesLocation"), QStandardPaths::MoviesLocation);
+ setProperty(desktopServices, QLatin1String("PicturesLocation"), QStandardPaths::PicturesLocation);
+ setProperty(desktopServices, QLatin1String("TempLocation"), QStandardPaths::TempLocation);
+ setProperty(desktopServices, QLatin1String("HomeLocation"), QStandardPaths::HomeLocation);
+ setProperty(desktopServices, QLatin1String("DataLocation"), QStandardPaths::DataLocation);
+ setProperty(desktopServices, QLatin1String("CacheLocation"), QStandardPaths::CacheLocation);
+#endif
+
+ desktopServices.setProperty(QLatin1String("openUrl"),
+ m_scriptEngine->newFunction(qDesktopServicesOpenUrl));
+ desktopServices.setProperty(QLatin1String("displayName"),
+ m_scriptEngine->newFunction(qDesktopServicesDisplayName));
+ desktopServices.setProperty(QLatin1String("storageLocation"),
+ m_scriptEngine->newFunction(qDesktopServicesStorageLocation));
+ return desktopServices;
+}
+
// -- ComponentModelHelper