diff options
| author | 2008-10-06 09:01:39 +0000 | |
|---|---|---|
| committer | 2008-10-06 09:01:39 +0000 | |
| commit | e28605ac6addc6b71166374e548df20ac573a899 (patch) | |
| tree | da05df995844bac68f0bd3414fae4b318d006b12 /src | |
| parent | some work on the statusbar (far from being complete) (diff) | |
| download | KVIrc-e28605ac6addc6b71166374e548df20ac573a899.tar.gz KVIrc-e28605ac6addc6b71166374e548df20ac573a899.tar.bz2 KVIrc-e28605ac6addc6b71166374e548df20ac573a899.zip | |
hopefully fixed all the dual-screen setup dialog centering problems
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2660 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
| -rw-r--r-- | src/kvirc/ui/kvi_ctcppagedialog.cpp | 4 | ||||
| -rw-r--r-- | src/kvirc/ui/kvi_splash.cpp | 5 | ||||
| -rw-r--r-- | src/kvirc/ui/kvi_window.cpp | 6 | ||||
| -rw-r--r-- | src/modules/addon/managementdialog.cpp | 2 | ||||
| -rw-r--r-- | src/modules/dcc/dialogs.cpp | 4 | ||||
| -rw-r--r-- | src/modules/dialog/libkvidialog.cpp | 4 | ||||
| -rw-r--r-- | src/modules/objects/class_widget.cpp | 13 | ||||
| -rw-r--r-- | src/modules/options/container.cpp | 4 | ||||
| -rw-r--r-- | src/modules/reguser/wizard.cpp | 4 | ||||
| -rw-r--r-- | src/modules/tip/libkvitip.cpp | 6 | ||||
| -rw-r--r-- | src/modules/toolbareditor/toolbareditor.cpp | 2 |
11 files changed, 35 insertions, 19 deletions
diff --git a/src/kvirc/ui/kvi_ctcppagedialog.cpp b/src/kvirc/ui/kvi_ctcppagedialog.cpp index 29cb64f44..06a9f19fd 100644 --- a/src/kvirc/ui/kvi_ctcppagedialog.cpp +++ b/src/kvirc/ui/kvi_ctcppagedialog.cpp @@ -72,8 +72,8 @@ KviCtcpPageDialog::~KviCtcpPageDialog() void KviCtcpPageDialog::center() { - move((g_pApp->desktop()->width() - width()) >> 1, - (g_pApp->desktop()->height() - height()) >> 1); + QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen()); + move((rect.width() - width())/2,(rect.height() - height())/2); } void KviCtcpPageDialog::die() diff --git a/src/kvirc/ui/kvi_splash.cpp b/src/kvirc/ui/kvi_splash.cpp index 0a97418e4..872119a8f 100644 --- a/src/kvirc/ui/kvi_splash.cpp +++ b/src/kvirc/ui/kvi_splash.cpp @@ -127,8 +127,9 @@ KviSplashScreen::~KviSplashScreen() void KviSplashScreen::showEvent(QShowEvent * e) { -/* move((g_pApp->desktop()->width() - width())/2, - (g_pApp->desktop()->height() - height())/2);*/ + QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen()); + move((rect.width() - width())/2,(rect.height() - height())/2); + m_creationTime = QTime::currentTime(); } diff --git a/src/kvirc/ui/kvi_window.cpp b/src/kvirc/ui/kvi_window.cpp index b4bffd646..bdbe62677 100644 --- a/src/kvirc/ui/kvi_window.cpp +++ b/src/kvirc/ui/kvi_window.cpp @@ -1169,8 +1169,10 @@ bool KviWindow::isMaximized() return (mdiParent()->state() == KviMdiChild::Maximized); // Heh...how to check it ? // Empirical check - int wdth = (g_pApp->desktop()->width() * 75) / 100; - int hght = (g_pApp->desktop()->height() * 75) / 100; + QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen()); + + int wdth = (rect.width() * 75) / 100; + int hght = (rect.height() * 75) / 100; return ((x() <= 1)&&(y() <= 1)&&(width() >= wdth)&&(height() >= hght)); } diff --git a/src/modules/addon/managementdialog.cpp b/src/modules/addon/managementdialog.cpp index f327db256..0347e530a 100644 --- a/src/modules/addon/managementdialog.cpp +++ b/src/modules/addon/managementdialog.cpp @@ -316,7 +316,7 @@ void KviScriptManagementDialog::installScript() void KviScriptManagementDialog::showEvent(QShowEvent * e) { -// QRect r = parentWidget() ? parentWidget()->rect() : QApplication::desktop()->rect(); +// QRect r = parentWidget() ? parentWidget()->rect() : g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen()); // int x = (r.width() - width()) / 2; // int y = (r.height() - height()) / 2; // move(x,y); diff --git a/src/modules/dcc/dialogs.cpp b/src/modules/dcc/dialogs.cpp index e21cce930..db09d936c 100644 --- a/src/modules/dcc/dialogs.cpp +++ b/src/modules/dcc/dialogs.cpp @@ -116,8 +116,8 @@ void KviDccAcceptBox::closeEvent(QCloseEvent *e) void KviDccAcceptBox::showEvent(QShowEvent *e) { - move((g_pApp->desktop()->width() - width()) >> 1, - (g_pApp->desktop()->height() - height()) >> 1); + QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen()); + move((rect.width() - width())/2,(rect.height() - height())/2); QWidget::showEvent(e); } diff --git a/src/modules/dialog/libkvidialog.cpp b/src/modules/dialog/libkvidialog.cpp index dce826adf..e13689ae7 100644 --- a/src/modules/dialog/libkvidialog.cpp +++ b/src/modules/dialog/libkvidialog.cpp @@ -379,7 +379,9 @@ void KviKvsCallbackTextInput::done(int code) void KviKvsCallbackTextInput::showEvent(QShowEvent *e) { - move((g_pApp->desktop()->width() - width())/2,(g_pApp->desktop()->height() - height()) / 2); + QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen()); + move((rect.width() - width())/2,(rect.height() - height())/2); + QDialog::showEvent(e); } diff --git a/src/modules/objects/class_widget.cpp b/src/modules/objects/class_widget.cpp index f670ad538..2ba146bb0 100644 --- a/src/modules/objects/class_widget.cpp +++ b/src/modules/objects/class_widget.cpp @@ -1059,8 +1059,10 @@ bool KviKvsObject_widget::function_fontMetricsHeight(KviKvsObjectFunctionCall * bool KviKvsObject_widget::function_screenResolution(KviKvsObjectFunctionCall * c) { KviKvsArray * a = new KviKvsArray(); - a->set(0,new KviKvsVariant((kvs_int_t)g_pApp->desktop()->width())); - a->set(1,new KviKvsVariant((kvs_int_t)g_pApp->desktop()->height())); + QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen()); + + a->set(0,new KviKvsVariant((kvs_int_t)rect.width())); + a->set(1,new KviKvsVariant((kvs_int_t)rect.height())); c->returnValue()->setArray(a); return true; } @@ -1185,7 +1187,12 @@ bool KviKvsObject_widget::function_mapFromGlobal(KviKvsObjectFunctionCall *c) bool KviKvsObject_widget::function_centerToScreen(KviKvsObjectFunctionCall *c) { - if(widget()) widget()->move((g_pApp->desktop()->width() - widget()->width())/2,(g_pApp->desktop()->height() - widget()->height())/2); + if(widget()) + { + QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen()); + widget()->move((rect.width() - widget()->width())/2,(rect.height() - widget()->height())/2); + } + return true; } diff --git a/src/modules/options/container.cpp b/src/modules/options/container.cpp index 012f7bf25..731f5ff33 100644 --- a/src/modules/options/container.cpp +++ b/src/modules/options/container.cpp @@ -100,8 +100,8 @@ void KviOptionsWidgetContainer::showEvent(QShowEvent *e) { if(parent() == 0) { - move((g_pApp->desktop()->width() - width()) / 2, - (g_pApp->desktop()->height() - height()) / 2); + QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen()); + move((rect.width() - width())/2,(rect.height() - height())/2); } QWidget::showEvent(e); m_pCancel->setFocus(); diff --git a/src/modules/reguser/wizard.cpp b/src/modules/reguser/wizard.cpp index fd70a99a6..0eda4b26b 100644 --- a/src/modules/reguser/wizard.cpp +++ b/src/modules/reguser/wizard.cpp @@ -397,7 +397,9 @@ void KviRegistrationWizard::accept() void KviRegistrationWizard::showEvent(QShowEvent *e) { if(height() < 420)resize(width(),420); - move((g_pApp->desktop()->width() - width())/2,(g_pApp->desktop()->height() - height())/2); + + QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen()); + move((rect.width() - width())/2,(rect.height() - height())/2); KviTalWizard::showEvent(e); } diff --git a/src/modules/tip/libkvitip.cpp b/src/modules/tip/libkvitip.cpp index d23bf0774..4aea04fd3 100644 --- a/src/modules/tip/libkvitip.cpp +++ b/src/modules/tip/libkvitip.cpp @@ -221,8 +221,10 @@ void KviTipWindow::nextTip() void KviTipWindow::showEvent(QShowEvent *e) { resize(KVI_TIP_WINDOW_WIDTH,KVI_TIP_WINDOW_HEIGHT); - move((g_pApp->desktop()->width() - KVI_TIP_WINDOW_WIDTH) / 2, - (g_pApp->desktop()->height() - KVI_TIP_WINDOW_HEIGHT) / 2); + + QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen()); + move((rect.width() - KVI_TIP_WINDOW_WIDTH)/2,(rect.height() - KVI_TIP_WINDOW_HEIGHT)/2); + QWidget::showEvent(e); } diff --git a/src/modules/toolbareditor/toolbareditor.cpp b/src/modules/toolbareditor/toolbareditor.cpp index bf39042e2..02d6a8b8e 100644 --- a/src/modules/toolbareditor/toolbareditor.cpp +++ b/src/modules/toolbareditor/toolbareditor.cpp @@ -368,7 +368,7 @@ void KviCustomizeToolBarsDialog::currentToolBarChanged() void KviCustomizeToolBarsDialog::showEvent(QShowEvent * e) { // repaintContents(); -// QRect r = parentWidget() ? parentWidget()->rect() : QApplication::desktop()->rect(); +// QRect r = parentWidget() ? parentWidget()->rect() : QApplication::desktop() SCREEEN ->rect(); // int x = (r.width() - width()) / 2; // int y = (r.height() - height()) / 2; // move(x,y); |
