From 1b1e48aa11c4518e100004dac594540e6024fa68 Mon Sep 17 00:00:00 2001 From: am Date: Thu, 16 Jul 2009 19:34:57 +0000 Subject: -Fixed extractor... Just look at the examples for QProcess :) -Beautified extractor output for unrar -Added User interface configuration options -So, there are Usability fixes git-svn-id: file:///var/svn/repos2/shemov/trunk@388 f440f766-f032-0410-8965-dc7d17de2ca0 --- configurationdialog.cpp | 80 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) (limited to 'configurationdialog.cpp') diff --git a/configurationdialog.cpp b/configurationdialog.cpp index 34e5d10..32fc197 100644 --- a/configurationdialog.cpp +++ b/configurationdialog.cpp @@ -84,6 +84,40 @@ ConfigurationDialog::ConfigurationDialog(QWidget *parent, Qt::WindowFlags f) : Q pathWidget->setLayout(pathGrid); mTab->addTab(pathWidget, tr("Paths")); + //ui tab + QWidget *uiWidget = new QWidget; + QGridLayout *uiGrid = new QGridLayout; + QLabel *ui1 = new QLabel(tr("Select icon for &folders")); + mIconForFolder = new QComboBox; + ui1->setBuddy(mIconForFolder); + QStringList icons = QStringList() << tr("Dildo") << tr("Normal"); + mIconForFolder->addItems(icons); + uiGrid->addWidget(ui1, 0, 0); + uiGrid->addWidget(mIconForFolder, 0, 1); + QLabel *ui2 = new QLabel(tr("Expand paths in directory tree")); + mExpandPaths = new QComboBox; + uiGrid->addWidget(ui2, 1, 0); + uiGrid->addWidget(mExpandPaths, 1, 1); + mSelect = new QPushButton(tr("Open directory at Startup")); + connect(mSelect, SIGNAL(clicked()), this, SLOT(selectStartup())); + uiGrid->addWidget(mSelect, 2, 1); + QLabel *ui3 = new QLabel(tr("Add &new path to expand")); + mExpandPath = new QLineEdit; + mExpandPath->setCompleter(fsCompleter); + ui3->setBuddy(mExpandPath); + uiGrid->addWidget(ui3, 3, 0); + uiGrid->addWidget(mExpandPath, 3, 1); + mAddExpandPath = new QPushButton(tr("Add path")); + connect(mAddExpandPath, SIGNAL(clicked()), this, SLOT(addExpandPath())); + mRemoveExpandPath = new QPushButton(tr("Remove path")); + connect(mRemoveExpandPath, SIGNAL(clicked()), this, SLOT(removeExpandPath())); + QHBoxLayout *expandButtons = new QHBoxLayout; + expandButtons->addWidget(mAddExpandPath); + expandButtons->addWidget(mRemoveExpandPath); + uiGrid->addLayout(expandButtons, 4, 1); + uiWidget->setLayout(uiGrid); + mTab->addTab(uiWidget, tr("User interface")); + //main layout mOk = new QPushButton(tr("Ok")); connect(mOk, SIGNAL(clicked()), this, SLOT(accept())); @@ -126,8 +160,36 @@ void ConfigurationDialog::removePath(){ } } +void ConfigurationDialog::addExpandPath(){ + QString newPath = mExpandPath->text(); + if(!newPath.isEmpty() && !mEPaths.contains(newPath)){ + mExpandPaths->addItem(newPath); + mEPaths.append(newPath); + } +} + +void ConfigurationDialog::removeExpandPath(){ + QString removePath = mExpandPaths->currentText(); + int current = mExpandPaths->currentIndex(); + if(!removePath.isEmpty()){ + if(mEPaths.contains(removePath)){ + mEPaths.removeOne(removePath); + mExpandPaths->removeItem(current); + } + } +} + +void ConfigurationDialog::selectStartup(){ + QString startup = mExpandPaths->currentText(); + if(!startup.isEmpty()){ + mSelectStartup = startup; + } +} + void ConfigurationDialog::readSettings(){ QSettings s; + + //read paths mPictureViewer->setText(s.value("paths/pictureviewer", "/usr/bin/gwenview").toString()); QStringList pvArgs = s.value("paths/pictureviewerargs").toStringList(); mPictureViewerArgs->setText(pvArgs.join(" ")); @@ -140,10 +202,23 @@ void ConfigurationDialog::readSettings(){ QStringList extractPaths = s.value("paths/extractpaths").toStringList(); mArchivePaths->addItems(extractPaths); mPaths = extractPaths; + + //read ui + QStringList expandPaths = s.value("ui/expandpaths").toStringList(); + mExpandPaths->addItems(expandPaths); + mEPaths = expandPaths; + QString icon = s.value("ui/foldericon", "Normal").toString(); + int pos = mIconForFolder->findText(icon); + if(pos != -1){ + mIconForFolder->setCurrentIndex(pos); + } + } void ConfigurationDialog::writeSettings(){ QSettings s; + + //write paths QRegExp splitAt("\\s+"); s.setValue("paths/pictureviewer", mPictureViewer->text()); QStringList pvArgs = mPictureViewerArgs->text().split(splitAt, QString::SkipEmptyParts); @@ -155,5 +230,10 @@ void ConfigurationDialog::writeSettings(){ QStringList aArgs = mArchiverArgs->text().split(splitAt, QString::SkipEmptyParts); s.setValue("paths/archiverargs", aArgs); s.setValue("paths/extractpaths", mPaths); + + //write ui + s.setValue("ui/expandpaths", mEPaths); + s.setValue("ui/folderIcon", mIconForFolder->currentText()); + s.setValue("ui/selectstartup", mSelectStartup); } -- cgit v1.2.3-70-g09d2