diff options
author | Arno <am@disconnect.de> | 2010-11-28 11:58:57 +0100 |
---|---|---|
committer | Arno <am@disconnect.de> | 2010-11-28 11:58:57 +0100 |
commit | d1837c9c92c9f38a464f0473001db4e9a57d44e7 (patch) | |
tree | 9d815a4c1e1c550871565c92d7e0c8f312f05f72 /configurationdialog.cpp | |
parent | eb4139c5c525c03d4c75c0a47acc92157008ca06 (diff) | |
download | SheMov-d1837c9c92c9f38a464f0473001db4e9a57d44e7.tar.gz SheMov-d1837c9c92c9f38a464f0473001db4e9a57d44e7.tar.bz2 SheMov-d1837c9c92c9f38a464f0473001db4e9a57d44e7.zip |
Added action to copy file path to clipboard
4 new actions to copy the file path to clipboard. It's either the unix
full path, the unix dir, the windows full path or the windows dir. For
the latter '/' is replaced with '\' and a drive letter is prepended.
The drive letter is configurable in the ConfigurationDialog. While at it
I revamped it and added another tab to make it more user friendly.
Diffstat (limited to 'configurationdialog.cpp')
-rw-r--r-- | configurationdialog.cpp | 93 |
1 files changed, 63 insertions, 30 deletions
diff --git a/configurationdialog.cpp b/configurationdialog.cpp index be6fea8..c8e7197 100644 --- a/configurationdialog.cpp +++ b/configurationdialog.cpp @@ -26,6 +26,7 @@ #include <QMessageBox> #include <QFile> #include <QTextStream> +#include <QRegExpValidator> #include "configurationdialog.h" #include "programconfigurator.h" @@ -38,43 +39,69 @@ ConfigurationDialog::ConfigurationDialog(QWidget *parent, Qt::WindowFlags f) : Q fsCompleter->setModel(model); fsCompleter->setCompletionMode(QCompleter::PopupCompletion); - //misc tab - QWidget *miscWidget = new QWidget; - QVBoxLayout *miscLayout = new QVBoxLayout; - miscLayout->setAlignment(Qt::AlignTop); - - //misc - icons - QGroupBox *iconBox = new QGroupBox(tr("Icon for folders")); - QHBoxLayout *iconLayout = new QHBoxLayout; - mIconForFolder = new QComboBox; - QStringList icons = QStringList() << tr("Dildo") << tr("Normal"); - mIconForFolder->addItems(icons); - iconLayout->addWidget(mIconForFolder); - iconBox->setLayout(iconLayout); - - //misc - directories - QGroupBox *pathBox = new QGroupBox(tr("Directories")); + //directories tab + //directories + QWidget *pathWidget = new QWidget; + QGroupBox *pathBox = new QGroupBox(tr("Paths")); QGridLayout *pathGrid = new QGridLayout; - QLabel *miscl2 = new QLabel(tr("Archive directory")); + QLabel *pathl1 = new QLabel(tr("Archive directory")); mArchiveDir = new QLineEdit; mArchiveDir->setCompleter(fsCompleter); - pathGrid->addWidget(miscl2, 0, 0); + pathGrid->addWidget(pathl1, 0, 0); pathGrid->addWidget(mArchiveDir, 0, 1); - QLabel *miscl3 = new QLabel(tr("Burn Directory")); + QLabel *pathl2 = new QLabel(tr("Burn Directory")); mBurnDir = new QLineEdit; mBurnDir->setCompleter(fsCompleter); - pathGrid->addWidget(miscl3, 1, 0); + pathGrid->addWidget(pathl2, 1, 0); pathGrid->addWidget(mBurnDir, 1, 1); - QLabel *miscl4 = new QLabel(tr("Path to ffprobe")); + QLabel *pathl3 = new QLabel(tr("Path to ffprobe")); mFfProbePath = new QLineEdit; mFfProbePath->setCompleter(fsCompleter); - pathGrid->addWidget(miscl4, 2, 0); + pathGrid->addWidget(pathl3, 2, 0); pathGrid->addWidget(mFfProbePath, 2, 1); - QLabel *miscl5 = new QLabel(tr("DVD mount directory")); + QLabel *pathl4 = new QLabel(tr("DVD mount directory")); mDvdMountPath = new QLineEdit; - pathGrid->addWidget(miscl5, 3, 0); + pathGrid->addWidget(pathl4, 3, 0); pathGrid->addWidget(mDvdMountPath, 3, 1); + pathGrid->setAlignment(Qt::AlignTop); pathBox->setLayout(pathGrid); + 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 *pathl5 = new QLabel(tr("Windows drive")); + mWindowsDrive = new QLineEdit; + QRegExp pathValid("[a-z]{1}:"); + pathValid.setCaseSensitivity(Qt::CaseInsensitive); + QRegExpValidator *pathValidator = new QRegExpValidator(pathValid, this); + mWindowsDrive->setValidator(pathValidator); + copyGrid->addWidget(pathl5, 0, 0); + copyGrid->addWidget(mWindowsDrive, 0, 1); + QLabel *pathl6 = new QLabel(tr("Strip from path")); + mStripPath = new QLineEdit; + copyGrid->addWidget(pathl6, 1, 0); + copyGrid->addWidget(mStripPath, 1, 1); + copyGrid->setAlignment(Qt::AlignTop); + copyBox->setLayout(copyGrid); + pathLayout->addWidget(copyBox); + mTab->addTab(pathWidget, tr("Directories")); + + //misc tab + QWidget *miscWidget = new QWidget; + QVBoxLayout *miscLayout = new QVBoxLayout; + miscLayout->setAlignment(Qt::AlignTop); + + //misc - icons + QGroupBox *iconBox = new QGroupBox(tr("Icon for folders")); + QHBoxLayout *iconLayout = new QHBoxLayout; + mIconForFolder = new QComboBox; + QStringList icons = QStringList() << tr("Dildo") << tr("Normal"); + mIconForFolder->addItems(icons); + iconLayout->addWidget(mIconForFolder); + iconBox->setLayout(iconLayout); //misc - hover QGroupBox *hoverBox = new QGroupBox(tr("Hover options")); @@ -95,7 +122,6 @@ ConfigurationDialog::ConfigurationDialog(QWidget *parent, Qt::WindowFlags f) : Q //misc - assemble miscLayout->addWidget(iconBox); - miscLayout->addWidget(pathBox); miscLayout->addWidget(hoverBox); miscWidget->setLayout(miscLayout); mTab->addTab(miscWidget, tr("Misc. settings")); @@ -168,13 +194,17 @@ void ConfigurationDialog::readSettings(){ if(pos != -1){ mIconForFolder->setCurrentIndex(pos); } + mHoverPics->setChecked(s.value("ui/hoverpics", false).toBool()); + mHoverArchive->setChecked(s.value("ui/hoverarchive", false).toBool()); + mHoverOpacity->setValue(s.value("ui/hoveropacity", 10).toInt()); + + //read paths mArchiveDir->setText(s.value("paths/archivedir").toString()); mBurnDir->setText(s.value("paths/burn").toString()); mFfProbePath->setText(s.value("paths/ffprobe").toString()); mDvdMountPath->setText(s.value("paths/dvdmount").toString()); - mHoverPics->setChecked(s.value("ui/hoverpics", false).toBool()); - mHoverArchive->setChecked(s.value("ui/hoverarchive", false).toBool()); - mHoverOpacity->setValue(s.value("ui/hoveropacity", 10).toInt()); + mWindowsDrive->setText(s.value("paths/windowsdrive").toString()); + mStripPath->setText(s.value("paths/strippath").toString()); //read database mDatabaseHost->setText(s.value("database/hostname").toString()); @@ -187,8 +217,7 @@ void ConfigurationDialog::readSettings(){ void ConfigurationDialog::writeSettings(){ QSettings s; - //write misc - s.setValue("ui/folderIcon", mIconForFolder->currentText()); + //write paths s.setValue("paths/archivedir", mArchiveDir->text()); s.setValue("paths/burn", mBurnDir->text()); QString ffprobe = mFfProbePath->text(); @@ -199,6 +228,10 @@ void ConfigurationDialog::writeSettings(){ if(checkDvdPath()){ s.setValue("paths/dvdmount", mDvdMountPath->text()); } + s.setValue("paths/windowsdrive", mWindowsDrive->text()); + s.setValue("paths/strippath", mStripPath->text()); + + s.setValue("ui/folderIcon", mIconForFolder->currentText()); s.setValue("ui/hoverpics", (mHoverPics->checkState() == Qt::Checked)); s.setValue("ui/hoverarchive", (mHoverArchive->checkState() == Qt::Checked)); s.setValue("ui/hoveropacity", mHoverOpacity->value()); |