diff options
author | Arno <am@disconnect.de> | 2012-03-24 13:10:58 +0100 |
---|---|---|
committer | Arno <am@disconnect.de> | 2012-03-24 13:10:58 +0100 |
commit | 0cb256f573377feb234d62241506c5dd0a23eedd (patch) | |
tree | 6e454306bdf1d084a9f3ce739f69559d99c9847c | |
parent | 1072b045a4aca7b87c51355370c994303a9621f6 (diff) | |
download | SheMov-0cb256f573377feb234d62241506c5dd0a23eedd.tar.gz SheMov-0cb256f573377feb234d62241506c5dd0a23eedd.tar.bz2 SheMov-0cb256f573377feb234d62241506c5dd0a23eedd.zip |
ConfigurationDialog fixes and cleanup
Fix: Put tabs movies and database into a QGroupBox
Cleanup: use QFormLayout instead of QGridLayout where possible.
Precursor for making PictureViewer2 configurable.
-rw-r--r-- | configurationdialog.cpp | 88 |
1 files changed, 35 insertions, 53 deletions
diff --git a/configurationdialog.cpp b/configurationdialog.cpp index 717e510..cd353da 100644 --- a/configurationdialog.cpp +++ b/configurationdialog.cpp @@ -10,6 +10,7 @@ #include <QHBoxLayout> #include <QVBoxLayout> #include <QGridLayout> +#include <QFormLayout> #include <QLineEdit> #include <QLabel> #include <QComboBox> @@ -53,59 +54,41 @@ ConfigurationDialog::ConfigurationDialog(QWidget *parent, Qt::WindowFlags f) : S //directories QWidget *pathWidget = new QWidget; QGroupBox *pathBox = new QGroupBox(tr("Paths")); - QGridLayout *pathGrid = new QGridLayout; - QLabel *pathl1 = new QLabel(tr("Archive directory")); + QFormLayout *pathL = new QFormLayout; mArchiveDir = new QLineEdit; mArchiveDir->setCompleter(fsCompleter); - pathGrid->addWidget(pathl1, 0, 0); - pathGrid->addWidget(mArchiveDir, 0, 1); - QLabel *pathl2 = new QLabel(tr("Burn Directory")); + pathL->addRow(tr("Archive directory"), mArchiveDir); mBurnDir = new QLineEdit; mBurnDir->setCompleter(fsCompleter); - pathGrid->addWidget(pathl2, 1, 0); - pathGrid->addWidget(mBurnDir, 1, 1); - QLabel *pathl3 = new QLabel(tr("Path to ffprobe")); + pathL->addRow(tr("Burn directory"), mBurnDir); mFfProbePath = new QLineEdit; mFfProbePath->setCompleter(fsCompleter); - pathGrid->addWidget(pathl3, 2, 0); - pathGrid->addWidget(mFfProbePath, 2, 1); - QLabel *pathl4 = new QLabel(tr("Path to ffmpeg")); + pathL->addRow(tr("Path to ffprobe"), mFfProbePath); mFfMpegPath = new QLineEdit; mFfMpegPath->setCompleter(fsCompleter); - pathGrid->addWidget(pathl4, 3, 0); - pathGrid->addWidget(mFfMpegPath, 3, 1); - QLabel *pathl5 = new QLabel(tr("DVD mount directory")); + pathL->addRow(tr("Path to ffmpeg"), mFfMpegPath); mDvdMountPath = new QLineEdit; - pathGrid->addWidget(pathl5, 4, 0); - pathGrid->addWidget(mDvdMountPath, 4, 1); - QLabel *pathl6 = new QLabel(tr("Cover directory")); + pathL->addRow(tr("DVD mount directory"), mDvdMountPath); mCoverPath = new QLineEdit; mCoverPath->setCompleter(fsCompleter); - pathGrid->addWidget(pathl6, 5, 0); - pathGrid->addWidget(mCoverPath, 5, 1); - pathGrid->setAlignment(Qt::AlignTop); - pathBox->setLayout(pathGrid); + pathL->addRow(tr("Cover directory"), mCoverPath); + pathBox->setLayout(pathL); QVBoxLayout *pathLayout = new QVBoxLayout; pathLayout->addWidget(pathBox); pathWidget->setLayout(pathLayout); //copy path options QGroupBox *copyBox = new QGroupBox(tr("Copy path options")); - QGridLayout *copyGrid = new QGridLayout; - QLabel *pathl7 = new QLabel(tr("Windows drive")); + QFormLayout *copyL = new QFormLayout; mWindowsDrive = new QLineEdit; QRegExp pathValid("[a-z]{1}:"); pathValid.setCaseSensitivity(Qt::CaseInsensitive); QRegExpValidator *pathValidator = new QRegExpValidator(pathValid, this); mWindowsDrive->setValidator(pathValidator); - copyGrid->addWidget(pathl7, 0, 0); - copyGrid->addWidget(mWindowsDrive, 0, 1); - QLabel *pathl8 = new QLabel(tr("Strip from path")); + copyL->addRow(tr("Windows drive"), mWindowsDrive); mStripPath = new QLineEdit; - copyGrid->addWidget(pathl8, 1, 0); - copyGrid->addWidget(mStripPath, 1, 1); - copyGrid->setAlignment(Qt::AlignTop); - copyBox->setLayout(copyGrid); + copyL->addRow(tr("Strip from path"), mStripPath); + copyBox->setLayout(copyL); pathLayout->addWidget(copyBox); mTab->addTab(pathWidget, tr("Directories")); @@ -178,8 +161,16 @@ ConfigurationDialog::ConfigurationDialog(QWidget *parent, Qt::WindowFlags f) : S mTab->addTab(miscWidget, tr("Misc. settings")); // movie viewer + QGroupBox *movieBox = new QGroupBox(tr("Movie viewer")); + QHBoxLayout *movieBoxLayout = new QHBoxLayout; mMovieConfig = new ProgramConfigurator("movieviewer", "Movie viewer"); - mTab->addTab(mMovieConfig, tr("Movies")); + movieBoxLayout->addWidget(mMovieConfig); + movieBox->setLayout(movieBoxLayout); + QWidget *movieWidget = new QWidget; + QVBoxLayout *movieWidgetLayout = new QVBoxLayout; + movieWidgetLayout->addWidget(movieBox); + movieWidget->setLayout(movieWidgetLayout); + mTab->addTab(movieWidget, tr("Movies")); // picture viewer QGroupBox *picViewerBox = new QGroupBox(tr("Picture viewer options (external)")); @@ -202,32 +193,23 @@ ConfigurationDialog::ConfigurationDialog(QWidget *parent, Qt::WindowFlags f) : S mTab->addTab(picViewerWidget, tr("Pictures")); //database tab - QWidget *databaseWidget = new QWidget; - QGridLayout *dbGrid = new QGridLayout; - QLabel *dbl1 = new QLabel(tr("Database &host")); + QFormLayout *dbFormL = new QFormLayout; mDatabaseHost = new QLineEdit; - dbl1->setBuddy(mDatabaseHost); - dbGrid->addWidget(dbl1, 0, 0); - dbGrid->addWidget(mDatabaseHost, 0, 1); - QLabel *dbl2 = new QLabel(tr("Database &name")); + dbFormL->addRow(tr("Database &host"), mDatabaseHost); mDatabaseName = new QLineEdit; - dbl2->setBuddy(mDatabaseName); - dbGrid->addWidget(dbl2, 1, 0); - dbGrid->addWidget(mDatabaseName, 1, 1); - QLabel *dbl3 = new QLabel(tr("Database &user")); + dbFormL->addRow(tr("Database &name"), mDatabaseName); mDatabaseUsername = new QLineEdit; - dbl3->setBuddy(mDatabaseUsername); - dbGrid->addWidget(dbl3, 2, 0); - dbGrid->addWidget(mDatabaseUsername, 2, 1); - QLabel *dbl4 = new QLabel(tr("Database &password")); - mDatabasePassword = new QLineEdit; - dbl4->setBuddy(mDatabasePassword); + dbFormL->addRow(tr("Database &user"), mDatabaseUsername); + mDatabasePassword = new QLineEdit; mDatabasePassword->setEchoMode(QLineEdit::Password); - dbGrid->addWidget(dbl4, 3, 0); - dbGrid->addWidget(mDatabasePassword, 3, 1); - dbGrid->addLayout(new QHBoxLayout, 4, 0, 2, 4); - databaseWidget->setLayout(dbGrid); - mTab->addTab(databaseWidget, tr("Database")); + dbFormL->addRow(tr("Database &password"), mDatabasePassword); + QGroupBox *dbBox = new QGroupBox(tr("Database connection")); + dbBox->setLayout(dbFormL); + QWidget *dbWidget = new QWidget; + QVBoxLayout *dbWidgetLayout = new QVBoxLayout; + dbWidgetLayout->addWidget(dbBox); + dbWidget->setLayout(dbWidgetLayout); + mTab->addTab(dbWidget, tr("Database")); //colors tab QWidget *colorsWidget = new QWidget; |