summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--moviemappingpage.cpp52
-rw-r--r--moviemappingpage.h28
-rw-r--r--newmoviewizard.cpp40
-rw-r--r--newmoviewizard.h13
-rw-r--r--shemov.pro6
5 files changed, 85 insertions, 54 deletions
diff --git a/moviemappingpage.cpp b/moviemappingpage.cpp
new file mode 100644
index 0000000..8b7c328
--- /dev/null
+++ b/moviemappingpage.cpp
@@ -0,0 +1,52 @@
+/*
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version
+ 2 of the License, or (at your option) any later version.
+*/
+
+#include <QHBoxLayout>
+#include <QSqlQuery>
+#include <QSettings>
+
+#include "moviemappingpage.h"
+#include "smglobals.h"
+
+MovieMappingPage::MovieMappingPage(const QString &table, QWidget *parent) : QWizardPage(parent), mTable(table){
+ QString title = QString(tr("Edit %1")).arg(table);
+ QString subTitle = QString(tr("Edit %1 by adding them from the text field below")).arg(table);
+ setTitle(title);
+ setSubTitle(subTitle);
+
+ mWidget = new MappingEditorWidget(table, true);
+ QHBoxLayout *mainLayout = new QHBoxLayout;
+ mainLayout->addWidget(mWidget);
+
+ setLayout(mainLayout);
+}
+
+void MovieMappingPage::initializePage(){
+ QSqlDatabase db = QSqlDatabase::database("treedb");
+ if(mTable.toLower() == "actors"){
+ QStringList actors;
+ QSqlQuery actorsQ("SELECT tactorname FROM actors", db);
+ while(actorsQ.next()){
+ actors << actorsQ.value(0).toString();
+ }
+ mWidget->fillCompleter(actors);
+ mWidget->setDecorationItem(SmGlobals::instance()->iconFor("actor"));
+ }else if(mTable.toLower() == "genres"){
+ QStringList genres;
+ QSqlQuery genresQ("SELECT tgenrename FROM genres", db);
+ while(genresQ.next()){
+ genres << genresQ.value(0).toString();
+ }
+ mWidget->fillCompleter(genres);
+ mWidget->setDecorationItem(SmGlobals::instance()->iconFor("genre"));
+ }
+ QSettings s;
+ bool clearPage = s.value("ui/clearnewmoviewizard").toBool();
+ if(clearPage){
+ mWidget->clear();
+ }
+}
diff --git a/moviemappingpage.h b/moviemappingpage.h
new file mode 100644
index 0000000..51b983e
--- /dev/null
+++ b/moviemappingpage.h
@@ -0,0 +1,28 @@
+/*
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version
+ 2 of the License, or (at your option) any later version.
+*/
+
+#ifndef MOVIEMAPPINGPAGE_H
+#define MOVIEMAPPINGPAGE_H
+
+#include <QWizardPage>
+
+#include "archiveview.h"
+
+class MovieMappingPage : public QWizardPage {
+ Q_OBJECT
+ public:
+ explicit MovieMappingPage(const QString &table, QWidget *parent = nullptr);
+ MappingEditorWidget *widget() { return mWidget; }
+ virtual void initializePage();
+
+ private:
+ /* defined in archiveview.h */
+ MappingEditorWidget *mWidget;
+ QString mTable;
+};
+
+#endif // MOVIEMAPPINGPAGE_H
diff --git a/newmoviewizard.cpp b/newmoviewizard.cpp
index cdd90bb..1de5871 100644
--- a/newmoviewizard.cpp
+++ b/newmoviewizard.cpp
@@ -30,6 +30,7 @@
#include "newmoviewizard.h"
#include "moviemetadatapage.h"
+#include "moviemappingpage.h"
#include "wizardtreemodel.h"
#include "smglobals.h"
#include "mappingtablemodel.h"
@@ -585,42 +586,3 @@ void MovieInfoPage::removeFile(){
}
}
}
-
-MovieMappingPage::MovieMappingPage(const QString &table, QWidget *parent) : QWizardPage(parent), mTable(table){
- QString title = QString(tr("Edit %1")).arg(table);
- QString subTitle = QString(tr("Edit %1 by adding them from the text field below")).arg(table);
- setTitle(title);
- setSubTitle(subTitle);
-
- mWidget = new MappingEditorWidget(table, true);
- QHBoxLayout *mainLayout = new QHBoxLayout;
- mainLayout->addWidget(mWidget);
-
- setLayout(mainLayout);
-}
-
-void MovieMappingPage::initializePage(){
- QSqlDatabase db = QSqlDatabase::database("treedb");
- if(mTable.toLower() == "actors"){
- QStringList actors;
- QSqlQuery actorsQ("SELECT tactorname FROM actors", db);
- while(actorsQ.next()){
- actors << actorsQ.value(0).toString();
- }
- mWidget->fillCompleter(actors);
- mWidget->setDecorationItem(SmGlobals::instance()->iconFor("actor"));
- }else if(mTable.toLower() == "genres"){
- QStringList genres;
- QSqlQuery genresQ("SELECT tgenrename FROM genres", db);
- while(genresQ.next()){
- genres << genresQ.value(0).toString();
- }
- mWidget->fillCompleter(genres);
- mWidget->setDecorationItem(SmGlobals::instance()->iconFor("genre"));
- }
- QSettings s;
- bool clearPage = s.value("ui/clearnewmoviewizard").toBool();
- if(clearPage){
- mWidget->clear();
- }
-}
diff --git a/newmoviewizard.h b/newmoviewizard.h
index 20eb91a..cd739bf 100644
--- a/newmoviewizard.h
+++ b/newmoviewizard.h
@@ -94,17 +94,4 @@ class MovieInfoPage : public QWizardPage {
int mCurQuality;
};
-class MovieMappingPage : public QWizardPage {
- Q_OBJECT
- public:
- explicit MovieMappingPage(const QString &table, QWidget *parent = nullptr);
- MappingEditorWidget *widget() { return mWidget; }
- virtual void initializePage();
-
- private:
- /* defined in archiveview.h */
- MappingEditorWidget *mWidget;
- QString mTable;
-};
-
#endif
diff --git a/shemov.pro b/shemov.pro
index 6b456ef..eea1b1c 100644
--- a/shemov.pro
+++ b/shemov.pro
@@ -60,7 +60,8 @@ SOURCES = main.cpp \
mappingdata.cpp \
videoviewer.cpp \
wizardtreemodel.cpp \
- moviemetadatapage.cpp
+ moviemetadatapage.cpp \
+ moviemappingpage.cpp
HEADERS = \
shemov.h \
helper.h \
@@ -115,7 +116,8 @@ HEADERS = \
mappingdata.h \
videoviewer.h \
wizardtreemodel.h \
- moviemetadatapage.h
+ moviemetadatapage.h \
+ moviemappingpage.h
LIBS += -lmagic -lXfixes -lX11 -lMagick++-6.Q16HDRI
INCLUDEPATH += /usr/include/ImageMagick-6/
RESOURCES = shemov.qrc