1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Set default window size to be desktop size / 1.3

This commit is contained in:
David Rosca 2014-11-10 11:50:53 +01:00
parent 4320eb202f
commit 03c875b229

View File

@ -262,10 +262,14 @@ void BrowserWindow::setupUi()
int locationBarWidth; int locationBarWidth;
int websearchBarWidth; int websearchBarWidth;
QDesktopWidget* desktop = mApp->desktop();
int windowWidth = desktop->width() / 1.3;
int windowHeight = desktop->height() / 1.3;
Settings settings; Settings settings;
settings.beginGroup("Browser-View-Settings"); settings.beginGroup("Browser-View-Settings");
if (settings.value("WindowMaximised", false).toBool()) { if (settings.value("WindowMaximised", false).toBool()) {
resize(800, 550); resize(windowWidth, windowHeight);
setWindowState(Qt::WindowMaximized); setWindowState(Qt::WindowMaximized);
} }
else { else {
@ -277,10 +281,11 @@ void BrowserWindow::setupUi()
p.setX(p.x() + 30); p.setX(p.x() + 30);
p.setY(p.y() + 30); p.setY(p.y() + 30);
if (!mApp->desktop()->availableGeometry(mApp->getWindow()).contains(p)) { if (!desktop->availableGeometry(mApp->getWindow()).contains(p)) {
p.setX(mApp->desktop()->availableGeometry(mApp->getWindow()).x() + 30); p.setX(desktop->availableGeometry(mApp->getWindow()).x() + 30);
p.setY(mApp->desktop()->availableGeometry(mApp->getWindow()).y() + 30); p.setY(desktop->availableGeometry(mApp->getWindow()).y() + 30);
} }
setGeometry(QRect(p, mApp->getWindow()->size())); setGeometry(QRect(p, mApp->getWindow()->size()));
#else #else
resize(mApp->getWindow()->size()); resize(mApp->getWindow()->size());
@ -288,10 +293,10 @@ void BrowserWindow::setupUi()
} }
else if (!restoreGeometry(settings.value("WindowGeometry").toByteArray())) { else if (!restoreGeometry(settings.value("WindowGeometry").toByteArray())) {
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
setGeometry(QRect(mApp->desktop()->availableGeometry(mApp->getWindow()).x() + 30, setGeometry(QRect(desktop->availableGeometry(mApp->getWindow()).x() + 30,
mApp->desktop()->availableGeometry(mApp->getWindow()).y() + 30, 800, 550)); desktop->availableGeometry(mApp->getWindow()).y() + 30, windowWidth, windowHeight));
#else #else
resize(800, 550); resize(windowWidth, windowHeight);
#endif #endif
} }
} }