author | harlekin <harlekin> | 2003-03-23 14:17:43 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-23 14:17:43 (UTC) |
commit | dca448bad29f0afbab1fc0ffe493560fd927c1b5 (patch) (side-by-side diff) | |
tree | 178ab4781f5952f6e333659531cb7e0db0276f24 | |
parent | 013194659dde417767c62ab2fe18b09ea21558eb (diff) | |
download | opie-dca448bad29f0afbab1fc0ffe493560fd927c1b5.zip opie-dca448bad29f0afbab1fc0ffe493560fd927c1b5.tar.gz opie-dca448bad29f0afbab1fc0ffe493560fd927c1b5.tar.bz2 |
a dialog now x does not save ok saves, also some layout changes
-rw-r--r-- | noncore/settings/mediummount/mainwindow.cc | 28 | ||||
-rw-r--r-- | noncore/settings/mediummount/mainwindow.h | 7 | ||||
-rw-r--r-- | noncore/settings/mediummount/mediumglobal.cc | 13 | ||||
-rw-r--r-- | noncore/settings/mediummount/mediumglobal.h | 3 | ||||
-rw-r--r-- | noncore/settings/mediummount/mediumwidget.cc | 2 | ||||
-rw-r--r-- | noncore/settings/mediummount/mediumwidget.h | 3 |
6 files changed, 37 insertions, 19 deletions
diff --git a/noncore/settings/mediummount/mainwindow.cc b/noncore/settings/mediummount/mainwindow.cc index 6d9bb80..bfd1e21 100644 --- a/noncore/settings/mediummount/mainwindow.cc +++ b/noncore/settings/mediummount/mainwindow.cc @@ -1,57 +1,75 @@ #include <qtabwidget.h> #include <qlayout.h> +#include <qtooltip.h> +#include <qwhatsthis.h> #include <qpe/storage.h> #include "mediumwidget.h" #include "mediumglobal.h" #include "mainwindow.h" using namespace MediumMountSetting; -MainWindow::MainWindow( QWidget *parent, const char *name, WFlags ) - : QMainWindow( parent, name, WStyle_ContextHelp ) +MainWindow::MainWindow( QWidget *parent, const char *name, bool modal, WFlags ) + : QDialog( parent, name, modal, WStyle_ContextHelp ) { setCaption ( tr( "Medium Mount Settings" )); - // m_lay = new QVBoxLayout( this ); + m_lay = new QVBoxLayout( this ); + m_tab = new QTabWidget( this ); - setCentralWidget( m_tab ); + + m_lay->addWidget( m_tab ); + init(); } MainWindow::~MainWindow() { - } + void MainWindow::init() { m_global = new MediumGlobalWidget( m_tab, "test drive" ); m_tab->addTab( m_global, tr("Global") ); StorageInfo storage; const QList<FileSystem> &fs = storage.fileSystems(); QListIterator<FileSystem> it( fs ); MediumMountWidget *wid; for( ; it.current(); ++it ){ if( (*it)->isRemovable() ){ wid = new MediumMountWidget((*it)->path(), QPixmap(), m_tab ); m_mediums.append( wid ); m_tab->addTab( wid, (*it)->name() ); } } } +void MainWindow::accept() +{ + m_global->writeConfig(); + + MediumMountWidget *confWidget; + for ( confWidget = m_mediums.first(); confWidget != 0; + confWidget = m_mediums.next() ) { + confWidget->writeConfig(); + } + + QDialog::accept(); +} + void MainWindow::slotGlobalChanged(int ) { } void MainWindow::slotCheckingChanged(int ) { } diff --git a/noncore/settings/mediummount/mainwindow.h b/noncore/settings/mediummount/mainwindow.h index ce54674..9c648ef 100644 --- a/noncore/settings/mediummount/mainwindow.h +++ b/noncore/settings/mediummount/mainwindow.h @@ -1,33 +1,34 @@ #ifndef MediumMountMainwindow_h #define MediumMountMainwindow_h #include <qlist.h> -#include <qmainwindow.h> +#include <qdialog.h> class QVBoxLayout; class QTabWidget; namespace MediumMountSetting { class MediumMountWidget; class MediumGlobalWidget; - class MainWindow : public QMainWindow { + class MainWindow : public QDialog { Q_OBJECT public: - MainWindow(QWidget *parent = 0, const char *name = 0 , WFlags = 0); + MainWindow(QWidget *parent = 0, const char *name = 0 , bool modal = FALSE, WFlags = 0); ~MainWindow(); private slots: void slotGlobalChanged(int ); void slotCheckingChanged(int ); + void accept(); private: void init(); QTabWidget *m_tab; QVBoxLayout *m_lay; MediumGlobalWidget *m_global; QList<MediumMountWidget> m_mediums; }; }; #endif diff --git a/noncore/settings/mediummount/mediumglobal.cc b/noncore/settings/mediummount/mediumglobal.cc index fa4171c..46d3343 100644 --- a/noncore/settings/mediummount/mediumglobal.cc +++ b/noncore/settings/mediummount/mediumglobal.cc @@ -7,36 +7,36 @@ #include <qlayout.h> #include <qframe.h> #include <qgroupbox.h> #include <qwhatsthis.h> #include <qpe/config.h> #include "mediumglobal.h" using namespace MediumMountSetting; MediumGlobalWidget::MediumGlobalWidget(QWidget *wid, const char *name ) - : QWidget( wid, name ) + : QWidget( wid, name, WStyle_ContextHelp ) { m_config = 0; initGUI(); readConfig(); } void MediumGlobalWidget::initGUI() { m_layout = new QVBoxLayout(this ); - m_layout->setMargin( 10 ); - m_layout->setSpacing( 10 ); + // m_layout->setMargin( 10 ); + // m_layout->setSpacing( 10 ); m_label = new QLabel( this ); m_label->setTextFormat( Qt::RichText ); m_label->setText( tr("") ); QWhatsThis::add( this, tr("If a medium gets inserted into this device Opie " "tries to search the medium for Documents. On " "large mediums this can take some time. You can choose " "if Opie should scan for Documents globally or on a " "per medium level. You're also able to reconfigure " "each medium.") ); @@ -52,49 +52,49 @@ void MediumGlobalWidget::initGUI() m_frame->setFrameShadow( QFrame::Sunken ); m_box = new QVBoxLayout( m_frame ); m_box->setMargin( 5 ); m_useglobal = new QCheckBox( tr("Use global settings"), m_frame ); connect( m_useglobal, SIGNAL( stateChanged(int) ), this, SLOT( slotGlobalChanged() ) ); m_box->addWidget( m_useglobal ); m_global = new QGroupBox( tr("Which media files"), m_frame ); m_frameLay = new QGridLayout(m_global, 4, 3 ); - m_frameLay->setMargin( 12 ); + m_frameLay->setMargin( 6 ); QSpacerItem *item2 = new QSpacerItem( 5, 8, QSizePolicy::Fixed, QSizePolicy::Fixed ); m_audio = new QCheckBox( tr("Audio"), m_global ); m_all = new QCheckBox( tr("All") , m_global ); m_image = new QCheckBox( tr("Image"), m_global ); m_text = new QCheckBox( tr("Text") , m_global ); m_video = new QCheckBox( tr("Video"), m_global ); connect(m_all, SIGNAL(stateChanged(int) ), this, SLOT(slotAllChanged() ) ); m_frameLay->addItem( item2, 0, 0 ); m_frameLay->addWidget( m_audio, 1, 0 ); m_frameLay->addWidget( m_image, 2, 0 ); m_frameLay->addWidget( m_all, 3, 0 ); m_frameLay->addWidget( m_text, 1, 2 ); m_frameLay->addWidget( m_video, 2, 2 ); - m_frameLay->addRowSpacing( 0, 8 ); - m_frameLay->addColSpacing( 1, 2 ); +// m_frameLay->addRowSpacing( 0, 8 ); +// m_frameLay->addColSpacing( 1, 2 ); m_box->addWidget( m_global ); m_layout->addWidget( m_frame ); QSpacerItem *item1 = new QSpacerItem( 1, 24, QSizePolicy::Fixed, QSizePolicy::Expanding ); m_layout->addItem( item1 ); } void MediumGlobalWidget::readConfig() @@ -131,25 +131,24 @@ void MediumGlobalWidget::writeConfig() m_config->writeEntry("use", m_check->isChecked() ); m_config->setGroup("mimetypes" ); m_config->writeEntry("all", m_all->isChecked() ); m_config->writeEntry("audio", m_audio->isChecked() ); m_config->writeEntry("video", m_video->isChecked() ); m_config->writeEntry("text", m_text->isChecked() ); m_config->writeEntry("image", m_image->isChecked() ); } MediumGlobalWidget::~MediumGlobalWidget() { - writeConfig(); delete m_config; } void MediumGlobalWidget::slotGlobalChanged() { int mode = GLOBAL_DISABLED; bool enabled = false; if( ( enabled =m_useglobal->isChecked() ) ){ mode = GLOBAL_ENABLED; }else mode = GLOBAL_DISABLED; qWarning("enabled = %d", enabled ); m_all->setEnabled ( enabled ); diff --git a/noncore/settings/mediummount/mediumglobal.h b/noncore/settings/mediummount/mediumglobal.h index 7b3cea0..ea1f0df 100644 --- a/noncore/settings/mediummount/mediumglobal.h +++ b/noncore/settings/mediummount/mediumglobal.h @@ -14,37 +14,38 @@ class QVBoxLayout; class QGridLayout; class QLabel; namespace MediumMountSetting { enum States { GLOBAL_ENABLED = 0, GLOBAL_DISABLED }; enum Checks { ENABLE_CHECKS = 0, DISABLE_CHECKS }; class MediumGlobalWidget : public QWidget { Q_OBJECT public: MediumGlobalWidget(QWidget *parent = 0, const char *name =0 ); ~MediumGlobalWidget(); + + void writeConfig(); signals: // the global status changed void globalStateChanged( int ); void enableStateChanged( int ); private slots: void slotGlobalChanged(); void slotEnableChecking(); void slotAllChanged(); private: void initGUI(); void readConfig(); - void writeConfig(); Config *m_config; QCheckBox *m_check; QCheckBox *m_useglobal; QGroupBox *m_global; QCheckBox *m_all; QCheckBox *m_audio; QCheckBox *m_video; QCheckBox *m_text; QCheckBox *m_image; diff --git a/noncore/settings/mediummount/mediumwidget.cc b/noncore/settings/mediummount/mediumwidget.cc index 04e4e7c..f98e637 100644 --- a/noncore/settings/mediummount/mediumwidget.cc +++ b/noncore/settings/mediummount/mediumwidget.cc @@ -162,29 +162,27 @@ void MediumMountWidget::writeConfig() m_config->setGroup("mimetypes" ); if(m_all->isChecked() ){ m_config->writeEntry("all", true ); }else{ m_config->writeEntry("audio", m_audio->isChecked() ); m_config->writeEntry("image", m_image->isChecked() ); m_config->writeEntry("text" , m_text->isChecked() ); m_config->writeEntry("video", m_video->isChecked() ); } } MediumMountWidget::~MediumMountWidget() { - writeConfig(); delete m_config; } - void MediumMountWidget::slotAdd() { } void MediumMountWidget::slotStateChanged() { bool state = !(m_all->isChecked()); m_audio->setEnabled( state ); m_text->setEnabled ( state ); m_video->setEnabled( state ); m_image->setEnabled( state ); diff --git a/noncore/settings/mediummount/mediumwidget.h b/noncore/settings/mediummount/mediumwidget.h index 7a801eb..7f7b755 100644 --- a/noncore/settings/mediummount/mediumwidget.h +++ b/noncore/settings/mediummount/mediumwidget.h @@ -18,32 +18,33 @@ class QGroupBox; class QVBox; class QHBox; class QLineEdit; namespace MediumMountSetting { class MediumMountWidget : public QWidget { Q_OBJECT public: MediumMountWidget(const QString&, const QPixmap &, QWidget *parent, const char *name = 0 ); ~MediumMountWidget(); + void writeConfig(); + private slots: void slotAdd(); void slotStateChanged(); private: void readConfig(); void initGUI(); - void writeConfig(); bool m_dirty : 1; class MediumMountWidgetPrivate; MediumMountWidgetPrivate *d; QString m_path; Config *m_config; QHBox *m_infoBox; QLabel *m_label; |