diff options
author | Arno <arno@disconnect.de> | 2018-11-03 08:11:39 +0100 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2018-11-03 08:11:39 +0100 |
commit | 9087a02adce547e8988a3ae904bf647ef5555b32 (patch) | |
tree | 8bd4853858e67ebee0bf8ffa8152e264da4237a6 | |
parent | a896d928412bc8f02131c8c6ab0d8c1ad4e4753f (diff) | |
download | SheMov-9087a02adce547e8988a3ae904bf647ef5555b32.tar.gz SheMov-9087a02adce547e8988a3ae904bf647ef5555b32.tar.bz2 SheMov-9087a02adce547e8988a3ae904bf647ef5555b32.zip |
Put MovieMetadataPage in separate file
No functional changes, just code shuffle and reindention.
-rw-r--r-- | moviemetadatapage.cpp | 41 | ||||
-rw-r--r-- | moviemetadatapage.h | 30 | ||||
-rw-r--r-- | newmoviewizard.cpp | 30 | ||||
-rw-r--r-- | newmoviewizard.h | 15 | ||||
-rw-r--r-- | shemov.pro | 6 |
5 files changed, 76 insertions, 46 deletions
diff --git a/moviemetadatapage.cpp b/moviemetadatapage.cpp new file mode 100644 index 0000000..5bf7651 --- /dev/null +++ b/moviemetadatapage.cpp @@ -0,0 +1,41 @@ +/* + 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 <QVBoxLayout> +#include <QSettings> + +#include "moviemetadatapage.h" +#include "archiveview.h" + +MovieMetadataPage::MovieMetadataPage(QWidget *parent) : QWizardPage(parent){ + setTitle(tr("Edit movie metadata")); + setSubTitle(tr("Set the movie metadata here, as far as known")); + setupGui(); +} + +void MovieMetadataPage::setupGui(){ + mWidget = new MetadataEditorWidget; + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addWidget(mWidget); + setLayout(mainLayout); +} + +void MovieMetadataPage::initializePage(){ + QSettings s; + bool clearPage = s.value("ui/clearnewmoviewizard").toBool(); + if(clearPage){ + QList<QVariant> curMetadata; + for(int i = 0; i < ArchiveModel::MetadataNumFields; ++i){ + curMetadata << QVariant(); + } + curMetadata[ArchiveModel::ReleaseYear] = QDate::currentDate().year(); + curMetadata[ArchiveModel::Source] = "torrent"; + curMetadata[ArchiveModel::ReleaseGroup] = "unknown"; + curMetadata[ArchiveModel::Added] = QDate::currentDate(); + mWidget->setMetadata(curMetadata); + } +} diff --git a/moviemetadatapage.h b/moviemetadatapage.h new file mode 100644 index 0000000..a6cae80 --- /dev/null +++ b/moviemetadatapage.h @@ -0,0 +1,30 @@ +/* + 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 MOVIEMETADATAPAGE_H +#define MOVIEMETADATAPAGE_H + +#include <QWizardPage> + +class MetadataEditorWidget; +class QCheckBox; + +class MovieMetadataPage : public QWizardPage { + Q_OBJECT + public: + explicit MovieMetadataPage(QWidget *parent = nullptr); + MetadataEditorWidget *widget() { return mWidget; } + virtual void initializePage(); + + private: + void setupGui(); + /* defined in archiveview.h */ + MetadataEditorWidget *mWidget; + QCheckBox *mMetadataEnabled; +}; + +#endif // MOVIEMETADATAPAGE_H diff --git a/newmoviewizard.cpp b/newmoviewizard.cpp index bab8e71..cdd90bb 100644 --- a/newmoviewizard.cpp +++ b/newmoviewizard.cpp @@ -29,6 +29,7 @@ #include <QDirIterator> #include "newmoviewizard.h" +#include "moviemetadatapage.h" #include "wizardtreemodel.h" #include "smglobals.h" #include "mappingtablemodel.h" @@ -623,32 +624,3 @@ void MovieMappingPage::initializePage(){ mWidget->clear(); } } - -MovieMetadataPage::MovieMetadataPage(QWidget *parent) : QWizardPage(parent){ - setTitle(tr("Edit movie metadata")); - setSubTitle(tr("Set the movie metadata here, as far as known")); - setupGui(); -} - -void MovieMetadataPage::setupGui(){ - mWidget = new MetadataEditorWidget; - QVBoxLayout *mainLayout = new QVBoxLayout; - mainLayout->addWidget(mWidget); - setLayout(mainLayout); -} - -void MovieMetadataPage::initializePage(){ - QSettings s; - bool clearPage = s.value("ui/clearnewmoviewizard").toBool(); - if(clearPage){ - QList<QVariant> curMetadata; - for(int i = 0; i < ArchiveModel::MetadataNumFields; ++i){ - curMetadata << QVariant(); - } - curMetadata[ArchiveModel::ReleaseYear] = QDate::currentDate().year(); - curMetadata[ArchiveModel::Source] = "torrent"; - curMetadata[ArchiveModel::ReleaseGroup] = "unknown"; - curMetadata[ArchiveModel::Added] = QDate::currentDate(); - mWidget->setMetadata(curMetadata); - } -} diff --git a/newmoviewizard.h b/newmoviewizard.h index ee3b20d..20eb91a 100644 --- a/newmoviewizard.h +++ b/newmoviewizard.h @@ -107,19 +107,4 @@ class MovieMappingPage : public QWizardPage { QString mTable; }; -class MovieMetadataPage : public QWizardPage { - Q_OBJECT - public: - explicit MovieMetadataPage(QWidget *parent = nullptr); - MetadataEditorWidget *widget() { return mWidget; } - virtual void initializePage(); - - private: - void setupGui(); - /* defined in archiveview.h */ - MetadataEditorWidget *mWidget; - QCheckBox *mMetadataEnabled; -}; - - #endif @@ -59,7 +59,8 @@ SOURCES = main.cpp \ mappingtreeresultmodel.cpp \ mappingdata.cpp \ videoviewer.cpp \ - wizardtreemodel.cpp + wizardtreemodel.cpp \ + moviemetadatapage.cpp HEADERS = \ shemov.h \ helper.h \ @@ -113,7 +114,8 @@ HEADERS = \ mappingtreeresultmodel.h \ mappingdata.h \ videoviewer.h \ - wizardtreemodel.h + wizardtreemodel.h \ + moviemetadatapage.h LIBS += -lmagic -lXfixes -lX11 -lMagick++-6.Q16HDRI INCLUDEPATH += /usr/include/ImageMagick-6/ RESOURCES = shemov.qrc |