author | harlekin <harlekin> | 2002-10-01 20:57:23 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-01 20:57:23 (UTC) |
commit | 88bef2791f8e4c99e0e9d34ddfe518b5baa2df72 (patch) (unidiff) | |
tree | 19a3d6ee9360d5765ced9b600f1b094d2a1e3c4b | |
parent | 88c3937936dbbb13575425ce9da72d5286bd1233 (diff) | |
download | opie-88bef2791f8e4c99e0e9d34ddfe518b5baa2df72.zip opie-88bef2791f8e4c99e0e9d34ddfe518b5baa2df72.tar.gz opie-88bef2791f8e4c99e0e9d34ddfe518b5baa2df72.tar.bz2 |
cleanups and gui redo with layouts
-rw-r--r-- | core/launcher/mediummountgui.cpp | 97 | ||||
-rw-r--r-- | core/launcher/mediummountgui.h | 4 |
2 files changed, 42 insertions, 59 deletions
diff --git a/core/launcher/mediummountgui.cpp b/core/launcher/mediummountgui.cpp index eb2308e..6d60ce4 100644 --- a/core/launcher/mediummountgui.cpp +++ b/core/launcher/mediummountgui.cpp | |||
@@ -1,40 +1,31 @@ | |||
1 | 1 | ||
2 | #include "mediummountgui.h" | 2 | #include "mediummountgui.h" |
3 | 3 | ||
4 | #include <qvariant.h> | ||
5 | #include <qcheckbox.h> | 4 | #include <qcheckbox.h> |
6 | #include <qgroupbox.h> | 5 | #include <qgroupbox.h> |
7 | #include <qlabel.h> | 6 | #include <qlabel.h> |
8 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
9 | #include <qpushbutton.h> | 8 | #include <qpushbutton.h> |
10 | #include <qlayout.h> | 9 | #include <qlayout.h> |
11 | #include <qtooltip.h> | ||
12 | #include <qwhatsthis.h> | ||
13 | #include <qimage.h> | 10 | #include <qimage.h> |
14 | #include <qpixmap.h> | 11 | #include <qpixmap.h> |
12 | #include <qvbox.h> | ||
13 | #include <qhbox.h> | ||
15 | 14 | ||
16 | #include <qpe/resource.h> | 15 | #include <qpe/resource.h> |
17 | #include <qpe/config.h> | 16 | #include <qpe/config.h> |
18 | 17 | ||
19 | #include <qpe/config.h> | ||
20 | |||
21 | |||
22 | #include <qapplication.h> | ||
23 | |||
24 | 18 | ||
25 | MediumMountGui::MediumMountGui( Config *cfg, const QString &path ,QWidget* parent, const char* name, bool , WFlags ) | 19 | MediumMountGui::MediumMountGui( Config *cfg, const QString &path ,QWidget* parent, const char* name, bool , WFlags ) |
26 | : QDialog( parent, name, true ) { | 20 | : QDialog( parent, name, true ) { |
27 | 21 | ||
28 | m_cfg = cfg; | 22 | m_cfg = cfg; |
29 | QWidget *d = QApplication::desktop(); | ||
30 | int w=d->width(); | ||
31 | int h=d->height(); | ||
32 | resize( w , h ); | ||
33 | setCaption( tr( "Medium inserted" ) ); | 23 | setCaption( tr( "Medium inserted" ) ); |
34 | 24 | ||
35 | mediumPath = path; | 25 | mediumPath = path; |
36 | readConfig(); | 26 | readConfig(); |
37 | startGui(); | 27 | startGui(); |
28 | showMaximized(); | ||
38 | } | 29 | } |
39 | 30 | ||
40 | void MediumMountGui::readConfig(){ | 31 | void MediumMountGui::readConfig(){ |
@@ -59,8 +50,7 @@ bool MediumMountGui::check() { | |||
59 | } | 50 | } |
60 | 51 | ||
61 | QStringList MediumMountGui::dirs() { | 52 | QStringList MediumMountGui::dirs() { |
62 | QStringList list = QStringList::split(",", limittodirs ); | 53 | return QStringList::split( ",", limittodirs ); |
63 | return list; | ||
64 | } | 54 | } |
65 | 55 | ||
66 | void MediumMountGui::writeConfig(bool autocheck) { | 56 | void MediumMountGui::writeConfig(bool autocheck) { |
@@ -81,7 +71,6 @@ void MediumMountGui::writeConfig(bool autocheck) { | |||
81 | m_cfg->setGroup("dirs"); | 71 | m_cfg->setGroup("dirs"); |
82 | m_cfg->writeEntry("dirs", ""); | 72 | m_cfg->writeEntry("dirs", ""); |
83 | 73 | ||
84 | |||
85 | // if all is checked then add only "QString::null" to the list. | 74 | // if all is checked then add only "QString::null" to the list. |
86 | if (checkmimeall) { | 75 | if (checkmimeall) { |
87 | mimeTypeList.clear(); | 76 | mimeTypeList.clear(); |
@@ -105,76 +94,75 @@ void MediumMountGui::writeConfig(bool autocheck) { | |||
105 | 94 | ||
106 | void MediumMountGui::startGui() { | 95 | void MediumMountGui::startGui() { |
107 | 96 | ||
108 | QPixmap image = Resource::loadPixmap( "HelpBrowser"); | 97 | QVBoxLayout* mainLayout = new QVBoxLayout( this ); |
109 | 98 | ||
99 | QHBoxLayout * titelBox = new QHBoxLayout( mainLayout ); | ||
110 | Text_2 = new QLabel( this ); | 100 | Text_2 = new QLabel( this ); |
111 | Text_2->setGeometry( QRect( 10, 15, 40, 40 ) ); | 101 | // FIXME needs an image |
112 | Text_2->setPixmap( image ); | 102 | Text_2->setPixmap( Resource::loadPixmap( "mediummount/mediummount" ) ); |
113 | 103 | ||
114 | Text = new QLabel( this, "Text" ); | 104 | Text = new QLabel( this, "Text" ); |
115 | Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) ); | ||
116 | Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) ); | 105 | Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) ); |
106 | titelBox->addWidget( Text_2 ); | ||
107 | titelBox->setStretchFactor( Text_2, 2 ); | ||
108 | titelBox->addWidget( Text ); | ||
109 | titelBox->setStretchFactor( Text, 8 ); | ||
117 | 110 | ||
118 | // media box | 111 | // media box |
119 | GroupBox1 = new QGroupBox( this, "GroupBox1" ); | 112 | GroupBox1 = new QGroupBox( this, "GroupBox1" ); |
120 | GroupBox1->setGeometry( QRect( 10, 80, (this->width())-25, 80 ) ); | ||
121 | GroupBox1->setTitle( tr( "Which media files" ) ); | 113 | GroupBox1->setTitle( tr( "Which media files" ) ); |
122 | 114 | ||
115 | QGridLayout *mimeLayout = new QGridLayout( GroupBox1, 3, 2, 10 ); | ||
116 | |||
123 | CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" ); | 117 | CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" ); |
124 | CheckBoxAudio->setGeometry( QRect( 10, 15, (GroupBox1->width()/2)-15 , 15 ) ); | ||
125 | CheckBoxAudio->setText( tr( "Audio" ) ); | 118 | CheckBoxAudio->setText( tr( "Audio" ) ); |
126 | 119 | ||
127 | CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" ); | 120 | CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" ); |
128 | CheckBoxImage->setGeometry( QRect( 10, 35,(GroupBox1->width()/2)-15, 15 ) ); | ||
129 | CheckBoxImage->setText( tr( "Image" ) ); | 121 | CheckBoxImage->setText( tr( "Image" ) ); |
130 | 122 | ||
131 | CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" ); | 123 | CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" ); |
132 | CheckBoxText->setGeometry( QRect((GroupBox1->width()/2) , 15, (GroupBox1->width()/2)-15, 15 ) ); | ||
133 | CheckBoxText->setText( tr( "Text" ) ); | 124 | CheckBoxText->setText( tr( "Text" ) ); |
134 | 125 | ||
135 | CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" ); | 126 | CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" ); |
136 | CheckBoxVideo->setGeometry( QRect( (GroupBox1->width()/2), 35, (GroupBox1->width()/2)-15, 15 ) ); | ||
137 | CheckBoxVideo->setText( tr( "Video" ) ); | 127 | CheckBoxVideo->setText( tr( "Video" ) ); |
138 | 128 | ||
139 | CheckBoxAll = new QCheckBox ( GroupBox1); | 129 | CheckBoxAll = new QCheckBox ( GroupBox1); |
140 | CheckBoxAll->setGeometry( QRect( 10, 55, (GroupBox1->width()/2)-15, 15 ) ); | ||
141 | CheckBoxAll->setText( tr( "All" ) ); | 130 | CheckBoxAll->setText( tr( "All" ) ); |
142 | QObject::connect( (QObject*)CheckBoxAll, SIGNAL( clicked() ), this, SLOT( deactivateOthers()) ); | ||
143 | |||
144 | |||
145 | 131 | ||
146 | CheckBoxLink = new QCheckBox ( GroupBox1); | 132 | CheckBoxLink = new QCheckBox ( GroupBox1); |
147 | CheckBoxLink->setGeometry( QRect( (GroupBox1->width()/2), 55, (GroupBox1->width()/2)-15, 15 ) ); | ||
148 | CheckBoxLink->setText( tr( "Link apps" ) ); | 133 | CheckBoxLink->setText( tr( "Link apps" ) ); |
149 | // as long as the feature is not supported | 134 | // as long as the feature is not supported |
150 | CheckBoxLink->setEnabled(false); | 135 | CheckBoxLink->setEnabled(false); |
151 | 136 | ||
137 | mimeLayout->addWidget( CheckBoxAudio, 0, 0 ); | ||
138 | mimeLayout->addWidget( CheckBoxImage, 0, 1 ); | ||
139 | mimeLayout->addWidget( CheckBoxText , 1, 0 ); | ||
140 | mimeLayout->addWidget( CheckBoxVideo, 1, 1 ); | ||
141 | mimeLayout->addWidget( CheckBoxAll, 2, 0 ); | ||
142 | mimeLayout->addWidget( CheckBoxLink, 2, 1 ); | ||
152 | 143 | ||
153 | // select dirs | 144 | connect( CheckBoxAll, SIGNAL( clicked() ), this, SLOT( deactivateOthers() ) ); |
154 | 145 | ||
155 | DirSelectText = new QLabel( this, "DirSelectText" ); | 146 | QVBox* dirBox = new QVBox( this ); |
156 | DirSelectText->setGeometry( QRect( 10, 160,this->width() , 20 ) ); | 147 | dirBox->setMargin( 4 ); |
157 | DirSelectText->setText( tr( "Limit search to dir: (not used yet)" ) ); | ||
158 | 148 | ||
159 | LineEdit1 = new QLineEdit( this ); | 149 | // select dirs |
160 | LineEdit1->setGeometry( QRect( 10, 180, (this->width())-60, 20 ) ); | 150 | DirSelectText = new QLabel( dirBox, "DirSelectText" ); |
151 | DirSelectText->setText( tr( "Limit search to dir: (not used yet)" ) ); | ||
161 | 152 | ||
162 | PushButton3 = new QPushButton( this ); | 153 | QHBox* dirLineBox = new QHBox( dirBox ); |
163 | PushButton3->setGeometry( QRect( (this->width())-40, 180, 30, 20 ) ); | 154 | LineEdit1 = new QLineEdit( dirLineBox ); |
155 | PushButton3 = new QPushButton( dirLineBox ); | ||
164 | PushButton3->setText( tr( "Add" ) ); | 156 | PushButton3->setText( tr( "Add" ) ); |
165 | 157 | ||
166 | |||
167 | // decision | 158 | // decision |
168 | DirSelectText_2 = new QLabel( this ); | 159 | DirSelectText_2 = new QLabel( dirBox ); |
169 | DirSelectText_2->setGeometry( QRect( 10,240,this->width(), 15 ) ); | ||
170 | DirSelectText_2->setText( tr( "Your decision will be stored on the medium." ) ); | 160 | DirSelectText_2->setText( tr( "Your decision will be stored on the medium." ) ); |
171 | 161 | ||
172 | // ask again | 162 | // ask again |
173 | AskBox = new QCheckBox( this ); | 163 | AskBox = new QCheckBox( dirBox ); |
174 | AskBox->setGeometry( QRect( 10, 215, (this->width())-15 , 15 ) ); | ||
175 | AskBox->setText( tr( "Do not ask again for this medium" ) ); | 164 | AskBox->setText( tr( "Do not ask again for this medium" ) ); |
176 | 165 | ||
177 | |||
178 | AskBox->setChecked(checkagain); | 166 | AskBox->setChecked(checkagain); |
179 | CheckBoxAudio->setChecked(checkmimeaudio); | 167 | CheckBoxAudio->setChecked(checkmimeaudio); |
180 | CheckBoxImage->setChecked(checkmimeimage); | 168 | CheckBoxImage->setChecked(checkmimeimage); |
@@ -182,31 +170,26 @@ void MediumMountGui::startGui() { | |||
182 | CheckBoxVideo->setChecked(checkmimevideo); | 170 | CheckBoxVideo->setChecked(checkmimevideo); |
183 | CheckBoxAll->setChecked( checkmimeall ); | 171 | CheckBoxAll->setChecked( checkmimeall ); |
184 | deactivateOthers(); | 172 | deactivateOthers(); |
173 | |||
174 | QHBox* buttonBox = new QHBox( this ); | ||
185 | // buttons | 175 | // buttons |
186 | quit = new QPushButton( this ); | 176 | quit = new QPushButton( buttonBox ); |
187 | quit->setGeometry( QRect( (this->width()/2)- 90 , 260, 80, 22 ) ); | ||
188 | quit->setFocus(); | 177 | quit->setFocus(); |
189 | quit->setText( tr( "Yes" ) ); | 178 | quit->setText( tr( "Yes" ) ); |
190 | 179 | quit_2 = new QPushButton( buttonBox ); | |
191 | quit_2 = new QPushButton( this ); | ||
192 | quit_2->setGeometry( QRect((this->width()/2) , 260, 80, 22 ) ); | ||
193 | quit_2->setText( tr( "No" ) ); | 180 | quit_2->setText( tr( "No" ) ); |
194 | 181 | ||
195 | QObject::connect( (QObject*)quit, SIGNAL( clicked() ), this, SLOT(yesPressed() ) ); | 182 | mainLayout->addWidget( GroupBox1 ); |
196 | QObject::connect( (QObject*)quit_2, SIGNAL( clicked() ), this, SLOT(noPressed() ) ); | 183 | mainLayout->addWidget( dirBox ); |
197 | 184 | mainLayout->addWidget( buttonBox ); | |
198 | 185 | ||
186 | connect( quit, SIGNAL( clicked() ), this, SLOT( yesPressed() ) ); | ||
187 | connect( quit_2, SIGNAL( clicked() ), this, SLOT( noPressed() ) ); | ||
199 | } | 188 | } |
200 | 189 | ||
201 | 190 | ||
202 | void MediumMountGui::deactivateOthers() { | 191 | void MediumMountGui::deactivateOthers() { |
203 | bool mod = !(CheckBoxAll->isChecked()); | 192 | bool mod = !(CheckBoxAll->isChecked()); |
204 | |||
205 | //if (!CheckBoxVideo->isChecked()){ | ||
206 | // mod = false; | ||
207 | //} else { | ||
208 | // mod = true; | ||
209 | //} | ||
210 | CheckBoxVideo->setEnabled(mod); | 193 | CheckBoxVideo->setEnabled(mod); |
211 | CheckBoxAudio->setEnabled(mod); | 194 | CheckBoxAudio->setEnabled(mod); |
212 | CheckBoxText->setEnabled(mod); | 195 | CheckBoxText->setEnabled(mod); |
diff --git a/core/launcher/mediummountgui.h b/core/launcher/mediummountgui.h index 8292c3a..39f9a52 100644 --- a/core/launcher/mediummountgui.h +++ b/core/launcher/mediummountgui.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <qvariant.h> | 4 | #include <qvariant.h> |
5 | #include <qdialog.h> | 5 | #include <qdialog.h> |
6 | |||
6 | class QVBoxLayout; | 7 | class QVBoxLayout; |
7 | class QHBoxLayout; | 8 | class QHBoxLayout; |
8 | class QGridLayout; | 9 | class QGridLayout; |
@@ -13,8 +14,7 @@ class QLineEdit; | |||
13 | class QPushButton; | 14 | class QPushButton; |
14 | class Config; | 15 | class Config; |
15 | 16 | ||
16 | class MediumMountGui : public QDialog | 17 | class MediumMountGui : public QDialog { |
17 | { | ||
18 | Q_OBJECT | 18 | Q_OBJECT |
19 | 19 | ||
20 | public: | 20 | public: |