]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/DialogView.cpp
Factorize general code out of GuiDialog and into the base Dialog class. This is now...
[lyx.git] / src / frontends / qt4 / DialogView.cpp
1 /**
2  * \file Dialog.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "DialogView.h"
14
15 #include "GuiView.h"
16 #include "qt_helpers.h"
17
18 #include <QCloseEvent>
19 #include <QSettings>
20 #include <QShowEvent>
21
22
23 namespace lyx {
24 namespace frontend {
25
26 DialogView::DialogView(GuiView & lv, std::string const & name)
27         : QDialog(&lv), Dialog(lv, name)
28 {}
29
30
31 void DialogView::setViewTitle(docstring const & title)
32 {
33         setWindowTitle("LyX: " + toqstr(title));
34 }
35
36
37 void DialogView::showEvent(QShowEvent * e)
38 {
39         QSettings settings;
40         QString key = toqstr(name()) + "/geometry";
41         restoreGeometry(settings.value(key).toByteArray());
42         QDialog::showEvent(e);
43 }
44
45
46 void DialogView::closeEvent(QCloseEvent * e)
47 {
48         QSettings settings;
49         QString key = toqstr(name()) + "/geometry";
50         settings.setValue(key, saveGeometry());
51         QDialog::closeEvent(e);
52 }
53
54 } // namespace frontend
55 } // namespace lyx
56
57 #include "DialogView_moc.cpp"