author | llornkcor <llornkcor> | 2002-10-26 15:29:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-10-26 15:29:10 (UTC) |
commit | ec58c37763a97306543a3f18052d37291b1cdf83 (patch) (unidiff) | |
tree | b510f605a4a1e924b794c107c37a0393699363c7 | |
parent | 705007194478a84399d36b0919df20f23ae1b546 (diff) | |
download | opie-ec58c37763a97306543a3f18052d37291b1cdf83.zip opie-ec58c37763a97306543a3f18052d37291b1cdf83.tar.gz opie-ec58c37763a97306543a3f18052d37291b1cdf83.tar.bz2 |
changed text label to whats this, and added tr
-rw-r--r-- | noncore/settings/mediummount/mediumwidget.cc | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/noncore/settings/mediummount/mediumwidget.cc b/noncore/settings/mediummount/mediumwidget.cc index f9cac8b..9fc608b 100644 --- a/noncore/settings/mediummount/mediumwidget.cc +++ b/noncore/settings/mediummount/mediumwidget.cc | |||
@@ -1,190 +1,192 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include <qcheckbox.h> | 3 | #include <qcheckbox.h> |
4 | #include <qgroupbox.h> | 4 | #include <qgroupbox.h> |
5 | #include <qhbox.h> | 5 | #include <qhbox.h> |
6 | #include <qlabel.h> | 6 | #include <qlabel.h> |
7 | #include <qabstractlayout.h> | 7 | #include <qabstractlayout.h> |
8 | #include <qlayout.h> | 8 | #include <qlayout.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qpixmap.h> | 10 | #include <qpixmap.h> |
11 | #include <qpushbutton.h> | 11 | #include <qpushbutton.h> |
12 | #include <qvbox.h> | 12 | #include <qvbox.h> |
13 | #include <qwhatsthis.h> | ||
13 | 14 | ||
14 | 15 | ||
15 | #include <qpe/config.h> | 16 | #include <qpe/config.h> |
16 | #include <qpe/qpeapplication.h> | 17 | #include <qpe/qpeapplication.h> |
17 | 18 | ||
18 | #include "mediumwidget.h" | 19 | #include "mediumwidget.h" |
19 | 20 | ||
20 | 21 | ||
21 | 22 | ||
22 | using namespace MediumMountSetting; | 23 | using namespace MediumMountSetting; |
23 | 24 | ||
24 | MediumMountWidget::MediumMountWidget(const QString &path, | 25 | MediumMountWidget::MediumMountWidget(const QString &path, |
25 | const QPixmap &pix, | 26 | const QPixmap &pix, |
26 | QWidget *parent, | 27 | QWidget *parent, |
27 | const char *name ) | 28 | const char *name ) |
28 | : QWidget( parent, name ) | 29 | : QWidget( parent, name ) |
29 | { | 30 | { |
30 | if(parent == 0){ | 31 | if(parent == 0){ |
31 | resize(QApplication::desktop()->width(), QApplication::desktop()->height() ); | 32 | resize(QApplication::desktop()->width(), QApplication::desktop()->height() ); |
32 | }else{ | 33 | }else{ |
33 | resize(parent->width(), parent->height() ); | 34 | resize(parent->width(), parent->height() ); |
34 | } | 35 | } |
35 | m_path = path; | 36 | m_path = path; |
36 | initGUI(); | 37 | initGUI(); |
37 | m_label->setPixmap(pix ); | 38 | m_label->setPixmap(pix ); |
38 | m_config = 0; | 39 | m_config = 0; |
39 | 40 | ||
40 | readConfig(); | 41 | readConfig(); |
41 | } | 42 | } |
42 | // now we fire up the GUI | 43 | // now we fire up the GUI |
43 | // if I would know what I'm doing ;) | 44 | // if I would know what I'm doing ;) |
44 | void MediumMountWidget::initGUI() | 45 | void MediumMountWidget::initGUI() |
45 | { | 46 | { |
46 | //main layout | 47 | //main layout |
47 | m_box = new QVBoxLayout( this , 5, 5 ); | 48 | m_box = new QVBoxLayout( this , 5, 5 ); |
48 | m_box->setSpacing( 5 ); | 49 | m_box->setSpacing( 5 ); |
49 | //m_box->addStretch( -1 ); | 50 | //m_box->addStretch( -1 ); |
50 | 51 | ||
51 | // picture + text | 52 | // picture + text |
52 | m_infoBox = new QHBox(this, "infobox" ); | 53 | m_infoBox = new QHBox(this, "infobox" ); |
53 | m_infoBox->setSpacing( 4 ); | 54 | m_infoBox->setSpacing( 4 ); |
54 | m_label = new QLabel(m_infoBox ); | 55 | m_label = new QLabel(m_infoBox ); |
55 | m_desc = new QLabel(m_infoBox ); | 56 | m_desc = new QLabel(m_infoBox ); |
56 | m_desc->setTextFormat( Qt::RichText ); | 57 | m_desc->setTextFormat( Qt::RichText ); |
57 | m_desc->setText("Configure this medium. The changes will" | 58 | QWhatsThis::add( this, tr("Configure this medium. The changes will" |
58 | " go into effect when the application get's" | 59 | " go into effect when the application get's" |
59 | " closed. To update the Document Tab you need" | 60 | " closed. To update the Document Tab you need" |
60 | " to removeand insert this medium." ); | 61 | " to removeand insert this medium.")); |
62 | m_desc->setText("" ); | ||
61 | m_box->addWidget( m_infoBox ); // add the widget to the layout | 63 | m_box->addWidget( m_infoBox ); // add the widget to the layout |
62 | 64 | ||
63 | 65 | ||
64 | // groupbox | 66 | // groupbox |
65 | m_group = new QGroupBox(tr("Which media files"), this, "MediaFiles" ); | 67 | m_group = new QGroupBox(tr("Which media files"), this, "MediaFiles" ); |
66 | m_checks = new QGridLayout( m_group, 4, 3 ); | 68 | m_checks = new QGridLayout( m_group, 4, 3 ); |
67 | m_checks->setMargin( 12 ); | 69 | m_checks->setMargin( 12 ); |
68 | 70 | ||
69 | 71 | ||
70 | 72 | ||
71 | QSpacerItem *item2 = new QSpacerItem(5, 8, | 73 | QSpacerItem *item2 = new QSpacerItem(5, 8, |
72 | QSizePolicy::Fixed, | 74 | QSizePolicy::Fixed, |
73 | QSizePolicy::Fixed); | 75 | QSizePolicy::Fixed); |
74 | m_box->addItem( item2 ); | 76 | m_box->addItem( item2 ); |
75 | 77 | ||
76 | m_audio = new QCheckBox( tr("Audio"), m_group ); | 78 | m_audio = new QCheckBox( tr("Audio"), m_group ); |
77 | m_all = new QCheckBox( tr("All") , m_group ); | 79 | m_all = new QCheckBox( tr("All") , m_group ); |
78 | m_image = new QCheckBox( tr("Image"), m_group ); | 80 | m_image = new QCheckBox( tr("Image"), m_group ); |
79 | m_text = new QCheckBox( tr("Text") , m_group ); | 81 | m_text = new QCheckBox( tr("Text") , m_group ); |
80 | m_video = new QCheckBox( tr("Video"), m_group ); | 82 | m_video = new QCheckBox( tr("Video"), m_group ); |
81 | 83 | ||
82 | QSpacerItem *iti1b = new QSpacerItem(2, 10, QSizePolicy::Fixed, | 84 | QSpacerItem *iti1b = new QSpacerItem(2, 10, QSizePolicy::Fixed, |
83 | QSizePolicy::Fixed ); | 85 | QSizePolicy::Fixed ); |
84 | m_checks->addItem( iti1b, 0, 0 ); | 86 | m_checks->addItem( iti1b, 0, 0 ); |
85 | 87 | ||
86 | m_checks->addWidget(m_audio, 1, 0 ); | 88 | m_checks->addWidget(m_audio, 1, 0 ); |
87 | m_checks->addWidget(m_image, 2, 0 ); | 89 | m_checks->addWidget(m_image, 2, 0 ); |
88 | m_checks->addWidget(m_all , 3, 0 ); | 90 | m_checks->addWidget(m_all , 3, 0 ); |
89 | 91 | ||
90 | m_checks->addWidget(m_text, 1, 2 ); | 92 | m_checks->addWidget(m_text, 1, 2 ); |
91 | m_checks->addWidget(m_video, 2, 2 ); | 93 | m_checks->addWidget(m_video, 2, 2 ); |
92 | 94 | ||
93 | m_checks->addRowSpacing(0, 8 ); | 95 | m_checks->addRowSpacing(0, 8 ); |
94 | m_checks->addColSpacing(1, 2 ); | 96 | m_checks->addColSpacing(1, 2 ); |
95 | m_checks->setColStretch(1, -2 ); | 97 | m_checks->setColStretch(1, -2 ); |
96 | 98 | ||
97 | connect(m_all, SIGNAL(stateChanged(int) ), | 99 | connect(m_all, SIGNAL(stateChanged(int) ), |
98 | this, SLOT(slotStateChanged() ) ); | 100 | this, SLOT(slotStateChanged() ) ); |
99 | 101 | ||
100 | m_box->addWidget( m_group ); | 102 | m_box->addWidget( m_group ); |
101 | 103 | ||
102 | // label | 104 | // label |
103 | m_lblPath = new QLabel(tr("Limit search to:"), this ); | 105 | m_lblPath = new QLabel(tr("Limit search to:"), this ); |
104 | m_box->addWidget( m_lblPath ); | 106 | m_box->addWidget( m_lblPath ); |
105 | 107 | ||
106 | // add to | 108 | // add to |
107 | m_hboxAdd = new QHBox( this ); | 109 | m_hboxAdd = new QHBox( this ); |
108 | m_hboxAdd->setSpacing( 10 ); | 110 | m_hboxAdd->setSpacing( 10 ); |
109 | m_edit = new QLineEdit(m_hboxAdd ); | 111 | m_edit = new QLineEdit(m_hboxAdd ); |
110 | m_add = new QPushButton(m_hboxAdd ); | 112 | m_add = new QPushButton(m_hboxAdd ); |
111 | m_add->setText( tr("Add") ); | 113 | m_add->setText( tr("Add") ); |
112 | 114 | ||
113 | m_box->addWidget(m_hboxAdd ); | 115 | m_box->addWidget(m_hboxAdd ); |
114 | 116 | ||
115 | m_always = new QCheckBox( tr("Always check this medium"), this ); | 117 | m_always = new QCheckBox( tr("Always check this medium"), this ); |
116 | 118 | ||
117 | m_box->addWidget( m_always ); | 119 | m_box->addWidget( m_always ); |
118 | 120 | ||
119 | QSpacerItem *item = new QSpacerItem(5, 50, | 121 | QSpacerItem *item = new QSpacerItem(5, 50, |
120 | QSizePolicy::Fixed, | 122 | QSizePolicy::Fixed, |
121 | QSizePolicy::Expanding ); | 123 | QSizePolicy::Expanding ); |
122 | m_box->addItem(item ); | 124 | m_box->addItem(item ); |
123 | } | 125 | } |
124 | 126 | ||
125 | void MediumMountWidget::readConfig( ) | 127 | void MediumMountWidget::readConfig( ) |
126 | { | 128 | { |
127 | if( m_config == 0 ) | 129 | if( m_config == 0 ) |
128 | m_config = new Config(m_path + "/.opiestorage.cf", Config::File ); | 130 | m_config = new Config(m_path + "/.opiestorage.cf", Config::File ); |
129 | m_config->setGroup( "main" ); | 131 | m_config->setGroup( "main" ); |
130 | 132 | ||
131 | m_always->setChecked( m_config->readBoolEntry("check", false) ); | 133 | m_always->setChecked( m_config->readBoolEntry("check", false) ); |
132 | 134 | ||
133 | m_config->setGroup( "mimetypes" ); | 135 | m_config->setGroup( "mimetypes" ); |
134 | if( m_config->readBoolEntry("all", false ) ){ | 136 | if( m_config->readBoolEntry("all", false ) ){ |
135 | m_audio->setEnabled( false ); | 137 | m_audio->setEnabled( false ); |
136 | m_image->setEnabled( false ); | 138 | m_image->setEnabled( false ); |
137 | m_text->setEnabled ( false ); | 139 | m_text->setEnabled ( false ); |
138 | m_video->setEnabled( false ); | 140 | m_video->setEnabled( false ); |
139 | m_all->setChecked( true ); | 141 | m_all->setChecked( true ); |
140 | }else{ | 142 | }else{ |
141 | m_audio->setEnabled( true ); | 143 | m_audio->setEnabled( true ); |
142 | m_image->setEnabled( true ); | 144 | m_image->setEnabled( true ); |
143 | m_text->setEnabled ( true ); | 145 | m_text->setEnabled ( true ); |
144 | m_all->setEnabled ( true ); | 146 | m_all->setEnabled ( true ); |
145 | 147 | ||
146 | m_all->setChecked( false ); | 148 | m_all->setChecked( false ); |
147 | 149 | ||
148 | m_audio->setChecked( m_config->readBoolEntry("audio", true ) ); | 150 | m_audio->setChecked( m_config->readBoolEntry("audio", true ) ); |
149 | m_image->setChecked( m_config->readBoolEntry("image", true ) ); | 151 | m_image->setChecked( m_config->readBoolEntry("image", true ) ); |
150 | m_text->setChecked ( m_config->readBoolEntry("text" , true ) ); | 152 | m_text->setChecked ( m_config->readBoolEntry("text" , true ) ); |
151 | m_video->setChecked( m_config->readBoolEntry("video", true ) ); | 153 | m_video->setChecked( m_config->readBoolEntry("video", true ) ); |
152 | }; | 154 | }; |
153 | } | 155 | } |
154 | 156 | ||
155 | void MediumMountWidget::writeConfig() | 157 | void MediumMountWidget::writeConfig() |
156 | { | 158 | { |
157 | m_config->setGroup("main"); | 159 | m_config->setGroup("main"); |
158 | m_config->writeEntry("check", m_always->isChecked() ); | 160 | m_config->writeEntry("check", m_always->isChecked() ); |
159 | 161 | ||
160 | m_config->setGroup("mimetypes" ); | 162 | m_config->setGroup("mimetypes" ); |
161 | if(m_all->isChecked() ){ | 163 | if(m_all->isChecked() ){ |
162 | m_config->writeEntry("all", true ); | 164 | m_config->writeEntry("all", true ); |
163 | }else{ | 165 | }else{ |
164 | m_config->writeEntry("audio", m_audio->isChecked() ); | 166 | m_config->writeEntry("audio", m_audio->isChecked() ); |
165 | m_config->writeEntry("image", m_image->isChecked() ); | 167 | m_config->writeEntry("image", m_image->isChecked() ); |
166 | m_config->writeEntry("text" , m_text->isChecked() ); | 168 | m_config->writeEntry("text" , m_text->isChecked() ); |
167 | m_config->writeEntry("video", m_video->isChecked() ); | 169 | m_config->writeEntry("video", m_video->isChecked() ); |
168 | } | 170 | } |
169 | } | 171 | } |
170 | MediumMountWidget::~MediumMountWidget() | 172 | MediumMountWidget::~MediumMountWidget() |
171 | { | 173 | { |
172 | writeConfig(); | 174 | writeConfig(); |
173 | delete m_config; | 175 | delete m_config; |
174 | } | 176 | } |
175 | 177 | ||
176 | 178 | ||
177 | void MediumMountWidget::slotAdd() | 179 | void MediumMountWidget::slotAdd() |
178 | { | 180 | { |
179 | 181 | ||
180 | } | 182 | } |
181 | void MediumMountWidget::slotStateChanged() | 183 | void MediumMountWidget::slotStateChanged() |
182 | { | 184 | { |
183 | bool state = !(m_all->isChecked()); | 185 | bool state = !(m_all->isChecked()); |
184 | 186 | ||
185 | m_audio->setEnabled( state ); | 187 | m_audio->setEnabled( state ); |
186 | m_text->setEnabled ( state ); | 188 | m_text->setEnabled ( state ); |
187 | m_video->setEnabled( state ); | 189 | m_video->setEnabled( state ); |
188 | m_image->setEnabled( state ); | 190 | m_image->setEnabled( state ); |
189 | 191 | ||
190 | } | 192 | } |