summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-03-22 14:42:44 (UTC)
committer harlekin <harlekin>2002-03-22 14:42:44 (UTC)
commit10b7c4b15d5a5a7cdbf6ab800b0911ffc67e8e7a (patch) (unidiff)
tree19fa28e991f5483c49548473997cf156ee12af55
parent72341ed4c9a872004c89186a56833c5fe61d48d3 (diff)
downloadopie-10b7c4b15d5a5a7cdbf6ab800b0911ffc67e8e7a.zip
opie-10b7c4b15d5a5a7cdbf6ab800b0911ffc67e8e7a.tar.gz
opie-10b7c4b15d5a5a7cdbf6ab800b0911ffc67e8e7a.tar.bz2
gui on media mount
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/mediummountgui.cpp165
-rw-r--r--core/launcher/mediummountgui.h63
2 files changed, 228 insertions, 0 deletions
diff --git a/core/launcher/mediummountgui.cpp b/core/launcher/mediummountgui.cpp
new file mode 100644
index 0000000..0be90e6
--- a/dev/null
+++ b/core/launcher/mediummountgui.cpp
@@ -0,0 +1,165 @@
1
2#include "mediummountgui.h"
3
4#include <qvariant.h>
5#include <qcheckbox.h>
6#include <qgroupbox.h>
7#include <qlabel.h>
8#include <qlineedit.h>
9#include <qpushbutton.h>
10#include <qlayout.h>
11#include <qtooltip.h>
12#include <qwhatsthis.h>
13#include <qimage.h>
14#include <qpixmap.h>
15
16#include <qpe/resource.h>
17#include <opie/oconfig.h>
18
19
20#include <qapplication.h>
21
22
23MediumMountGui::MediumMountGui( const QString &path ,QWidget* parent, const char* name, WFlags fl )
24 : QWidget( parent, name, fl ) {
25
26 QWidget *d = QApplication::desktop();
27 int w=d->width();
28 int h=d->height();
29 resize( w , h );
30 setCaption( tr( "Medium inserted" ) );
31
32 mediumPath = path;
33 readConfig();
34 startGui();
35}
36
37void MediumMountGui::readConfig(){
38
39 OConfig cfg (mediumPath +"/.opiestorage.cf");
40 cfg.setGroup("main");
41 checkagain = cfg.readBoolEntry("check", false);
42
43 cfg.setGroup("mimetypes");
44 checkmimeaudio = cfg.readBoolEntry("audio", false);
45 checkmimeimage = cfg.readBoolEntry("image", true);
46 checkmimetext = cfg.readBoolEntry("text", true);
47 checkmimevideo = cfg.readBoolEntry("video", true);
48
49 cfg.setGroup("dirs");
50 limittodirs = cfg.readEntry("dirs", "/");
51}
52
53bool MediumMountGui::check() {
54 return checkagain;
55}
56
57
58void MediumMountGui::writeConfig() {
59
60 OConfig cfg (mediumPath +"/.opiestorage.cf");
61 cfg.setGroup("main");
62 cfg.writeEntry("check", AskBox->isChecked() );
63
64 cfg.setGroup("mimetypes");
65 cfg.writeEntry("audio", CheckBoxAudio->isChecked() );
66 cfg.writeEntry("image",CheckBoxImage->isChecked() );
67 cfg.writeEntry("text",CheckBoxImage->isChecked() );
68 cfg.writeEntry("video",CheckBoxVideo->isChecked() );
69
70 cfg.setGroup("dirs");
71 cfg.writeEntry("dirs", "/");
72}
73
74void MediumMountGui::startGui() {
75
76 QPixmap image = Resource::loadPixmap( "HelpBrowser");
77
78 Text_2 = new QLabel( this );
79 Text_2->setGeometry( QRect( 10, 15, 40, 40 ) );
80 Text_2->setPixmap( image );
81
82 Text = new QLabel( this, "Text" );
83 Text->setGeometry( QRect( 55, 11, this->width()-50, 50 ) );
84 Text->setText( tr( "A <b>storage medium</b> was inserted. Should it be scanned for media files?" ) );
85
86 // media box
87 GroupBox1 = new QGroupBox( this, "GroupBox1" );
88 GroupBox1->setGeometry( QRect( 10, 80, (this->width())-25, 60 ) );
89 GroupBox1->setTitle( tr( "Which media files" ) );
90
91 CheckBoxAudio = new QCheckBox( GroupBox1, "CheckBoxAudio" );
92 CheckBoxAudio->setGeometry( QRect( 10, 15, (GroupBox1->width()/2)-15 , 15 ) );
93 CheckBoxAudio->setText( tr( "Audio" ) );
94
95 CheckBoxImage = new QCheckBox( GroupBox1, "CheckBoxImage" );
96 CheckBoxImage->setGeometry( QRect( 10, 35,(GroupBox1->width()/2)-15, 15 ) );
97 CheckBoxImage->setText( tr( "Image" ) );
98
99 CheckBoxText = new QCheckBox( GroupBox1, "CheckBoxText" );
100 CheckBoxText->setGeometry( QRect((GroupBox1->width()/2) , 15, (GroupBox1->width()/2)-15, 15 ) );
101 CheckBoxText->setText( tr( "Text" ) );
102
103 CheckBoxVideo = new QCheckBox( GroupBox1, "CheckBoxVideo" );
104 CheckBoxVideo->setGeometry( QRect( (GroupBox1->width()/2), 35, (GroupBox1->width()/2)-15, 15 ) );
105 CheckBoxVideo->setText( tr( "Video" ) );
106
107 // select dirs
108
109 DirSelectText = new QLabel( this, "DirSelectText" );
110 DirSelectText->setGeometry( QRect( 10, 160,this->width() , 20 ) );
111 DirSelectText->setText( tr( "Limit search to dir: (not used yet)" ) );
112
113 LineEdit1 = new QLineEdit( this );
114 LineEdit1->setGeometry( QRect( 10, 180, (this->width())-60, 20 ) );
115
116 PushButton3 = new QPushButton( this );
117 PushButton3->setGeometry( QRect( (this->width())-40, 180, 30, 20 ) );
118 PushButton3->setText( tr( "Add" ) );
119
120
121 // decision
122 DirSelectText_2 = new QLabel( this );
123 DirSelectText_2->setGeometry( QRect( 10,240,this->width(), 15 ) );
124 DirSelectText_2->setText( tr( "Your decision will be stored on the medium." ) );
125
126 // ask again
127 AskBox = new QCheckBox( this );
128 AskBox->setGeometry( QRect( 10, 215, (this->width())-15 , 15 ) );
129 AskBox->setText( tr( "Do not ask again for this medium" ) );
130
131
132 AskBox->setChecked(checkagain);
133 CheckBoxAudio->setChecked(checkmimeaudio);
134 CheckBoxImage->setChecked(checkmimeimage);
135 CheckBoxText->setChecked(checkmimetext);
136 CheckBoxVideo->setChecked(checkmimevideo);
137
138 // buttons
139 quit = new QPushButton( this );
140 quit->setGeometry( QRect( (this->width()/2)- 90 , 260, 80, 22 ) );
141 quit->setFocus();
142 quit->setText( tr( "Yes" ) );
143
144 quit_2 = new QPushButton( this );
145 quit_2->setGeometry( QRect((this->width()/2) , 260, 80, 22 ) );
146 quit_2->setText( tr( "No" ) );
147
148 QObject::connect( (QObject*)quit, SIGNAL( clicked() ), this, SLOT(yesPressed() ) );
149 QObject::connect( (QObject*)quit_2, SIGNAL( clicked() ), this, SLOT(noPressed() ) );
150
151
152}
153
154void MediumMountGui::yesPressed() {
155 writeConfig();
156 // and do something
157}
158
159void MediumMountGui::noPressed() {
160 close();
161}
162
163MediumMountGui::~MediumMountGui(){
164}
165
diff --git a/core/launcher/mediummountgui.h b/core/launcher/mediummountgui.h
new file mode 100644
index 0000000..0da2803
--- a/dev/null
+++ b/core/launcher/mediummountgui.h
@@ -0,0 +1,63 @@
1#ifndef MEDIUMMOUNTGUI_H
2#define MEDIUMMOUNTGUI_H
3
4#include <qvariant.h>
5#include <qwidget.h>
6class QVBoxLayout;
7class QHBoxLayout;
8class QGridLayout;
9class QCheckBox;
10class QGroupBox;
11class QLabel;
12class QLineEdit;
13class QPushButton;
14
15class MediumMountGui : public QWidget
16{
17 Q_OBJECT
18
19public:
20 MediumMountGui( const QString &path = "/tmp/", QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
21 ~MediumMountGui();
22
23protected:
24 QPushButton* quit;
25 QPushButton* quit_2;
26 QLabel* DirSelectText_2;
27 QLineEdit* LineEdit1;
28 QPushButton* PushButton3;
29 QLabel* DirSelectText;
30 QLabel* Text_2;
31 QLabel* Text;
32 QGroupBox* GroupBox1;
33 QCheckBox* CheckBoxAudio;
34 QCheckBox* CheckBoxImage;
35 QCheckBox* CheckBoxText;
36 QCheckBox* CheckBoxVideo;
37 QCheckBox* AskBox;
38
39public:
40 bool check();
41
42private:
43 void startGui();
44 void readConfig();
45 void writeConfig();
46
47private slots:
48 void yesPressed();
49 void noPressed();
50private:
51 QString mediumPath;
52
53 bool checkagain;
54 bool checkmimeaudio;
55 bool checkmimeimage;
56 bool checkmimetext;
57 bool checkmimevideo;
58QString limittodirs;
59
60
61};
62
63#endif \ No newline at end of file