From e73f8040feb9c15e003f3667720be92703710201 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Thu, 15 Nov 2007 12:58:44 +0000 Subject: [PATCH] Use QSettings for session management of windows geometry. This commit also removes the possibility to fix the window dimensions in the RC file. Instead we have now a single check box for enabling/disabling geometry session management. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21625 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/LyXFunc.cpp | 4 +- src/LyXRC.cpp | 55 +---- src/LyXRC.h | 13 +- src/frontends/qt4/GuiApplication.cpp | 17 +- src/frontends/qt4/GuiPrefs.cpp | 34 +-- src/frontends/qt4/GuiPrefs.h | 2 - src/frontends/qt4/GuiView.cpp | 294 +++---------------------- src/frontends/qt4/GuiView.h | 26 +-- src/frontends/qt4/ui/PrefUi.ui | 308 ++++++++------------------- 9 files changed, 163 insertions(+), 590 deletions(-) diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index 356e06e147..57c9a50562 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -2521,9 +2521,7 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) case LyXRC::RC_SCREEN_FONT_SIZES: case LyXRC::RC_SCREEN_FONT_TYPEWRITER: case LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY: - case LyXRC::RC_SCREEN_GEOMETRY_HEIGHT: - case LyXRC::RC_SCREEN_GEOMETRY_WIDTH: - case LyXRC::RC_SCREEN_GEOMETRY_XYSAVED: + case LyXRC::RC_GEOMETRY_SESSION: case LyXRC::RC_SCREEN_ZOOM: case LyXRC::RC_SERVERPIPE: case LyXRC::RC_SET_COLOR: diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index c856d756ac..9e048c5ddf 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -67,6 +67,7 @@ namespace { // when adding something to this array keep it sorted! keyword_item lyxrcTags[] = { { "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND }, + { "\\allow_geometry_session", LyXRC::RC_GEOMETRY_SESSION }, { "\\alternate_language", LyXRC::RC_ALT_LANG }, { "\\auto_number", LyXRC::RC_AUTO_NUMBER }, { "\\auto_region_delete", LyXRC::RC_AUTOREGIONDELETE }, @@ -146,9 +147,6 @@ keyword_item lyxrcTags[] = { { "\\screen_font_sizes", LyXRC::RC_SCREEN_FONT_SIZES }, { "\\screen_font_typewriter", LyXRC::RC_SCREEN_FONT_TYPEWRITER }, { "\\screen_font_typewriter_foundry", LyXRC::RC_SCREEN_FONT_TYPEWRITER_FOUNDRY }, - { "\\screen_geometry_height", LyXRC::RC_SCREEN_GEOMETRY_HEIGHT }, - { "\\screen_geometry_width", LyXRC::RC_SCREEN_GEOMETRY_WIDTH }, - { "\\screen_geometry_xysaved", LyXRC::RC_SCREEN_GEOMETRY_XYSAVED }, { "\\screen_zoom", LyXRC::RC_SCREEN_ZOOM }, { "\\serverpipe", LyXRC::RC_SERVERPIPE }, { "\\set_color", LyXRC::RC_SET_COLOR }, @@ -222,9 +220,7 @@ void LyXRC::setDefaults() { dpi = 75; // Because a screen typically is wider than a piece of paper: zoom = 150; - geometry_width = 0; - geometry_height = 0; - geometry_xysaved = true; + allow_geometry_session = true; // Default LaTeX font size: font_sizes[FONT_SIZE_TINY] = "5.0"; font_sizes[FONT_SIZE_SCRIPT] = "7.0"; @@ -641,21 +637,9 @@ int LyXRC::read(Lexer & lexrc) } break; - case RC_SCREEN_GEOMETRY_HEIGHT: + case RC_GEOMETRY_SESSION: if (lexrc.next()) { - geometry_height = lexrc.getInteger(); - } - break; - - case RC_SCREEN_GEOMETRY_WIDTH: - if (lexrc.next()) { - geometry_width = lexrc.getInteger(); - } - break; - - case RC_SCREEN_GEOMETRY_XYSAVED: - if (lexrc.next()) { - geometry_xysaved = lexrc.getBool(); + allow_geometry_session = lexrc.getBool(); } break; @@ -1573,26 +1557,10 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c } if (tag != RC_LAST) break; - case RC_SCREEN_GEOMETRY_HEIGHT: + case RC_GEOMETRY_SESSION: if (ignore_system_lyxrc || - geometry_height != system_lyxrc.geometry_height) { - os << "\\screen_geometry_height " << geometry_height - << '\n'; - } - if (tag != RC_LAST) - break; - case RC_SCREEN_GEOMETRY_WIDTH: - if (ignore_system_lyxrc || - geometry_width != system_lyxrc.geometry_width) { - os << "\\screen_geometry_width " << geometry_width - << '\n'; - } - if (tag != RC_LAST) - break; - case RC_SCREEN_GEOMETRY_XYSAVED: - if (ignore_system_lyxrc || - geometry_xysaved != system_lyxrc.geometry_xysaved) { - os << "\\screen_geometry_xysaved " << convert(geometry_xysaved) + allow_geometry_session != system_lyxrc.allow_geometry_session) { + os << "\\allow_geometry_session " << convert(allow_geometry_session) << '\n'; } if (tag != RC_LAST) @@ -2647,13 +2615,8 @@ string const LyXRC::getDescription(LyXRCTags tag) str = _("The zoom percentage for screen fonts. A setting of 100% will make the fonts roughly the same size as on paper."); break; - case RC_SCREEN_GEOMETRY_HEIGHT: - case RC_SCREEN_GEOMETRY_WIDTH: - str = _("Specify geometry of the main view in width x height (values from last session will not be used if non-zero values are specified)."); - break; - - case RC_SCREEN_GEOMETRY_XYSAVED: - str = _("Allow session manager to save and restore windows position."); + case RC_GEOMETRY_SESSION: + str = _("Allow session manager to save and restore windows geometry."); break; case RC_SERVERPIPE: diff --git a/src/LyXRC.h b/src/LyXRC.h index 5a2a94bc5f..ee159307fe 100644 --- a/src/LyXRC.h +++ b/src/LyXRC.h @@ -118,9 +118,7 @@ public: RC_SCREEN_FONT_SIZES, RC_SCREEN_FONT_TYPEWRITER, RC_SCREEN_FONT_TYPEWRITER_FOUNDRY, - RC_SCREEN_GEOMETRY_HEIGHT, - RC_SCREEN_GEOMETRY_WIDTH, - RC_SCREEN_GEOMETRY_XYSAVED, + RC_GEOMETRY_SESSION, RC_SCREEN_ZOOM, RC_SERVERPIPE, RC_SET_COLOR, @@ -247,12 +245,9 @@ public: bool make_backup; /// A directory for storing backup files std::string backupdir_path; - /// Width of MainWindow. if 0, value from last session will be used - int geometry_width; - /// Height of MainWindow, if 0, value from last session will be used - int geometry_height; - /// Whether or not save/restore windows position as session info - bool geometry_xysaved; + /// Whether or not save/restore session information + /// like windows position and geometry. + bool allow_geometry_session; /// Zoom factor for screen fonts unsigned int zoom; /// Screen font sizes in points for each font size diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index de70c6a457..cac3014b2c 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -201,7 +202,21 @@ LyXView & GuiApplication::createView(string const & geometryArg) theLyXFunc().setLyXView(&view); view.init(); - view.setGeometry(geometryArg); + view.show(); + if (!geometryArg.empty()) + { +#ifdef Q_WS_WIN + int x, y; + int w, h; + QRegExp re( "[=]*(?:([0-9]+)[xX]([0-9]+)){0,1}[ ]*(?:([+-][0-9]*)([+-][0-9]*)){0,1}" ); + re.indexIn(toqstr(geometryArg.c_str())); + w = re.cap(1).toInt(); + h = re.cap(2).toInt(); + x = re.cap(3).toInt(); + y = re.cap(4).toInt(); + view.setGeometry(x, y, w, h); +#endif + } view.setFocus(); setCurrentView(view); diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 0f006d36fc..5ac9daf24b 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -1609,13 +1609,7 @@ PrefUserInterface::PrefUserInterface(GuiPreferences * form, QWidget * parent) this, SIGNAL(changed())); connect(loadSessionCB, SIGNAL(clicked()), this, SIGNAL(changed())); - connect(loadWindowSizeCB, SIGNAL(clicked()), - this, SIGNAL(changed())); - connect(loadWindowLocationCB, SIGNAL(clicked()), - this, SIGNAL(changed())); - connect(windowWidthSB, SIGNAL(valueChanged(int)), - this, SIGNAL(changed())); - connect(windowHeightSB, SIGNAL(valueChanged(int)), + connect(allowGeometrySessionCB, SIGNAL(clicked()), this, SIGNAL(changed())); connect(cursorFollowsCB, SIGNAL(clicked()), this, SIGNAL(changed())); @@ -1638,14 +1632,7 @@ void PrefUserInterface::apply(LyXRC & rc) const rc.ui_file = internal_path(fromqstr(uiFileED->text())); rc.use_lastfilepos = restoreCursorCB->isChecked(); rc.load_session = loadSessionCB->isChecked(); - if (loadWindowSizeCB->isChecked()) { - rc.geometry_width = 0; - rc.geometry_height = 0; - } else { - rc.geometry_width = windowWidthSB->value(); - rc.geometry_height = windowHeightSB->value(); - } - rc.geometry_xysaved = loadWindowLocationCB->isChecked(); + rc.allow_geometry_session = allowGeometrySessionCB->isChecked(); rc.cursor_follows_scrollbar = cursorFollowsCB->isChecked(); rc.sort_layouts = sortEnvironmentsCB->isChecked(); rc.autosave = autoSaveSB->value() * 60; @@ -1660,13 +1647,7 @@ void PrefUserInterface::update(LyXRC const & rc) uiFileED->setText(toqstr(external_path(rc.ui_file))); restoreCursorCB->setChecked(rc.use_lastfilepos); loadSessionCB->setChecked(rc.load_session); - bool loadWindowSize = rc.geometry_width == 0 && rc.geometry_height == 0; - loadWindowSizeCB->setChecked(loadWindowSize); - if (!loadWindowSize) { - windowWidthSB->setValue(rc.geometry_width); - windowHeightSB->setValue(rc.geometry_height); - } - loadWindowLocationCB->setChecked(rc.geometry_xysaved); + allowGeometrySessionCB->setChecked(rc.allow_geometry_session); cursorFollowsCB->setChecked(rc.cursor_follows_scrollbar); sortEnvironmentsCB->setChecked(rc.sort_layouts); // convert to minutes @@ -1693,15 +1674,6 @@ void PrefUserInterface::select_ui() } -void PrefUserInterface::on_loadWindowSizeCB_toggled(bool loadwindowsize) -{ - windowWidthLA->setDisabled(loadwindowsize); - windowHeightLA->setDisabled(loadwindowsize); - windowWidthSB->setDisabled(loadwindowsize); - windowHeightSB->setDisabled(loadwindowsize); -} - - ///////////////////////////////////////////////////////////////////// // // PrefShortcuts diff --git a/src/frontends/qt4/GuiPrefs.h b/src/frontends/qt4/GuiPrefs.h index 0eff31969a..ff51d7a306 100644 --- a/src/frontends/qt4/GuiPrefs.h +++ b/src/frontends/qt4/GuiPrefs.h @@ -343,8 +343,6 @@ public: public Q_SLOTS: void select_ui(); - void on_loadWindowSizeCB_toggled(bool); - }; diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 906ca11d8a..1c30baf32b 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -52,7 +52,6 @@ #include "LyXRC.h" #include "MenuBackend.h" #include "Paragraph.h" -#include "Session.h" #include "TextClass.h" #include "Text.h" #include "ToolbarBackend.h" @@ -73,6 +72,8 @@ #include #include #include +#include +#include #include #include #include @@ -368,6 +369,25 @@ void GuiView::init() } +void GuiView::showEvent(QShowEvent * e) +{ + if (lyxrc.allow_geometry_session) { + QSettings settings; + QString const key = "view-" + QString::number(id()); + if (!restoreGeometry(settings.value(key + "/geometry").toByteArray())) + setGeometry(50, 50, 690, 510); + setIconSize(settings.value(key + "/icon_size").toSize()); + } else + setGeometry(50, 50, 690, 510); + + if (d.splitter_->count() == 0) + // No work area, switch to the background widget. + d.setBackground(); + + QMainWindow::showEvent(e); +} + + void GuiView::closeEvent(QCloseEvent * close_event) { // we may have been called through the close window button @@ -384,6 +404,14 @@ void GuiView::closeEvent(QCloseEvent * close_event) // Make sure the timer time out will not trigger a statusbar update. statusbar_timer_.stop(); + if (lyxrc.allow_geometry_session) { + QSettings settings; + QString const key = "view-" + QString::number(id()); + settings.setValue(key + "/geometry", saveGeometry()); + settings.setValue(key + "/icon_size", iconSize()); + d.toolbars_->saveToolbarInfo(); + } + theApp()->gui().unregisterView(id()); if (!theApp()->gui().viewIds().empty()) { // Just close the window and do nothing else if this is not the @@ -396,7 +424,6 @@ void GuiView::closeEvent(QCloseEvent * close_event) // this is the place where we leave the frontend. // it is the only point at which we start quitting. - saveGeometry(); close_event->accept(); // quit the event loop qApp->quit(); @@ -430,232 +457,6 @@ void GuiView::dropEvent(QDropEvent* event) } -void GuiView::saveGeometry() -{ - static bool done = false; - if (done) - return; - else - done = true; - - // FIXME: - // change the ifdef to 'geometry = normalGeometry();' only - // when Trolltech has fixed the broken normalGeometry on X11: - // http://www.trolltech.com/developer/task-tracker/index_html?id=119684+&method=entry - // Then also the moveEvent, resizeEvent, and the - // code for floatingGeometry_ can be removed; - // adjust GuiView::setGeometry() - - QRect normal_geometry; - Maximized maximized; -#ifdef Q_WS_WIN - normal_geometry = normalGeometry(); - if (isMaximized()) { - maximized = CompletelyMaximized; - } else { - maximized = NotMaximized; - } -#else - normal_geometry = updateFloatingGeometry(); - - QDesktopWidget& dw = *qApp->desktop(); - QRect desk = dw.availableGeometry(dw.primaryScreen()); - // Qt bug on Linux: load completely maximized, vert max. save-> frameGeometry().height() is wrong - if (isMaximized() && desk.width() <= frameGeometry().width() && desk.height() <= frameGeometry().height()) { - maximized = CompletelyMaximized; - // maximizing does not work when the window is allready hor. or vert. maximized - // Tested only on KDE - int dh = frameGeometry().height() - height(); - if (desk.height() <= normal_geometry.height() + dh) - normal_geometry.setHeight(normal_geometry.height() - 1); - int dw = frameGeometry().width() - width(); - if (desk.width() <= normal_geometry.width() + dw) - normal_geometry.setWidth(normal_geometry.width() - 1); - } else if (desk.height() <= frameGeometry().height()) { - maximized = VerticallyMaximized; - } else if (desk.width() <= frameGeometry().width()) { - maximized = HorizontallyMaximized; - } else { - maximized = NotMaximized; - } -#endif - - // save windows size and position - SessionInfoSection & info = LyX::ref().session().sessionInfo(); - info.save("WindowWidth", convert(normal_geometry.width())); - info.save("WindowHeight", convert(normal_geometry.height())); - info.save("WindowMaximized", convert(int(maximized))); - info.save("IconSizeXY", convert(iconSize().width())); - if (lyxrc.geometry_xysaved) { - info.save("WindowPosX", convert(normal_geometry.x() + d.posx_offset)); - info.save("WindowPosY", convert(normal_geometry.y() + d.posy_offset)); - } - d.toolbars_->saveToolbarInfo(); -} - - -void GuiView::setGeometry(string const & geometryArg) -{ - // ******************************************* - // Beginning of the session handling stuff - - //FIXME: Instead of the stuff below, we should use QSettings: - /* - QSettings settings; - QString key = "view " + QString::number(id) + "/geometry"; - view.restoreGeometry(settings.value(key).toByteArray()); - */ - - // determine windows size and position, from lyxrc and/or session - // initial geometry - unsigned int width = 690; - unsigned int height = 510; - // default icon size, will be overwritten by stored session value - unsigned int iconSizeXY = 0; - Maximized maximized = NotMaximized; - SessionInfoSection & session = LyX::ref().session().sessionInfo(); - - // first try lyxrc - if (lyxrc.geometry_width != 0 && lyxrc.geometry_height != 0 ) { - width = lyxrc.geometry_width; - height = lyxrc.geometry_height; - } - // if lyxrc returns (0,0), then use session info - else { - string val = session.load("WindowWidth"); - if (!val.empty()) - width = convert(val); - val = session.load("WindowHeight"); - if (!val.empty()) - height = convert(val); - val = session.load("WindowMaximized"); - if (!val.empty()) - maximized = GuiView::Maximized(convert(val)); - val = session.load("IconSizeXY"); - if (!val.empty()) - iconSizeXY = convert(val); - } - - // if user wants to restore window position - int posx = -1; - int posy = -1; - if (lyxrc.geometry_xysaved) { - string val = session.load("WindowPosX"); - if (!val.empty()) - posx = convert(val); - val = session.load("WindowPosY"); - if (!val.empty()) - posy = convert(val); - } - - if (!geometryArg.empty()) - { - width = 0; - height = 0; - } - - // End of the sesssion handling stuff - // ******************************************* - - // use last value (not at startup) - if (d.lastIconSize != 0) - setIconSize(d.lastIconSize); - else if (iconSizeXY != 0) - setIconSize(iconSizeXY); - else - setIconSize(d.normalIconSize); - - // only true when the -geometry option was NOT used - if (width != 0 && height != 0) { - if (posx != -1 && posy != -1) { - // if there are startup positioning problems: - // http://doc.trolltech.com/4.2/qdesktopwidget.html - QDesktopWidget& dw = *qApp->desktop(); - if (dw.isVirtualDesktop()) { - if(!dw.geometry().contains(posx, posy)) { - posx = 50; - posy = 50; - } - } else { - // Which system doesn't use a virtual desktop? - // TODO save also last screen number and check if it is still availabe. - } -#ifdef Q_WS_WIN - // FIXME: use setGeometry only when Trolltech has fixed the qt4/X11 bug - QWidget::setGeometry(posx, posy, width, height); -#else - resize(width, height); - move(posx, posy); -#endif - } else { - resize(width, height); - } - - // remember original size - floatingGeometry_ = QRect(posx, posy, width, height); - - if (maximized != NotMaximized) { - if (maximized == CompletelyMaximized) { - setWindowState(Qt::WindowMaximized); - } else { -#ifndef Q_WS_WIN - // TODO How to set by the window manager? - // setWindowState(Qt::WindowVerticallyMaximized); - // is not possible - QDesktopWidget& dw = *qApp->desktop(); - QRect desk = dw.availableGeometry(dw.primaryScreen()); - if (maximized == VerticallyMaximized) - resize(width, desk.height()); - if (maximized == HorizontallyMaximized) - resize(desk.width(), height); -#endif - } - } - } - else - { - // FIXME: move this code into parse_geometry() (LyX.cpp) -#ifdef Q_WS_WIN - int x, y; - int w, h; - QRegExp re( "[=]*(?:([0-9]+)[xX]([0-9]+)){0,1}[ ]*(?:([+-][0-9]*)([+-][0-9]*)){0,1}" ); - re.indexIn(toqstr(geometryArg.c_str())); - w = re.cap(1).toInt(); - h = re.cap(2).toInt(); - x = re.cap(3).toInt(); - y = re.cap(4).toInt(); - QWidget::setGeometry( x, y, w, h ); -#else - // silence warning - (void)geometryArg; -#endif - } - - d.setBackground(); - - show(); - - // after show geometry() has changed (Qt bug?) - // we compensate the drift when storing the position - d.posx_offset = 0; - d.posy_offset = 0; - if (width != 0 && height != 0) - if (posx != -1 && posy != -1) { -#ifdef Q_WS_WIN - d.posx_offset = posx - normalGeometry().x(); - d.posy_offset = posy - normalGeometry().y(); -#else -#ifndef Q_WS_MACX - if (maximized == NotMaximized) { - d.posx_offset = posx - geometry().x(); - d.posy_offset = posy - geometry().y(); - } -#endif -#endif - } -} - - void GuiView::message(docstring const & str) { statusBar()->showMessage(toqstr(str)); @@ -664,28 +465,21 @@ void GuiView::message(docstring const & str) } -void GuiView::setIconSize(unsigned int size) -{ - d.lastIconSize = size; - QMainWindow::setIconSize(QSize(size, size)); -} - - void GuiView::smallSizedIcons() { - setIconSize(d.smallIconSize); + setIconSize(QSize(d.smallIconSize, d.smallIconSize)); } void GuiView::normalSizedIcons() { - setIconSize(d.normalIconSize); + setIconSize(QSize(d.normalIconSize, d.normalIconSize)); } void GuiView::bigSizedIcons() { - setIconSize(d.bigIconSize); + setIconSize(QSize(d.bigIconSize, d.bigIconSize)); } @@ -746,30 +540,6 @@ bool GuiView::hasFocus() const } -QRect GuiView::updateFloatingGeometry() -{ - QDesktopWidget& dw = *qApp->desktop(); - QRect desk = dw.availableGeometry(dw.primaryScreen()); - // remember only non-maximized sizes - if (!isMaximized() && desk.width() > frameGeometry().width() && desk.height() > frameGeometry().height()) { - floatingGeometry_ = QRect(x(), y(), width(), height()); - } - return floatingGeometry_; -} - - -void GuiView::resizeEvent(QResizeEvent *) -{ - updateFloatingGeometry(); -} - - -void GuiView::moveEvent(QMoveEvent *) -{ - updateFloatingGeometry(); -} - - bool GuiView::event(QEvent * e) { switch (e->type()) diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index 32c1f6064e..74f5782885 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -24,6 +24,7 @@ class QCloseEvent; class QDragEnterEvent; class QDropEvent; class QMenu; +class QShowEvent; namespace lyx { @@ -59,18 +60,8 @@ public: virtual void init(); virtual void close(); virtual void setFocus(); - - enum Maximized { - NotMaximized = 0, // LyX::newLyXView() relies on this to be zero! - VerticallyMaximized, - HorizontallyMaximized, - CompletelyMaximized - }; - /// - virtual void setGeometry(std::string const & geometryArg); - /// save the geometry state in the session manager. - virtual void saveGeometry(); virtual void setBusy(bool); + /// add toolbar, if newline==true, add a toolbar break before the toolbar GuiToolbar * makeToolbar(ToolbarInfo const & tbinfo, bool newline); virtual void updateStatusBar(); @@ -185,19 +176,13 @@ private: /// void dropEvent(QDropEvent * ev); /// make sure we quit cleanly - virtual void closeEvent(QCloseEvent * e); + void closeEvent(QCloseEvent * e); /// - virtual void resizeEvent(QResizeEvent * e); - /// - virtual void moveEvent(QMoveEvent * e); + void showEvent(QShowEvent *); /// in order to catch Tab key press. bool event(QEvent * e); bool focusNextPrevChild(bool); - /// - QRect updateFloatingGeometry(); - /// - void setIconSize(unsigned int size); /// struct GuiViewPrivate; @@ -209,9 +194,6 @@ private: /// are we quitting by the menu? bool quitting_by_menu_; - /// - QRect floatingGeometry_; - struct ToolbarSize { int top_width; int bottom_width; diff --git a/src/frontends/qt4/ui/PrefUi.ui b/src/frontends/qt4/ui/PrefUi.ui index d8cc082e47..6747fb3967 100644 --- a/src/frontends/qt4/ui/PrefUi.ui +++ b/src/frontends/qt4/ui/PrefUi.ui @@ -27,196 +27,6 @@ 6 - - - - &User interface file: - - - uiFileED - - - - - - - - - - Bro&wse... - - - - - - - - 0 - 0 - 0 - 0 - - - - Session - - - true - - - - 9 - - - 6 - - - - - Save/restore window size, or use fixed size - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Load opened files from last session - - - - - - - Restore cursor positions - - - - - - - true - - - Restore to cursor position when the file was last closed - - - Save/restore window position - - - - - - - 0 - - - 6 - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 30 - 20 - - - - - - - - false - - - Width - - - - - - - false - - - 9999 - - - 200 - - - 10 - - - - - - - false - - - Height - - - - - - - false - - - 9999 - - - 200 - - - 10 - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 30 - 20 - - - - - - - - - @@ -312,13 +122,18 @@ - - - - Editing + + + + + 0 + 0 + 0 + 0 + - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + Session true @@ -331,22 +146,48 @@ 6 - + + + true + + + Restore to cursor position when the file was last closed + - Cursor follows &scrollbar + Allow saving/restoring of windows geometry + + + + + + + Load opened files from last session - + - Sort &Environments alphabetically + Restore cursor positions + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -381,28 +222,67 @@ p, li { white-space: pre-wrap; } - - - - Qt::Vertical + + + + Editing - - - 20 - 40 - + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - + + true + + + + 9 + + + 6 + + + + + Cursor follows &scrollbar + + + + + + + Sort &Environments alphabetically + + + + + + + + + + Bro&wse... + + + + + + + + + + &User interface file: + + + uiFileED + + uiFileED uiFilePB - loadWindowSizeCB - windowWidthSB - windowHeightSB - loadWindowLocationCB + allowGeometrySessionCB restoreCursorCB loadSessionCB autoSaveCB