summaryrefslogtreecommitdiffstats
path: root/randomtab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'randomtab.cpp')
-rw-r--r--randomtab.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/randomtab.cpp b/randomtab.cpp
index 036e482..c704110 100644
--- a/randomtab.cpp
+++ b/randomtab.cpp
@@ -42,7 +42,13 @@ RandomTab::RandomTab(QWidget *parent) : QWidget(parent) {
setupModels();
setupGui();
clearAll();
+ readSettings();
mValidDvds = validDvdNos();
+ select();
+}
+
+RandomTab::~RandomTab(){
+ writeSettings();
}
void RandomTab::setupGui(){
@@ -108,6 +114,8 @@ void RandomTab::setupGui(){
mFileView = new QTreeView;
mFileView->setAlternatingRowColors(true);
mFileView->setRootIsDecorated(false);
+ mFileView->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ mFileView->setSelectionBehavior(QAbstractItemView::SelectRows);
mFileModel = new QStandardItemModel;
mFileProxy = new QSortFilterProxyModel;
mFileProxy->setSourceModel(mFileModel);
@@ -133,6 +141,34 @@ void RandomTab::setupGui(){
setLayout(mainLayout);
}
+void RandomTab::writeSettings(){
+ QSettings s;
+ QStringList selGenres;
+ foreach(QComboBox *c, mGenreBoxes){
+ selGenres << c->currentText();
+ }
+ s.setValue("random/genres", selGenres);
+ QStringList selActors;
+ foreach(QComboBox *c,mActorBoxes){
+ selActors << c->currentText();
+ }
+ s.setValue("random/actors", selActors);
+ s.setValue("random/filecount", mNumber->text());
+}
+
+void RandomTab::readSettings(){
+ QSettings s;
+ mNumber->setText(s.value("random/filecount", "10").toString());
+ QStringList genres = s.value("random/genres").toStringList();
+ for(int i = 0; i < genres.count(); ++i){
+ mGenreBoxes.at(i)->setCurrentText(genres.at(i));
+ }
+ QStringList actors = s.value("random/actors").toStringList();
+ for(int i = 0; i < actors.count(); ++i){
+ mActorBoxes.at(i)->setCurrentText(actors.at(i));
+ }
+}
+
QStringList RandomTab::validDvdNos(){
QStringList retval;
QSettings s;
@@ -200,8 +236,12 @@ void RandomTab::clearAll(){
}
void RandomTab::refreshComboboxes(){
+ logMessage(tr("Refreshing genres and actors..."));
+ writeSettings();
setupModels();
clearAll();
+ readSettings();
+ logMessage(tr("Refreshing genres and actors -> Done!"));
}
void RandomTab::select(){
@@ -293,6 +333,7 @@ void RandomTab::select(){
for(int i = 0; i < ColumnCount; ++i){
QStandardItem *item = new QStandardItem;
item->setFont(QFont("courier new", -1, QFont::Bold));
+ item->setEditable(false);
fData << item;
}
fData[0]->setText(randomFilesQ.value(0).toString());