]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QGraphicsDialog.C
Some string(widget->text()) fixes. Weirdness
[lyx.git] / src / frontends / qt2 / QGraphicsDialog.C
1 /**
2  * \file QGraphicsDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  * \author Herbert Voss
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #include <config.h>
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include "ControlGraphics.h"
19 #include "debug.h"
20 #include "gettext.h"
21 #include "LString.h"
22
23 #include <qwidget.h>
24 #include <qpushbutton.h>
25 #include <qlineedit.h>
26 #include <qcheckbox.h>
27 #include <qfiledialog.h>
28 #include <qcombobox.h>
29
30 #include "lengthcombo.h"
31
32 #include "QGraphicsDialog.h"
33 #include "QGraphics.h"
34
35 #include <vector>
36
37
38 QGraphicsDialog::QGraphicsDialog(QGraphics * form)
39         : QGraphicsDialogBase(0, 0, false, 0),
40         form_(form)
41 {
42         connect(okPB, SIGNAL(clicked()),
43                 form, SLOT(slotOK()));
44         connect(applyPB, SIGNAL(clicked()),
45                 form, SLOT(slotApply()));
46         connect(closePB, SIGNAL(clicked()),
47                 form, SLOT(slotClose()));
48         connect(restorePB, SIGNAL(clicked()),
49                 form, SLOT(slotRestore()));
50 }
51
52
53 void QGraphicsDialog::show()
54 {
55         QGraphicsDialogBase::show();
56         filename->setFocus();
57 }
58
59
60 void QGraphicsDialog::change_adaptor()
61 {
62         form_->changed();
63 }
64
65
66 void QGraphicsDialog::change_bb()
67 {
68         form_->controller().bbChanged = true;
69         lyxerr[Debug::GRAPHICS] 
70                 << "[controller().bb_Changed set to true]\n";
71         form_->changed();
72 }
73
74
75 void QGraphicsDialog::change_WUnit()
76 {
77         bool useHeight = (widthUnit->currentItem() > 0);
78         height->setEnabled(useHeight);
79         heightUnit->setEnabled(useHeight);
80         form_->changed();
81 }
82
83
84 void QGraphicsDialog::closeEvent(QCloseEvent * e)
85 {
86         form_->slotWMHide();
87         e->accept();
88 }
89
90
91 void QGraphicsDialog::browse_clicked()
92 {
93         QString file = QFileDialog::getOpenFileName(
94                 QString::null, _("Files (*)"),
95                 this, 0, _("Select a graphic file"));
96         if (!file.isNull()) {
97                 string const name = file.latin1();
98                 filename->setText(name.c_str());
99                 form_->changed();
100         }
101 }
102
103
104 void QGraphicsDialog::getBB_clicked()
105 {
106         form_->getBB();
107 }