The Q_WS_{WIN,MAC} macros have been deprecated since Qt 4.3 or so,
and replaces by the corresponding Q_OS_* macros. Since Qt5 does not
support them anymore at all, let's globally change those to the "new"
version.
Also change Q_OS_WIN32 to just Q_OS_WIN; while the former is supposed to
be defined on all supported Windows platforms including Win64, it's still
a bit confusing.
16 files changed:
# include <unistd.h>
#endif
# include <unistd.h>
#endif
# include <windows.h>
# include <Winbase.h>
# define SECURITY_WIN32
# include <windows.h>
# include <Winbase.h>
# define SECURITY_WIN32
#ifdef UNICODE
QString tcharToQString(TCHAR *tchar)
{
#ifdef UNICODE
QString tcharToQString(TCHAR *tchar)
{
if (!userName.isEmpty())
nick = userName;
if (!userName.isEmpty())
nick = userName;
-#elif defined(Q_OS_WIN32)
TCHAR infoBuf[128];
DWORD bufCharCount = 128;
//if(GetUserNameEx(/* NameSamCompatible */ 1, infoBuf, &bufCharCount))
TCHAR infoBuf[128];
DWORD bufCharCount = 128;
//if(GetUserNameEx(/* NameSamCompatible */ 1, infoBuf, &bufCharCount))
else
return generalDefault;
else
return generalDefault;
-#elif defined(Q_OS_WIN32)
TCHAR infoBuf[128];
DWORD bufCharCount = 128;
if (GetUserName(infoBuf, &bufCharCount))
TCHAR infoBuf[128];
DWORD bufCharCount = 128;
if (GetUserName(infoBuf, &bufCharCount))
#include <iostream>
#include <signal.h>
#include <iostream>
#include <signal.h>
-#if !defined Q_OS_WIN32 && !defined Q_OS_MAC
+#if !defined Q_OS_WIN && !defined Q_OS_MAC
# include <sys/types.h>
# include <sys/time.h>
# include <sys/resource.h>
# include <sys/types.h>
# include <sys/time.h>
# include <sys/resource.h>
if (_handleCrashes) {
// we have crashhandler for win32 and unix (based on execinfo).
if (_handleCrashes) {
// we have crashhandler for win32 and unix (based on execinfo).
-#if defined(Q_OS_WIN32) || defined(HAVE_EXECINFO)
-# ifndef Q_OS_WIN32
+#if defined(Q_OS_WIN) || defined(HAVE_EXECINFO)
+# ifndef Q_OS_WIN
// we only handle crashes ourselves if coredumps are disabled
struct rlimit *limit = (rlimit *)malloc(sizeof(struct rlimit));
int rc = getrlimit(RLIMIT_CORE, limit);
if (rc == -1 || !((long)limit->rlim_cur > 0 || limit->rlim_cur == RLIM_INFINITY)) {
// we only handle crashes ourselves if coredumps are disabled
struct rlimit *limit = (rlimit *)malloc(sizeof(struct rlimit));
int rc = getrlimit(RLIMIT_CORE, limit);
if (rc == -1 || !((long)limit->rlim_cur > 0 || limit->rlim_cur == RLIM_INFINITY)) {
-# endif /* Q_OS_WIN32 */
signal(SIGABRT, handleSignal);
signal(SIGSEGV, handleSignal);
signal(SIGABRT, handleSignal);
signal(SIGSEGV, handleSignal);
signal(SIGBUS, handleSignal);
}
free(limit);
signal(SIGBUS, handleSignal);
}
free(limit);
-# endif /* Q_OS_WIN32 */
-#endif /* Q_OS_WIN32 || HAVE_EXECINFO */
+# endif /* Q_OS_WIN */
+#endif /* Q_OS_WIN || HAVE_EXECINFO */
break;
case SIGABRT:
case SIGSEGV:
break;
case SIGABRT:
case SIGSEGV:
case SIGBUS:
#endif
logBacktrace(coreDumpFileName());
case SIGBUS:
#endif
logBacktrace(coreDumpFileName());
_configDirPath = Quassel::optionValue("configdir");
}
else {
_configDirPath = Quassel::optionValue("configdir");
}
else {
// On Mac, the path is always the same
_configDirPath = QDir::homePath() + "/Library/Application Support/Quassel/";
#else
// We abuse QSettings to find us a sensible path on the other platforms
// On Mac, the path is always the same
_configDirPath = QDir::homePath() + "/Library/Application Support/Quassel/";
#else
// We abuse QSettings to find us a sensible path on the other platforms
// don't use the registry
QSettings::Format format = QSettings::IniFormat;
# else
// don't use the registry
QSettings::Format format = QSettings::IniFormat;
# else
QSettings s(format, QSettings::UserScope, QCoreApplication::organizationDomain(), buildInfo().applicationName);
QFileInfo fileInfo(s.fileName());
_configDirPath = fileInfo.dir().absolutePath();
QSettings s(format, QSettings::UserScope, QCoreApplication::organizationDomain(), buildInfo().applicationName);
QFileInfo fileInfo(s.fileName());
_configDirPath = fileInfo.dir().absolutePath();
}
if (!_configDirPath.endsWith(QDir::separator()) && !_configDirPath.endsWith('/'))
}
if (!_configDirPath.endsWith(QDir::separator()) && !_configDirPath.endsWith('/'))
}
else {
// Provide a fallback
}
else {
// Provide a fallback
dataDirNames << qgetenv("APPDATA") + QCoreApplication::organizationDomain() + "/share/apps/quassel/"
<< qgetenv("APPDATA") + QCoreApplication::organizationDomain()
<< QCoreApplication::applicationDirPath();
}
dataDirNames << qgetenv("APPDATA") + QCoreApplication::organizationDomain() + "/share/apps/quassel/"
<< qgetenv("APPDATA") + QCoreApplication::organizationDomain()
<< QCoreApplication::applicationDirPath();
}
dataDirNames << QDir::homePath() + "/Library/Application Support/Quassel/"
<< QCoreApplication::applicationDirPath();
}
dataDirNames << QDir::homePath() + "/Library/Application Support/Quassel/"
<< QCoreApplication::applicationDirPath();
}
QHash<QString, QVariant> Settings::settingsCache;
QHash<QString, SettingsChangeNotifier *> Settings::settingsChangeNotifier;
QHash<QString, QVariant> Settings::settingsCache;
QHash<QString, SettingsChangeNotifier *> Settings::settingsChangeNotifier;
# define create_qsettings QSettings s(QCoreApplication::organizationDomain(), appName)
#else
# define create_qsettings QSettings s(fileName(), format())
# define create_qsettings QSettings s(QCoreApplication::organizationDomain(), appName)
#else
# define create_qsettings QSettings s(fileName(), format())
private:
inline QSettings::Format format()
{
private:
inline QSettings::Format format()
{
return QSettings::IniFormat;
#else
return QSettings::NativeFormat;
return QSettings::IniFormat;
#else
return QSettings::NativeFormat;
// migration related
#include <QFile>
// migration related
#include <QFile>
# include <windows.h>
#else
# include <unistd.h>
# include <termios.h>
# include <windows.h>
#else
# include <unistd.h>
# include <termios.h>
#ifdef HAVE_UMASK
# include <sys/types.h>
#ifdef HAVE_UMASK
# include <sys/types.h>
// FIXME: MIGRATION 0.3 -> 0.4: Move database and core config to new location
// Move settings, note this does not delete the old files
// FIXME: MIGRATION 0.3 -> 0.4: Move database and core config to new location
// Move settings, note this does not delete the old files
QSettings newSettings("quassel-irc.org", "quasselcore");
#else
QSettings newSettings("quassel-irc.org", "quasselcore");
#else
QSettings::Format format = QSettings::IniFormat;
# else
QSettings::Format format = QSettings::NativeFormat;
QSettings::Format format = QSettings::IniFormat;
# else
QSettings::Format format = QSettings::NativeFormat;
QString newFilePath = Quassel::configDirPath() + "quasselcore"
+ ((format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini"));
QSettings newSettings(newFilePath, format);
QString newFilePath = Quassel::configDirPath() + "quasselcore"
+ ((format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini"));
QSettings newSettings(newFilePath, format);
if (newSettings.value("Config/Version").toUInt() == 0) {
if (newSettings.value("Config/Version").toUInt() == 0) {
QString org = "quassel-irc.org";
# else
QString org = "Quassel Project";
QString org = "quassel-irc.org";
# else
QString org = "Quassel Project";
newSettings.setValue("Config/Version", 1);
qWarning() << "* Your core settings have been migrated to" << newSettings.fileName();
newSettings.setValue("Config/Version", 1);
qWarning() << "* Your core settings have been migrated to" << newSettings.fileName();
-#ifndef Q_WS_MAC /* we don't need to move the db and cert for mac */
-#ifdef Q_OS_WIN32
+#ifndef Q_OS_MAC /* we don't need to move the db and cert for mac */
+#ifdef Q_OS_WIN
QString quasselDir = qgetenv("APPDATA") + "/quassel/";
QString quasselDir = qgetenv("APPDATA") + "/quassel/";
QString quasselDir = QDir::homePath() + "/Library/Application Support/Quassel/";
#else
QString quasselDir = QDir::homePath() + "/.quassel/";
QString quasselDir = QDir::homePath() + "/Library/Application Support/Quassel/";
#else
QString quasselDir = QDir::homePath() + "/.quassel/";
else
qWarning() << "!!! Moving your certificate has failed. Please move it manually into" << Quassel::configDirPath();
}
else
qWarning() << "!!! Moving your certificate has failed. Please move it manually into" << Quassel::configDirPath();
}
qWarning() << "*** Migration completed.\n\n";
}
}
qWarning() << "*** Migration completed.\n\n";
}
}
void Core::stdInEcho(bool on)
{
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
void Core::stdInEcho(bool on)
{
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
setStartId(IntroPage);
//setStartId(StorageSelectionPage);
setStartId(IntroPage);
//setStartId(StorageSelectionPage);
setWizardStyle(ModernStyle);
#endif
setWizardStyle(ModernStyle);
#endif
disconnect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
_trayIcon, SLOT(activateOrHide(QSystemTrayIcon::ActivationReason)));
#endif
disconnect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
_trayIcon, SLOT(activateOrHide(QSystemTrayIcon::ActivationReason)));
#endif
connect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
SLOT(on_activated(QSystemTrayIcon::ActivationReason)));
#endif
connect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
SLOT(on_activated(QSystemTrayIcon::ActivationReason)));
#endif
{
_trayIcon->setIcon(stateIcon());
{
_trayIcon->setIcon(stateIcon());
-#if defined Q_WS_MAC || defined Q_WS_WIN
+#if defined Q_OS_MAC || defined Q_OS_WIN
QString tooltip = QString("%1").arg(toolTipTitle());
if (!toolTipSubTitle().isEmpty())
tooltip += QString("\n%1").arg(toolTipSubTitle());
QString tooltip = QString("%1").arg(toolTipTitle());
if (!toolTipSubTitle().isEmpty())
tooltip += QString("\n%1").arg(toolTipSubTitle());
void MainWin::updateIcon()
{
void MainWin::updateIcon()
{
const int size = 128;
#else
const int size = 48;
const int size = 128;
#else
const int size = 48;
configureShortcutsAct->setMenuRole(QAction::NoRole);
coll->addAction("ConfigureShortcuts", configureShortcutsAct);
configureShortcutsAct->setMenuRole(QAction::NoRole);
coll->addAction("ConfigureShortcuts", configureShortcutsAct);
QAction *configureQuasselAct = new Action(SmallIcon("configure"), tr("&Configure Quassel..."), coll,
this, SLOT(showSettingsDlg()));
configureQuasselAct->setMenuRole(QAction::PreferencesRole);
QAction *configureQuasselAct = new Action(SmallIcon("configure"), tr("&Configure Quassel..."), coll,
this, SLOT(showSettingsDlg()));
configureQuasselAct->setMenuRole(QAction::PreferencesRole);
this, SLOT(on_jumpHotBuffer_triggered()), QKeySequence(Qt::META + Qt::Key_A)));
// Jump keys
this, SLOT(on_jumpHotBuffer_triggered()), QKeySequence(Qt::META + Qt::Key_A)));
// Jump keys
const int bindModifier = Qt::ControlModifier | Qt::AltModifier;
const int jumpModifier = Qt::ControlModifier;
#else
const int bindModifier = Qt::ControlModifier | Qt::AltModifier;
const int jumpModifier = Qt::ControlModifier;
#else
connect(_nickListWidget, SIGNAL(nickSelectionChanged(QModelIndexList)),
QtUi::toolBarActionProvider(), SLOT(nickSelectionChanged(QModelIndexList)));
connect(_nickListWidget, SIGNAL(nickSelectionChanged(QModelIndexList)),
QtUi::toolBarActionProvider(), SLOT(nickSelectionChanged(QModelIndexList)));
setUnifiedTitleAndToolBarOnMac(true);
#endif
setUnifiedTitleAndToolBarOnMac(true);
#endif
QtUi::toolBarActionProvider()->addActions(_mainToolBar, ToolBarActionProvider::MainToolBar);
_toolbarMenu->addAction(_mainToolBar->toggleViewAction());
QtUi::toolBarActionProvider()->addActions(_mainToolBar, ToolBarActionProvider::MainToolBar);
_toolbarMenu->addAction(_mainToolBar->toggleViewAction());
QtUiSettings uiSettings;
bool visible = uiSettings.value("ShowMainToolBar", QVariant(true)).toBool();
QtUiSettings uiSettings;
bool visible = uiSettings.value("ShowMainToolBar", QVariant(true)).toBool();
void MainWin::saveMainToolBarStatus(bool enabled)
{
QtUiSettings uiSettings;
void MainWin::saveMainToolBarStatus(bool enabled)
{
QtUiSettings uiSettings;
void saveMenuBarStatus(bool enabled);
void saveStatusBarStatus(bool enabled);
void saveMenuBarStatus(bool enabled);
void saveStatusBarStatus(bool enabled);
void saveMainToolBarStatus(bool enabled);
#endif
void saveMainToolBarStatus(bool enabled);
#endif
if (Quassel::init()) {
// FIXME: MIGRATION 0.3 -> 0.4: Move database and core config to new location
// Move settings, note this does not delete the old files
if (Quassel::init()) {
// FIXME: MIGRATION 0.3 -> 0.4: Move database and core config to new location
// Move settings, note this does not delete the old files
QSettings newSettings("quassel-irc.org", "quasselclient");
#else
QSettings newSettings("quassel-irc.org", "quasselclient");
#else
QSettings::Format format = QSettings::IniFormat;
# else
QSettings::Format format = QSettings::NativeFormat;
QSettings::Format format = QSettings::IniFormat;
# else
QSettings::Format format = QSettings::NativeFormat;
QString newFilePath = Quassel::configDirPath() + "quasselclient"
+ ((format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini"));
QSettings newSettings(newFilePath, format);
QString newFilePath = Quassel::configDirPath() + "quasselclient"
+ ((format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini"));
QSettings newSettings(newFilePath, format);
if (newSettings.value("Config/Version").toUInt() == 0) {
if (newSettings.value("Config/Version").toUInt() == 0) {
QString org = "quassel-irc.org";
# else
QString org = "Quassel Project";
QString org = "quassel-irc.org";
# else
QString org = "Quassel Project";
ui.minimizeOnClose->hide();
#endif
#ifdef QT_NO_SYSTEMTRAYICON
ui.minimizeOnClose->hide();
#endif
#ifdef QT_NO_SYSTEMTRAYICON
#include <QToolButton>
// This defines the unicode symbols for special keys (kCommandUnicode and friends)
#include <QToolButton>
// This defines the unicode symbols for special keys (kCommandUnicode and friends)
# include <Carbon/Carbon.h>
#endif
# include <Carbon/Carbon.h>
#endif
if (_isRecording) {
if (_modifierKeys) {
if (_isRecording) {
if (_modifierKeys) {
if (_modifierKeys & Qt::META) s += QChar(kControlUnicode);
if (_modifierKeys & Qt::ALT) s += QChar(kOptionUnicode);
if (_modifierKeys & Qt::SHIFT) s += QChar(kShiftUnicode);
if (_modifierKeys & Qt::META) s += QChar(kControlUnicode);
if (_modifierKeys & Qt::ALT) s += QChar(kOptionUnicode);
if (_modifierKeys & Qt::SHIFT) s += QChar(kShiftUnicode);
TaskbarNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : SettingsPage("Internal", "TaskbarNotification", parent)
{
QHBoxLayout *layout = new QHBoxLayout(this);
TaskbarNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent) : SettingsPage("Internal", "TaskbarNotification", parent)
{
QHBoxLayout *layout = new QHBoxLayout(this);
layout->addWidget(enabledBox = new QCheckBox(tr("Activate dock entry, timeout:"), this));
#else
layout->addWidget(enabledBox = new QCheckBox(tr("Mark taskbar entry, timeout:"), this));
layout->addWidget(enabledBox = new QCheckBox(tr("Activate dock entry, timeout:"), this));
#else
layout->addWidget(enabledBox = new QCheckBox(tr("Mark taskbar entry, timeout:"), this));
Q_ASSERT(!_instance);
_instance = this;
Q_ASSERT(!_instance);
_instance = this;
_dwTickCount = 0;
#endif
}
_dwTickCount = 0;
#endif
}
void GraphicalUi::init()
{
void GraphicalUi::init()
{
mainWidget()->installEventFilter(this);
#endif
}
mainWidget()->installEventFilter(this);
#endif
}
bool GraphicalUi::eventFilter(QObject *obj, QEvent *event)
{
bool GraphicalUi::eventFilter(QObject *obj, QEvent *event)
{
if (obj == mainWidget() && event->type() == QEvent::ActivationChange) {
_dwTickCount = GetTickCount();
}
if (obj == mainWidget() && event->type() == QEvent::ActivationChange) {
_dwTickCount = GetTickCount();
}
bool GraphicalUi::checkMainWidgetVisibility(bool perform)
{
bool GraphicalUi::checkMainWidgetVisibility(bool perform)
{
// the problem is that we lose focus when the systray icon is activated
// and we don't know the former active window
// therefore we watch for activation event and use our stopwatch :)
// the problem is that we lose focus when the systray icon is activated
// and we don't know the former active window
// therefore we watch for activation event and use our stopwatch :)
class ToolBarActionProvider;
class UiStyle;
class ToolBarActionProvider;
class UiStyle;
# include <windows.h>
#endif
# include <windows.h>
#endif
static UiStyle *_uiStyle;
static bool _onAllDesktops;
static UiStyle *_uiStyle;
static bool _onAllDesktops;
DWORD _dwTickCount;
#endif
};
DWORD _dwTickCount;
#endif
};
if (event == QKeySequence::InsertLineSeparator) {
#else
if (event == QKeySequence::InsertLineSeparator) {
#else
if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && event->modifiers() & Qt::META) {
# else
if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && event->modifiers() & Qt::SHIFT) {
if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && event->modifiers() & Qt::META) {
# else
if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && event->modifiers() & Qt::SHIFT) {
msg += "...</p>";
QMessageBox question(QMessageBox::NoIcon, tr("Paste Protection"), msg, QMessageBox::Yes|QMessageBox::No);
question.setDefaultButton(QMessageBox::No);
msg += "...</p>";
QMessageBox question(QMessageBox::NoIcon, tr("Paste Protection"), msg, QMessageBox::Yes|QMessageBox::No);
question.setDefaultButton(QMessageBox::No);
question.setWindowFlags(question.windowFlags() | Qt::Sheet);
#endif
if (question.exec() != QMessageBox::Yes)
question.setWindowFlags(question.windowFlags() | Qt::Sheet);
#endif
if (question.exec() != QMessageBox::Yes)