Merge pull request #62 from hunbernd/qt5-fix

Qt5 fix
This commit is contained in:
Thunder 2015-08-31 12:05:08 +02:00
commit de92c06f0b
16 changed files with 41 additions and 49 deletions

View File

@ -761,13 +761,13 @@ void AboutDialog::on_copy_button_clicked()
verInfo+=QSysInfo::prettyProductName(); verInfo+=QSysInfo::prettyProductName();
#endif #endif
#else #else
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
verInfo+="Linux"; verInfo+="Linux";
#endif #endif
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
verInfo+="Windows"; verInfo+="Windows";
#endif #endif
#ifdef Q_WS_MACX #ifdef Q_OS_MAC
verInfo+="Mac"; verInfo+="Mac";
#endif #endif
#endif #endif

View File

@ -189,7 +189,7 @@ void GetStartedDialog::tickFirewallChanged()
static void sendMail(const QString &address, const QString &subject, QString body) static void sendMail(const QString &address, const QString &subject, QString body)
{ {
/* Only under windows do we need to do this! */ /* Only under windows do we need to do this! */
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
/* search and replace the end of lines with: "%0D%0A" */ /* search and replace the end of lines with: "%0D%0A" */
body.replace("\n", "%0D%0A"); body.replace("\n", "%0D%0A");
#endif #endif
@ -343,7 +343,7 @@ void GetStartedDialog::emailSupport()
#ifdef __APPLE__ #ifdef __APPLE__
#ifdef Q_WS_MAC #ifdef Q_OS_MAC
switch(QSysInfo::MacintoshVersion) switch(QSysInfo::MacintoshVersion)
{ {
case QSysInfo::MV_9: case QSysInfo::MV_9:
@ -383,7 +383,7 @@ void GetStartedDialog::emailSupport()
#else #else
#if defined(_WIN32) || defined(__MINGW32__) #if defined(_WIN32) || defined(__MINGW32__)
// Windows // Windows
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
switch(QSysInfo::windowsVersion()) switch(QSysInfo::windowsVersion())
{ {
case QSysInfo::WV_32s: case QSysInfo::WV_32s:

View File

@ -169,10 +169,6 @@ NetworkDialog::NetworkDialog(QWidget *parent)
//updateNetworkStatus(); //updateNetworkStatus();
//loadtabsettings(); //loadtabsettings();
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
} }
void NetworkDialog::changeEvent(QEvent *e) void NetworkDialog::changeEvent(QEvent *e)

View File

@ -220,7 +220,7 @@ void PhotoDialog::setFullScreen()
if (!isFullScreen()) { if (!isFullScreen()) {
// hide menu & toolbars // hide menu & toolbars
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
show(); show();
raise(); raise();
setWindowState( windowState() | Qt::WindowFullScreen ); setWindowState( windowState() | Qt::WindowFullScreen );

View File

@ -299,7 +299,7 @@ void PhotoSlideShow::setFullScreen()
if (!isFullScreen()) { if (!isFullScreen()) {
// hide menu & toolbars // hide menu & toolbars
#ifdef Q_WS_X11 #ifdef Q_OS_LINUX
show(); show();
raise(); raise();
setWindowState( windowState() | Qt::WindowFullScreen ); setWindowState( windowState() | Qt::WindowFullScreen );

View File

@ -66,7 +66,7 @@ QuickStartWizard::QuickStartWizard(QWidget *parent) :
ui.shareddirList->horizontalHeader()->setStretchLastSection(false); ui.shareddirList->horizontalHeader()->setStretchLastSection(false);
/* Hide platform specific features */ /* Hide platform specific features */
#ifndef Q_WS_WIN #ifndef Q_OS_WIN
ui.checkBoxRunRetroshareAtSystemStartup->setVisible(false); ui.checkBoxRunRetroshareAtSystemStartup->setVisible(false);
ui.chkRunRetroshareAtSystemStartupMinimized->setVisible(false); ui.chkRunRetroshareAtSystemStartupMinimized->setVisible(false);
#endif #endif
@ -192,7 +192,7 @@ void QuickStartWizard::on_pushButtonSystemFinish_clicked()
{ {
Settings->setStartMinimized(ui.checkBoxStartMinimized->isChecked()); Settings->setStartMinimized(ui.checkBoxStartMinimized->isChecked());
Settings->setValue("doQuit", ui.checkBoxQuit->isChecked()); Settings->setValue("doQuit", ui.checkBoxQuit->isChecked());
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
Settings->setRunRetroshareOnBoot(ui.checkBoxRunRetroshareAtSystemStartup->isChecked(), ui.chkRunRetroshareAtSystemStartupMinimized->isChecked()); Settings->setRunRetroshareOnBoot(ui.checkBoxRunRetroshareAtSystemStartup->isChecked(), ui.chkRunRetroshareAtSystemStartupMinimized->isChecked());
#endif #endif
@ -381,7 +381,7 @@ bool QuickStartWizard::messageBoxOk(QString msg)
void void
QuickStartWizard::loadGeneral() QuickStartWizard::loadGeneral()
{ {
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
bool minimized; bool minimized;
ui.checkBoxRunRetroshareAtSystemStartup->setChecked(Settings->runRetroshareOnBoot(minimized)); ui.checkBoxRunRetroshareAtSystemStartup->setChecked(Settings->runRetroshareOnBoot(minimized));
ui.chkRunRetroshareAtSystemStartupMinimized->setChecked(minimized); ui.chkRunRetroshareAtSystemStartupMinimized->setChecked(minimized);

View File

@ -213,10 +213,6 @@ SearchDialog::SearchDialog(QWidget *parent)
checkText(ui.lineEdit->text()); checkText(ui.lineEdit->text());
/* Hide platform specific features */
#ifdef Q_WS_WIN
#endif
} }
SearchDialog::~SearchDialog() SearchDialog::~SearchDialog()

View File

@ -40,7 +40,7 @@ void Emoticons::load()
QString sm_codes; QString sm_codes;
bool internalEmoticons = true; bool internalEmoticons = true;
#if defined(Q_OS_WIN32) #if defined(Q_OS_WIN)
// first try external emoticons // first try external emoticons
QFile sm_file(QApplication::applicationDirPath() + "/emoticons/emotes.acs"); QFile sm_file(QApplication::applicationDirPath() + "/emoticons/emotes.acs");
if(sm_file.open(QIODevice::ReadOnly)) if(sm_file.open(QIODevice::ReadOnly))

View File

@ -518,7 +518,7 @@ void RSGraphWidget::paintTotals()
int x = SCALE_WIDTH*fact + FS, y = 0; int x = SCALE_WIDTH*fact + FS, y = 0;
int rowHeight = FS; int rowHeight = FS;
#if !defined(Q_WS_MAC) #if !defined(Q_OS_MAC)
/* On Mac, we don't need vertical spacing between the text rows. */ /* On Mac, we don't need vertical spacing between the text rows. */
rowHeight += 5; rowHeight += 5;
#endif #endif

View File

@ -77,7 +77,7 @@ ConnectFriendWizard::ConnectFriendWizard(QWidget *parent) :
mTitleFontWeight = 0; // Standard mTitleFontWeight = 0; // Standard
// this define comes from Qt example. I don't have mac, so it wasn't tested // this define comes from Qt example. I don't have mac, so it wasn't tested
#ifndef Q_WS_MAC #ifndef Q_OS_MAC
setWizardStyle(ModernStyle); setWizardStyle(ModernStyle);
#endif #endif
@ -568,7 +568,7 @@ void ConnectFriendWizard::initializePage(int id)
static void sendMail(QString sAddress, QString sSubject, QString sBody) static void sendMail(QString sAddress, QString sSubject, QString sBody)
{ {
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
/* search and replace the end of lines with: "%0D%0A" */ /* search and replace the end of lines with: "%0D%0A" */
sBody.replace("\n", "%0D%0A"); sBody.replace("\n", "%0D%0A");
#endif #endif

View File

@ -58,10 +58,10 @@ HelpBrowser::HelpBrowser(QWidget *parent)
{ {
/* Invoke Qt Designer generated QObject setup routine */ /* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this); ui.setupUi(this);
#if defined(Q_WS_MAC) #if defined(Q_OS_MAC)
ui.actionHome->setShortcut(QString("Shift+Ctrl+H")); ui.actionHome->setShortcut(QString("Shift+Ctrl+H"));
#endif #endif
#if !defined(Q_WS_WIN) #if !defined(Q_OS_WIN)
ui.actionClose->setShortcut(QString("Ctrl+W")); ui.actionClose->setShortcut(QString("Ctrl+W"));
#endif #endif

View File

@ -42,7 +42,7 @@ GeneralPage::GeneralPage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.runStartWizard_PB,SIGNAL(clicked()), this,SLOT(runStartWizard())) ; connect(ui.runStartWizard_PB,SIGNAL(clicked()), this,SLOT(runStartWizard())) ;
/* Hide platform specific features */ /* Hide platform specific features */
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
#ifdef QT_DEBUG #ifdef QT_DEBUG
ui.chkRunRetroshareAtSystemStartup->setEnabled(false); ui.chkRunRetroshareAtSystemStartup->setEnabled(false);
@ -79,7 +79,7 @@ bool GeneralPage::save(QString &/*errmsg*/)
Settings->setValue("doQuit", ui.checkQuit->isChecked()); Settings->setValue("doQuit", ui.checkQuit->isChecked());
Settings->setCloseToTray(ui.checkCloseToTray->isChecked()); Settings->setCloseToTray(ui.checkCloseToTray->isChecked());
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
#ifndef QT_DEBUG #ifndef QT_DEBUG
Settings->setRunRetroshareOnBoot(ui.chkRunRetroshareAtSystemStartup->isChecked(), ui.chkRunRetroshareAtSystemStartupMinimized->isChecked()); Settings->setRunRetroshareOnBoot(ui.chkRunRetroshareAtSystemStartup->isChecked(), ui.chkRunRetroshareAtSystemStartupMinimized->isChecked());
@ -117,7 +117,7 @@ bool GeneralPage::save(QString &/*errmsg*/)
/** Loads the settings for this page */ /** Loads the settings for this page */
void GeneralPage::load() void GeneralPage::load()
{ {
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
bool minimized; bool minimized;
ui.chkRunRetroshareAtSystemStartup->setChecked(Settings->runRetroshareOnBoot(minimized)); ui.chkRunRetroshareAtSystemStartup->setChecked(Settings->runRetroshareOnBoot(minimized));
ui.chkRunRetroshareAtSystemStartupMinimized->setChecked(minimized); ui.chkRunRetroshareAtSystemStartupMinimized->setChecked(minimized);

View File

@ -33,7 +33,7 @@
#include <retroshare/rsnotify.h> #include <retroshare/rsnotify.h>
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#if defined(Q_WS_WIN) #if defined(Q_OS_WIN)
#include <util/win32.h> #include <util/win32.h>
#endif #endif
@ -60,7 +60,7 @@
/* Default Retroshare Settings */ /* Default Retroshare Settings */
#define DEFAULT_OPACITY 100 #define DEFAULT_OPACITY 100
#if defined(Q_OS_WIN32) #if defined(Q_OS_WIN)
#define STARTUP_REG_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Run" #define STARTUP_REG_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Run"
#define RETROSHARE_REG_KEY "RetroShare" #define RETROSHARE_REG_KEY "RetroShare"
#endif #endif
@ -104,11 +104,11 @@ void RshareSettings::initSettings()
// use GTK as default style on ubuntu // use GTK as default style on ubuntu
setDefault(SETTING_STYLE, "GTK+"); setDefault(SETTING_STYLE, "GTK+");
#else #else
#if defined(Q_WS_MAC) #if defined(Q_OS_MAC)
setDefault(SETTING_STYLE, "macintosh (aqua)"); setDefault(SETTING_STYLE, "macintosh (aqua)");
#else #else
static QStringList styles = QStyleFactory::keys(); static QStringList styles = QStyleFactory::keys();
#if defined(Q_WS_WIN) #if defined(Q_OS_WIN)
if (styles.contains("windowsvista", Qt::CaseInsensitive)) if (styles.contains("windowsvista", Qt::CaseInsensitive))
setDefault(SETTING_STYLE, "windowsvista"); setDefault(SETTING_STYLE, "windowsvista");
else if (styles.contains("windowsxp", Qt::CaseInsensitive)) else if (styles.contains("windowsxp", Qt::CaseInsensitive))
@ -710,7 +710,7 @@ RshareSettings::runRetroshareOnBoot(bool &minimized)
{ {
minimized = false; minimized = false;
#if defined(Q_WS_WIN) #if defined(Q_OS_WIN)
QString value = win32_registry_get_key_value(STARTUP_REG_KEY, RETROSHARE_REG_KEY); QString value = win32_registry_get_key_value(STARTUP_REG_KEY, RETROSHARE_REG_KEY);
if (!value.isEmpty()) { if (!value.isEmpty()) {
@ -729,9 +729,9 @@ RshareSettings::runRetroshareOnBoot(bool &minimized)
void void
RshareSettings::setRunRetroshareOnBoot(bool run, bool minimized) RshareSettings::setRunRetroshareOnBoot(bool run, bool minimized)
{ {
#if defined(Q_WS_WIN) #if defined(Q_OS_WIN)
if (run) { if (run) {
QString value = "\"" + QDir::convertSeparators(QCoreApplication::applicationFilePath()) + "\""; QString value = "\"" + QDir::toNativeSeparators(QCoreApplication::applicationFilePath()) + "\"";
if (minimized) { if (minimized) {
value += " -m"; value += " -m";
@ -748,17 +748,17 @@ RshareSettings::setRunRetroshareOnBoot(bool run, bool minimized)
#endif #endif
} }
#if defined(Q_WS_WIN) #if defined(Q_OS_WIN)
static QString getAppPathForProtocol() static QString getAppPathForProtocol()
{ {
return "\"" + QDir::convertSeparators(QCoreApplication::applicationFilePath()) + "\" -r \"%1\""; return "\"" + QDir::toNativeSeparators(QCoreApplication::applicationFilePath()) + "\" -r \"%1\"";
} }
#endif #endif
/** Returns true if retroshare:// is registered as protocol */ /** Returns true if retroshare:// is registered as protocol */
bool RshareSettings::getRetroShareProtocol() bool RshareSettings::getRetroShareProtocol()
{ {
#if defined(Q_WS_WIN) #if defined(Q_OS_WIN)
/* Check key */ /* Check key */
QSettings retroshare("HKEY_CLASSES_ROOT\\retroshare", QSettings::NativeFormat); QSettings retroshare("HKEY_CLASSES_ROOT\\retroshare", QSettings::NativeFormat);
if (retroshare.contains("Default")) { if (retroshare.contains("Default")) {
@ -780,7 +780,7 @@ bool RshareSettings::getRetroShareProtocol()
/** Returns true if the user can set retroshare as protocol */ /** Returns true if the user can set retroshare as protocol */
bool RshareSettings::canSetRetroShareProtocol() bool RshareSettings::canSetRetroShareProtocol()
{ {
#if defined(Q_WS_WIN) #if defined(Q_OS_WIN)
QSettings retroshare("HKEY_CLASSES_ROOT\\retroshare", QSettings::NativeFormat); QSettings retroshare("HKEY_CLASSES_ROOT\\retroshare", QSettings::NativeFormat);
return retroshare.isWritable(); return retroshare.isWritable();
#else #else
@ -791,7 +791,7 @@ bool RshareSettings::canSetRetroShareProtocol()
/** Register retroshare:// as protocol */ /** Register retroshare:// as protocol */
bool RshareSettings::setRetroShareProtocol(bool value) bool RshareSettings::setRetroShareProtocol(bool value)
{ {
#if defined(Q_WS_WIN) #if defined(Q_OS_WIN)
if (value) { if (value) {
QSettings retroshare("HKEY_CLASSES_ROOT\\retroshare", QSettings::NativeFormat); QSettings retroshare("HKEY_CLASSES_ROOT\\retroshare", QSettings::NativeFormat);
retroshare.setValue("Default", "URL: RetroShare protocol"); retroshare.setValue("Default", "URL: RetroShare protocol");

View File

@ -57,7 +57,7 @@ BandwidthGraph::BandwidthGraph(QWidget *parent, Qt::WindowFlags flags)
{ {
/* Invoke Qt Designer generated QObject setup routine */ /* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this); ui.setupUi(this);
#if defined(Q_WS_WIN) #if defined(Q_OS_WIN)
setShortcut("Esc", SLOT(close())); setShortcut("Esc", SLOT(close()));
#else #else
setShortcut("Ctrl+W", SLOT(close())); setShortcut("Ctrl+W", SLOT(close()));
@ -78,13 +78,13 @@ BandwidthGraph::BandwidthGraph(QWidget *parent, Qt::WindowFlags flags)
loadSettings(); loadSettings();
/* Turn off opacity group on unsupported platforms */ /* Turn off opacity group on unsupported platforms */
#if defined(Q_WS_WIN) #if defined(Q_OS_WIN)
if(!(QSysInfo::WV_2000 <= QSysInfo::WindowsVersion && QSysInfo::WindowsVersion <= QSysInfo::WV_2003)) { if(!(QSysInfo::WV_2000 <= QSysInfo::WindowsVersion)) {
ui.frmOpacity->setVisible(false); ui.frmOpacity->setVisible(false);
} }
#endif #endif
#if defined(Q_WS_X11) #if defined(Q_OS_LINUX)
ui.frmOpacity->setVisible(false); ui.frmOpacity->setVisible(false);
#endif #endif
} }
@ -236,11 +236,11 @@ void BandwidthGraph::setOpacity(int value)
qreal newValue = value / 100.0; qreal newValue = value / 100.0;
/* Opacity only supported by Mac and Win32 */ /* Opacity only supported by Mac and Win32 */
#if defined(Q_WS_MAC) #if defined(Q_OS_MAC)
this->setWindowOpacity(newValue); this->setWindowOpacity(newValue);
ui.lblPercentOpacity->setText(QString::number(value)); ui.lblPercentOpacity->setText(QString::number(value));
#elif defined(Q_WS_WIN) #elif defined(Q_OS_WIN)
if(QSysInfo::WV_2000 <= QSysInfo::WindowsVersion && QSysInfo::WindowsVersion <= QSysInfo::WV_2003) { if(QSysInfo::WV_2000 <= QSysInfo::WindowsVersion) {
this->setWindowOpacity(newValue); this->setWindowOpacity(newValue);
ui.lblPercentOpacity->setText(QString::number(value)); ui.lblPercentOpacity->setText(QString::number(value));
} }

View File

@ -613,7 +613,7 @@ Rshare::dataDirectory()
QString QString
Rshare::defaultDataDirectory() Rshare::defaultDataDirectory()
{ {
#if defined(Q_OS_WIN32) #if defined(Q_OS_WIN)
return (win32_app_data_folder() + "\\RetroShare"); return (win32_app_data_folder() + "\\RetroShare");
#else #else
return (QDir::homePath() + "/.RetroShare"); return (QDir::homePath() + "/.RetroShare");

View File

@ -54,7 +54,7 @@
#include <QPageSetupDialog> #include <QPageSetupDialog>
#include <QStatusBar> #include <QStatusBar>
#ifdef Q_WS_MAC #ifdef Q_OS_MAC
const QString rsrcPath = ":/images/mac"; const QString rsrcPath = ":/images/mac";
#else #else
const QString rsrcPath = ":/images/win"; const QString rsrcPath = ":/images/win";