Skip to content
Permalink
Browse files

mumble, plugins: allow 'manual' plugin dialogs to work OS X when usin…

…g Qt 5.
  • Loading branch information...
mkrautz committed Jun 28, 2013
1 parent e0b884e commit be75138d8bd294b297f1a1eab09fa77d6c91cec8
Showing with 17 additions and 10 deletions.
  1. +13 −7 plugins/manual/manual.cpp
  2. +2 −1 plugins/manual/manual.h
  3. +2 −2 src/mumble/Plugins.cpp
@@ -32,7 +32,7 @@

#include <QtCore/QtCore>
#include <QtGui/QtGui>
#if QT_VERSION >= 0x050000
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QtWidgets/QMessageBox>
#else
#include <QMessageBox>
@@ -247,17 +247,21 @@ static void unlock() {

static void config(HWND h) {
if (mDlg) {
#if defined(Q_OS_WIN) && QT_VERSION >= 0x050000
#if defined(Q_OS_WIN) && QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
mDlg->setParent(QWidget::find(reinterpret_cast<WId>(h)), Qt::Dialog);
#else
#elif defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
mDlg->setParent(QWidget::find(h), Qt::Dialog);
#else
mDlg->setParent(reinterpret_cast<QWidget *>(h), Qt::Dialog);
#endif
mDlg->qpbUnhinge->setEnabled(true);
} else {
#if defined(Q_OS_WIN) && QT_VERSION >= 0x050000
#if defined(Q_OS_WIN) && QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
mDlg = new Manual(QWidget::find(reinterpret_cast<WId>(h)));
#else
#elif defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
mDlg = new Manual(QWidget::find(h));
#else
mDlg = new Manual(reinterpret_cast<QWidget *>(h));
#endif
}

@@ -297,10 +301,12 @@ static std::wstring shortname(L"Manual placement");

static void about(HWND h) {
QMessageBox::about(
#if defined(Q_OS_WIN) && QT_VERSION >= 0x050000
#if defined(Q_OS_WIN) && QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QWidget::find(reinterpret_cast<WId>(h)),
#else
#elif defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QWidget::find(h),
#else
reinterpret_cast<QWidget *>(h),
#endif
QString::fromStdWString(description),
QString::fromStdWString(longdesc())
@@ -1,7 +1,8 @@
#ifndef MUMBLE_MANUAL_H_
#define MUMBLE_MANUAL_H_

#if QT_VERSION >= 0x050000
#include <QtCore/QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
# include <QtWidgets/QDialog>
# include <QtWidgets/QGraphicsItem>
# include <QtWidgets/QGraphicsScene>
@@ -142,7 +142,7 @@ void PluginConfig::on_qpbConfig_clicked() {
#ifdef Q_OS_WIN
pi->p->config(MumbleHWNDForQWidget(this));
#else
pi->p->config(winId());
pi->p->config(reinterpret_cast<HWND>(this));
#endif
} else {
QMessageBox::information(this, QLatin1String("Mumble"), tr("Plugin has no configure function."), QMessageBox::Ok, QMessageBox::NoButton);
@@ -163,7 +163,7 @@ void PluginConfig::on_qpbAbout_clicked() {
#ifdef Q_OS_WIN
pi->p->about(MumbleHWNDForQWidget(this));
#else
pi->p->about(winId());
pi->p->about(reinterpret_cast<HWND>(this));
#endif
} else {
QMessageBox::information(this, QLatin1String("Mumble"), tr("Plugin has no about function."), QMessageBox::Ok, QMessageBox::NoButton);

0 comments on commit be75138

Please sign in to comment.
You can’t perform that action at this time.