Skip to content
Browse files

Fixes #60 Finally finished the docu and little cleanup

  • Loading branch information...
1 parent 1d4fd2d commit e432c06ffa4120e6d2040d3bc0f99dd847bab9ac Daniel Kabel committed Sep 6, 2012
View
99 ExportDialog.cpp
@@ -1,99 +0,0 @@
-#include "ExportDialog.h"
-#include "ui_ExportDialog.h"
-
-#include <QtConcurrentRun>
-#include <QFileDialog>
-#include "Manager.h"
-
-ExportDialog::ExportDialog(QWidget *parent) :
- QDialog(parent),
- ui(new Ui::ExportDialog)
-{
- ui->setupUi(this);
-
-#ifdef Q_WS_MAC
- setWindowFlags((windowFlags() & ~Qt::WindowType_Mask) | Qt::Sheet);
- setStyleSheet(styleSheet() + " #ExportDialog { border: 1px solid rgba(0, 0, 0, 100); border-top: none; }");
-#else
- setWindowFlags((windowFlags() & ~Qt::WindowType_Mask) | Qt::Dialog);
-#endif
-
- connect(ui->buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
- connect(ui->buttonExport, SIGNAL(clicked()), this, SLOT(exportDatabase()));
- connect(ui->buttonChooseDir, SIGNAL(clicked()), this, SLOT(chooseExportDirectory()));
- connect(Manager::instance()->mediaCenterInterface(), SIGNAL(sigExportStarted()), this, SLOT(onExportStarted()));
- connect(Manager::instance()->mediaCenterInterface(), SIGNAL(sigExportProgress(int,int)), this, SLOT(onExportProgress(int,int)));
- connect(Manager::instance()->mediaCenterInterface(), SIGNAL(sigExportDone()), this, SLOT(onExportFinished()));
- connect(Manager::instance()->mediaCenterInterface(), SIGNAL(sigExportRaiseError(QString)), this, SLOT(onExportError(QString)));
-}
-
-ExportDialog::~ExportDialog()
-{
- delete ui;
-}
-
-int ExportDialog::exec()
-{
- ui->labelError->hide();
- ui->exportDirectory->setText("");
- ui->search->setText("");
- ui->search->setReadOnly(false);
- ui->replace->setText("");
- ui->replace->setReadOnly(false);
- ui->progressBar->hide();
- ui->buttonCancel->show();
- ui->buttonExport->show();
- ui->buttonExport->setEnabled(false);
- ui->buttonChooseDir->setEnabled(true);
- ui->buttonCancel->setText(tr("Cancel"));
- return QDialog::exec();
-}
-
-void ExportDialog::exportDatabase()
-{
- ui->buttonCancel->hide();
- ui->buttonExport->hide();
- ui->search->setReadOnly(true);
- ui->replace->setReadOnly(true);
- ui->buttonChooseDir->setEnabled(false);
- QtConcurrent::run(Manager::instance()->mediaCenterInterface(), &MediaCenterInterface::exportDatabase,
- Manager::instance()->movieModel()->movies(), Manager::instance()->tvShowModel()->tvShows(),
- ui->exportDirectory->text(), ui->search->text(), ui->replace->text());
-}
-
-void ExportDialog::onExportStarted()
-{
- ui->progressBar->show();
- ui->progressBar->setValue(0);
-}
-
-void ExportDialog::onExportProgress(int current, int max)
-{
- ui->progressBar->setRange(0, max);
- ui->progressBar->setValue(current);
-}
-
-void ExportDialog::onExportFinished()
-{
- ui->progressBar->hide();
- ui->buttonCancel->setText(tr("Close"));
- ui->buttonCancel->show();
-}
-
-void ExportDialog::onExportError(QString error)
-{
- ui->labelError->setText(error);
- ui->labelError->show();
- ui->progressBar->hide();
- ui->buttonCancel->setText(tr("Close"));
- ui->buttonCancel->show();
-}
-
-void ExportDialog::chooseExportDirectory()
-{
- QString dir = QFileDialog::getExistingDirectory(this, tr("Export Directory"), QDir::homePath(), QFileDialog::ShowDirsOnly);
- if (!dir.isEmpty()) {
- ui->exportDirectory->setText(dir);
- ui->buttonExport->setEnabled(true);
- }
-}
View
34 ExportDialog.h
@@ -1,34 +0,0 @@
-#ifndef EXPORTDIALOG_H
-#define EXPORTDIALOG_H
-
-#include <QDialog>
-
-namespace Ui {
-class ExportDialog;
-}
-
-/**
- * @brief The ExportDialog class
- * This is an old class which is currently not used and will be removed later
- */
-class ExportDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit ExportDialog(QWidget *parent = 0);
- ~ExportDialog();
-public slots:
- int exec();
-private slots:
- void exportDatabase();
- void chooseExportDirectory();
- void onExportStarted();
- void onExportProgress(int current, int max);
- void onExportFinished();
- void onExportError(QString error);
-private:
- Ui::ExportDialog *ui;
-};
-
-#endif // EXPORTDIALOG_H
View
217 ExportDialog.ui
@@ -1,217 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ExportDialog</class>
- <widget class="QDialog" name="ExportDialog">
- <property name="windowModality">
- <enum>Qt::WindowModal</enum>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>597</width>
- <height>361</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>MediaElch</string>
- </property>
- <property name="modal">
- <bool>true</bool>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0,0,0,0,0,1">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Export the Database including Fanarts, Posters and Actors into a folder. This way you can import your whole library into XBMC.</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>10</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>If the path where your movies are stored is different on your HTPC (running the XBMC instance) you can specify it here (e.g. replace &quot;/Volumes/Movies/&quot; with &quot;/mnt/movies/&quot;).</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Search</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Replace</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="search"/>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="replace"/>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>10</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Please choose an empty directory, existing files might get overwritten.</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Export Directory</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="exportDirectory">
- <property name="readOnly">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonChooseDir">
- <property name="text">
- <string>Choose Directory</string>
- </property>
- <property name="autoDefault">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QProgressBar" name="progressBar">
- <property name="value">
- <number>24</number>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="labelError">
- <property name="styleSheet">
- <string notr="true">color: rgb(255, 0, 0);</string>
- </property>
- <property name="text">
- <string>Error Message</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="buttonCancel">
- <property name="text">
- <string>Cancel</string>
- </property>
- <property name="autoDefault">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="buttonExport">
- <property name="text">
- <string>Export</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
View
12 Globals.h
@@ -52,6 +52,9 @@ enum MainWidgets {
WidgetMovies, WidgetMovieSets, WidgetTvShows
};
+/**
+ * @brief The Actor struct
+ */
struct Actor {
QString name;
QString role;
@@ -63,12 +66,18 @@ Q_DECLARE_METATYPE(Actor*);
Q_DECLARE_METATYPE(Movie*);
Q_DECLARE_METATYPE(QString*);
+/**
+ * @brief The ScraperSearchResult struct
+ */
struct ScraperSearchResult {
QString id;
QString name;
QDate released;
};
+/**
+ * @brief The Poster struct
+ */
struct Poster {
QString id;
QUrl originalUrl;
@@ -84,6 +93,9 @@ enum TvShowType {
TypeTvShow, TypeEpisode, TypeSeason
};
+/**
+ * @brief The SettingsDir struct
+ */
struct SettingsDir {
QString path;
QString mediaCenterPath;
View
43 MainWindow.cpp
@@ -8,7 +8,6 @@
#include "data/MediaCenterInterface.h"
#include "data/ScraperInterface.h"
-#include "ExportDialog.h"
#include "ImagePreviewDialog.h"
#include "Manager.h"
#include "MovieImageDialog.h"
@@ -39,7 +38,6 @@ MainWindow::MainWindow(QWidget *parent) :
m_tvShowActions.insert(ActionExport, false);
m_aboutDialog = new AboutDialog(ui->centralWidget);
- m_exportDialog = new ExportDialog(ui->centralWidget);
m_filterWidget = new FilterWidget(ui->mainToolBar);
m_settingsWidget = static_cast<SettingsWidget*>(ui->stackedWidget->widget(2));
setupToolbar();
@@ -213,30 +211,24 @@ void MainWindow::setupToolbar()
m_actionSearch = new QAction(QIcon(search), tr("Search"), this);
m_actionSave = new QAction(QIcon(save), tr("Save"), this);
m_actionSaveAll = new QAction(QIcon(saveAll), tr("Save All"), this);
- m_actionExport = new QAction(QIcon(exportDb), tr("Export"), this);
- m_actionExport->setToolTip(tr("Export Movie Database"));
m_actionAbout = new QAction(QIcon(info), tr("About"), this);
m_actionQuit = new QAction(QIcon(quit), tr("Quit"), this);
ui->mainToolBar->addAction(m_actionSearch);
ui->mainToolBar->addAction(m_actionSave);
ui->mainToolBar->addAction(m_actionSaveAll);
- // @todo: currently disabled as the whole exports need rethinking... ;)
- // ui->mainToolBar->addAction(m_actionExport);
ui->mainToolBar->addAction(m_actionAbout);
ui->mainToolBar->addAction(m_actionQuit);
ui->mainToolBar->addWidget(m_filterWidget);
connect(m_actionSearch, SIGNAL(triggered()), this, SLOT(onActionSearch()));
connect(m_actionSave, SIGNAL(triggered()), this, SLOT(onActionSave()));
connect(m_actionSaveAll, SIGNAL(triggered()), this, SLOT(onActionSaveAll()));
- connect(m_actionExport, SIGNAL(triggered()), m_exportDialog, SLOT(exec()));
connect(m_actionAbout, SIGNAL(triggered()), m_aboutDialog, SLOT(exec()));
connect(m_actionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
m_actionSearch->setEnabled(false);
m_actionSave->setEnabled(false);
m_actionSaveAll->setEnabled(false);
- m_actionExport->setEnabled(false);
#ifdef Q_WS_WIN
ui->mainToolBar->setStyleSheet("QToolButton {border: 0; padding: 5px;} QToolBar { border-bottom: 1px solid rgba(0, 0, 0, 100); }");
@@ -250,12 +242,6 @@ void MainWindow::setupToolbar()
*/
void MainWindow::progressStarted(QString msg, int id)
{
- if (id == Constants::MovieFileSearcherProgressMessageId)
- onSetExportEnabled(false, WidgetMovies);
- else if (id == Constants::TvShowSearcherProgressMessageId)
- onSetExportEnabled(false, WidgetTvShows);
- else if (id == Constants::MovieWidgetProgressMessageId)
- onSetExportEnabled(false, WidgetMovies);
MessageBox::instance()->showProgressBar(msg, id);
}
@@ -276,14 +262,8 @@ void MainWindow::progressProgress(int current, int max, int id)
*/
void MainWindow::progressFinished(int id)
{
- if (id == Constants::MovieFileSearcherProgressMessageId) {
- onSetExportEnabled(true, WidgetMovies);
- } else if (id == Constants::TvShowSearcherProgressMessageId) {
+ if (id == Constants::TvShowSearcherProgressMessageId)
ui->tvShowFilesWidget->renewModel();
- onSetExportEnabled(true, WidgetTvShows);
- } else if (id == Constants::MovieWidgetProgressMessageId) {
- onSetExportEnabled(true, WidgetMovies);
- }
MessageBox::instance()->hideProgressBar(id);
}
@@ -301,7 +281,6 @@ void MainWindow::onMenuMovies()
m_actionSearch->setEnabled(m_movieActions[ActionSearch]);
m_actionSave->setEnabled(m_movieActions[ActionSave]);
m_actionSaveAll->setEnabled(m_movieActions[ActionSave]);
- m_actionExport->setEnabled(m_movieActions[ActionExport]);
m_filterWidget->setEnabled(true);
}
@@ -319,7 +298,6 @@ void MainWindow::onMenuMovieSets()
m_actionSearch->setEnabled(m_movieSetActions[ActionSearch]);
m_actionSave->setEnabled(m_movieSetActions[ActionSave]);
m_actionSaveAll->setEnabled(false);
- m_actionExport->setEnabled(m_movieSetActions[ActionExport]);
m_filterWidget->setEnabled(true);
ui->setsWidget->loadSets();
}
@@ -338,7 +316,6 @@ void MainWindow::onMenuTvShows()
m_actionSearch->setEnabled(m_tvShowActions[ActionSearch]);
m_actionSave->setEnabled(m_tvShowActions[ActionSave]);
m_actionSaveAll->setEnabled(m_tvShowActions[ActionSave]);
- m_actionExport->setEnabled(m_tvShowActions[ActionExport]);
m_filterWidget->setEnabled(true);
}
@@ -357,7 +334,6 @@ void MainWindow::onMenuSettings()
m_actionSearch->setEnabled(false);
m_actionSave->setEnabled(true);
m_actionSaveAll->setEnabled(false);
- m_actionExport->setEnabled(false);
m_filterWidget->setEnabled(false);
}
@@ -415,23 +391,6 @@ void MainWindow::onFilterChanged(QString text)
}
/**
- * @brief Sets the status of the export action
- * @param enabled Status
- * @param widget Widget to set the status for
- */
-void MainWindow::onSetExportEnabled(bool enabled, MainWidgets widget)
-{
- if (widget == WidgetMovies)
- m_movieActions[ActionExport] = enabled;
- else if (widget == WidgetTvShows)
- m_tvShowActions[ActionExport] = enabled;
-
- if ((widget == WidgetMovies && ui->stackedWidget->currentIndex() == 0) ||
- (widget == WidgetTvShows && ui->stackedWidget->currentIndex() == 1))
- m_actionExport->setEnabled(enabled);
-}
-
-/**
* @brief Sets the status of the save and save all action
* @param enabled Status
* @param widget Widget to set the status for
View
4 MainWindow.h
@@ -5,7 +5,6 @@
#include <QMainWindow>
#include <QProgressBar>
#include "AboutDialog.h"
-#include "ExportDialog.h"
#include "Globals.h"
#include "data/MovieFileSearcher.h"
#include "smallWidgets/FilterWidget.h"
@@ -41,7 +40,6 @@ private slots:
void onActionSave();
void onActionSaveAll();
void onFilterChanged(QString text);
- void onSetExportEnabled(bool enabled, MainWidgets widget);
void onSetSaveEnabled(bool enabled, MainWidgets widget);
void onSetSearchEnabled(bool enabled, MainWidgets widget);
void onMovieSplitterMoved();
@@ -52,10 +50,8 @@ private slots:
Ui::MainWindow *ui;
SettingsWidget *m_settingsWidget;
AboutDialog *m_aboutDialog;
- ExportDialog *m_exportDialog;
QAction *m_actionSearch;
QAction *m_actionSave;
- QAction *m_actionExport;
QAction *m_actionAbout;
QAction *m_actionQuit;
QAction *m_actionSaveAll;
View
3 MediaElch.pro
@@ -42,7 +42,6 @@ SOURCES += main.cpp\
scrapers/Cinefacts.cpp \
smallWidgets/FilterWidget.cpp \
MyTableWidget.cpp \
- ExportDialog.cpp \
SettingsWidget.cpp \
MessageBox.cpp \
Message.cpp \
@@ -93,7 +92,6 @@ HEADERS += MainWindow.h \
scrapers/Cinefacts.h \
smallWidgets/FilterWidget.h \
MyTableWidget.h \
- ExportDialog.h \
SettingsWidget.h \
MessageBox.h \
Message.h \
@@ -128,7 +126,6 @@ FORMS += MainWindow.ui \
FilesWidget.ui \
AboutDialog.ui \
smallWidgets/FilterWidget.ui \
- ExportDialog.ui \
SettingsWidget.ui \
MessageBox.ui \
Message.ui \
View
3 MovieImageDialog.h
@@ -55,6 +55,9 @@ private slots:
private:
Ui::MovieImageDialog *ui;
+ /**
+ * @brief The DownloadElement struct
+ */
struct DownloadElement {
QUrl thumbUrl;
QUrl originalUrl;
View
160 MovieWidget.cpp
@@ -12,8 +12,11 @@
#include "MessageBox.h"
#include "MovieImageDialog.h"
#include "MovieSearch.h"
-#include "QuestionDialog.h"
+/**
+ * @brief MovieWidget::MovieWidget
+ * @param parent
+ */
MovieWidget::MovieWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::MovieWidget)
@@ -111,17 +114,27 @@ MovieWidget::MovieWidget(QWidget *parent) :
ui->buttonRevert->setVisible(false);
}
+/**
+ * @brief MovieWidget::~MovieWidget
+ */
MovieWidget::~MovieWidget()
{
delete ui;
}
+/**
+ * @brief Repositions the saving widget
+ * @param event
+ */
void MovieWidget::resizeEvent(QResizeEvent *event)
{
m_savingWidget->move(size().width()/2-m_savingWidget->width(), height()/2-m_savingWidget->height());
QWidget::resizeEvent(event);
}
+/**
+ * @brief Clears all contents of the widget
+ */
void MovieWidget::clear()
{
ui->set->clear();
@@ -152,11 +165,19 @@ void MovieWidget::clear()
ui->buttonRevert->setVisible(false);
}
+/**
+ * @brief Updates the title text
+ * @param text New text
+ */
void MovieWidget::movieNameChanged(QString text)
{
ui->movieName->setText(text);
}
+/**
+ * @brief Sets the state of the main groupbox to enabled
+ * @param movie Current movie
+ */
void MovieWidget::setEnabledTrue(Movie *movie)
{
if (movie && movie->downloadsInProgress())
@@ -166,13 +187,20 @@ void MovieWidget::setEnabledTrue(Movie *movie)
emit setActionSearchEnabled(true, WidgetMovies);
}
+/**
+ * @brief Sets the state of the main groupbox to disabled
+ */
void MovieWidget::setDisabledTrue()
{
ui->groupBox_3->setDisabled(true);
emit setActionSaveEnabled(false, WidgetMovies);
emit setActionSearchEnabled(false, WidgetMovies);
}
+/**
+ * @brief Sets the current movie, tells the movie to load data and images and updates widgets contents
+ * @param movie Current movie
+ */
void MovieWidget::setMovie(Movie *movie)
{
movie->loadData(Manager::instance()->mediaCenterInterface());
@@ -185,6 +213,9 @@ void MovieWidget::setMovie(Movie *movie)
setEnabledTrue();
}
+/**
+ * @brief Shows the search widget
+ */
void MovieWidget::startScraperSearch()
{
if (m_movie == 0)
@@ -203,6 +234,11 @@ void MovieWidget::startScraperSearch()
}
}
+/**
+ * @brief Called when the search widget finishes
+ * Updates infos and starts downloads
+ * @param movie Movie
+ */
void MovieWidget::loadDone(Movie *movie)
{
if (m_movie == 0)
@@ -266,6 +302,9 @@ void MovieWidget::loadDone(Movie *movie)
connect(m_posterDownloadManager, SIGNAL(allDownloadsFinished(Movie*)), this, SLOT(downloadActorsFinished(Movie*)), Qt::UniqueConnection);
}
+/**
+ * @brief Updates the contents of the widget with the current movie infos
+ */
void MovieWidget::updateMovieInfo()
{
if (m_movie == 0)
@@ -401,6 +440,9 @@ void MovieWidget::updateMovieInfo()
ui->buttonRevert->setVisible(m_movie->hasChanged());
}
+/**
+ * @brief Shows the MovieImageDialog and after successful execution starts poster download
+ */
void MovieWidget::chooseMoviePoster()
{
if (m_movie == 0)
@@ -425,6 +467,9 @@ void MovieWidget::chooseMoviePoster()
}
}
+/**
+ * @brief Shows the MovieImageDialog and after successful execution starts backdrop download
+ */
void MovieWidget::chooseMovieBackdrop()
{
if (m_movie == 0)
@@ -449,6 +494,10 @@ void MovieWidget::chooseMovieBackdrop()
}
}
+/**
+ * @brief Adjusts the size of the backdrop to common values (1080p or 720p) and shows the image
+ * @param elem Downloaded element
+ */
void MovieWidget::posterDownloadFinished(DownloadManagerElement elem)
{
if (elem.imageType == TypePoster) {
@@ -483,6 +532,9 @@ void MovieWidget::posterDownloadFinished(DownloadManagerElement elem)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Saves movie information
+ */
void MovieWidget::saveInformation()
{
setDisabledTrue();
@@ -494,6 +546,9 @@ void MovieWidget::saveInformation()
ui->buttonRevert->setVisible(false);
}
+/**
+ * @brief Saves all changed movies
+ */
void MovieWidget::saveAll()
{
setDisabledTrue();
@@ -509,13 +564,20 @@ void MovieWidget::saveAll()
ui->buttonRevert->setVisible(false);
}
+/**
+ * @brief Revert changes for current movie
+ */
void MovieWidget::onRevertChanges()
{
m_movie->loadData(Manager::instance()->mediaCenterInterface(), true);
m_movie->loadImages(Manager::instance()->mediaCenterInterface(), true);
updateMovieInfo();
}
+/**
+ * @brief Toggles enabled state of the widget
+ * @param movie
+ */
void MovieWidget::downloadActorsFinished(Movie *movie)
{
emit actorDownloadFinished(Constants::MovieProgressMessageId+movie->movieId());
@@ -524,13 +586,21 @@ void MovieWidget::downloadActorsFinished(Movie *movie)
movie->setDownloadsInProgress(false);
}
+/**
+ * @brief Emits the progress signal
+ * @param left Number of downloads left
+ * @param elem Current downloaded element
+ */
void MovieWidget::actorDownloadsLeft(int left, DownloadManagerElement elem)
{
emit actorDownloadProgress(elem.movie->downloadsSize()-left, elem.movie->downloadsSize(), Constants::MovieProgressMessageId+elem.movie->movieId());
}
/*** add/remove/edit Actors, Genres, Countries and Studios ***/
+/**
+ * @brief Adds an actor
+ */
void MovieWidget::addActor()
{
Actor a;
@@ -551,6 +621,9 @@ void MovieWidget::addActor()
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Removes an actor
+ */
void MovieWidget::removeActor()
{
int row = ui->actors->currentRow();
@@ -565,6 +638,10 @@ void MovieWidget::removeActor()
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Stores changed values for an actor
+ * @param item Edited item
+ */
void MovieWidget::onActorEdited(QTableWidgetItem *item)
{
Actor *actor = ui->actors->item(item->row(), 1)->data(Qt::UserRole).value<Actor*>();
@@ -576,6 +653,9 @@ void MovieWidget::onActorEdited(QTableWidgetItem *item)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Adds a genre
+ */
void MovieWidget::addGenre()
{
QString g = tr("Unknown Genre");
@@ -592,6 +672,9 @@ void MovieWidget::addGenre()
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Removes a genre
+ */
void MovieWidget::removeGenre()
{
int row = ui->genres->currentRow();
@@ -606,6 +689,10 @@ void MovieWidget::removeGenre()
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Stores changed values for a genre
+ * @param item Edited item
+ */
void MovieWidget::onGenreEdited(QTableWidgetItem *item)
{
QString *genre = ui->genres->item(item->row(), 0)->data(Qt::UserRole).value<QString*>();
@@ -615,6 +702,9 @@ void MovieWidget::onGenreEdited(QTableWidgetItem *item)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Adds a studio
+ */
void MovieWidget::addStudio()
{
QString s = tr("Unknown Studio");
@@ -631,6 +721,9 @@ void MovieWidget::addStudio()
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Removes a studio
+ */
void MovieWidget::removeStudio()
{
int row = ui->studios->currentRow();
@@ -645,6 +738,10 @@ void MovieWidget::removeStudio()
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Stores changed values for a studio
+ * @param item Edited item
+ */
void MovieWidget::onStudioEdited(QTableWidgetItem *item)
{
QString *studio = ui->studios->item(item->row(), 0)->data(Qt::UserRole).value<QString*>();
@@ -654,6 +751,9 @@ void MovieWidget::onStudioEdited(QTableWidgetItem *item)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Adds a country
+ */
void MovieWidget::addCountry()
{
QString c = tr("Unknown Country");
@@ -670,6 +770,9 @@ void MovieWidget::addCountry()
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Removes a country
+ */
void MovieWidget::removeCountry()
{
int row = ui->countries->currentRow();
@@ -684,6 +787,10 @@ void MovieWidget::removeCountry()
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Stores changed values for a country
+ * @param item Edited item
+ */
void MovieWidget::onCountryEdited(QTableWidgetItem *item)
{
QString *country = ui->countries->item(item->row(), 0)->data(Qt::UserRole).value<QString*>();
@@ -693,18 +800,27 @@ void MovieWidget::onCountryEdited(QTableWidgetItem *item)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Shows a full size image of the backdrop
+ */
void MovieWidget::onPreviewBackdrop()
{
ImagePreviewDialog::instance()->setImage(QPixmap::fromImage(m_currentBackdrop));
ImagePreviewDialog::instance()->exec();
}
+/**
+ * @brief Shows a full size image of the poster
+ */
void MovieWidget::onPreviewPoster()
{
ImagePreviewDialog::instance()->setImage(QPixmap::fromImage(m_currentPoster));
ImagePreviewDialog::instance()->exec();
}
+/**
+ * @brief Shows the image of the selected actor
+ */
void MovieWidget::onActorChanged()
{
if (ui->actors->currentRow() < 0 || ui->actors->currentRow() >= ui->actors->rowCount() ||
@@ -725,6 +841,9 @@ void MovieWidget::onActorChanged()
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Stores the changed actor image
+ */
void MovieWidget::onChangeActorImage()
{
if (ui->actors->currentRow() < 0 || ui->actors->currentRow() >= ui->actors->rowCount() ||
@@ -748,6 +867,9 @@ void MovieWidget::onChangeActorImage()
/*** Pass GUI events to movie object ***/
+/**
+ * @brief Marks the movie as changed when the name has changed
+ */
void MovieWidget::onNameChange(QString text)
{
if (!m_movie)
@@ -756,6 +878,9 @@ void MovieWidget::onNameChange(QString text)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Marks the movie as changed when the original name has changed
+ */
void MovieWidget::onOriginalNameChange(QString text)
{
if (!m_movie)
@@ -764,6 +889,9 @@ void MovieWidget::onOriginalNameChange(QString text)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Marks the movie as changed when the set has changed
+ */
void MovieWidget::onSetChange(QString text)
{
if (!m_movie)
@@ -772,6 +900,9 @@ void MovieWidget::onSetChange(QString text)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Marks the movie as changed when the tagline has changed
+ */
void MovieWidget::onTaglineChange(QString text)
{
if (!m_movie)
@@ -780,6 +911,9 @@ void MovieWidget::onTaglineChange(QString text)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Marks the movie as changed when the rating has changed
+ */
void MovieWidget::onRatingChange(double value)
{
if (!m_movie)
@@ -788,6 +922,9 @@ void MovieWidget::onRatingChange(double value)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Marks the movie as changed when the release date has changed
+ */
void MovieWidget::onReleasedChange(QDate date)
{
if (!m_movie)
@@ -796,6 +933,9 @@ void MovieWidget::onReleasedChange(QDate date)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Marks the movie as changed when the runtime has changed
+ */
void MovieWidget::onRuntimeChange(int value)
{
if (!m_movie)
@@ -804,6 +944,9 @@ void MovieWidget::onRuntimeChange(int value)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Marks the movie as changed when the certification has changed
+ */
void MovieWidget::onCertificationChange(QString text)
{
if (!m_movie)
@@ -812,6 +955,9 @@ void MovieWidget::onCertificationChange(QString text)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Marks the movie as changed when the trailer has changed
+ */
void MovieWidget::onTrailerChange(QString text)
{
if (!m_movie)
@@ -820,6 +966,9 @@ void MovieWidget::onTrailerChange(QString text)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Marks the movie as changed when the watched state has changed
+ */
void MovieWidget::onWatchedChange(int state)
{
if (!m_movie)
@@ -828,6 +977,9 @@ void MovieWidget::onWatchedChange(int state)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Marks the movie as changed when the play count has changed
+ */
void MovieWidget::onPlayCountChange(int value)
{
if (!m_movie)
@@ -836,6 +988,9 @@ void MovieWidget::onPlayCountChange(int value)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Marks the movie as changed when the last watched date has changed
+ */
void MovieWidget::onLastWatchedChange(QDateTime dateTime)
{
if (!m_movie)
@@ -844,6 +999,9 @@ void MovieWidget::onLastWatchedChange(QDateTime dateTime)
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Marks the movie as changed when the overview has changed
+ */
void MovieWidget::onOverviewChange()
{
if (!m_movie)
View
3 MovieWidget.h
@@ -15,6 +15,9 @@ namespace Ui {
class MovieWidget;
}
+/**
+ * @brief The MovieWidget class
+ */
class MovieWidget : public QWidget
{
Q_OBJECT
View
11 SetsWidget.cpp
@@ -10,6 +10,10 @@
#include "MessageBox.h"
#include "MovieListDialog.h"
+/**
+ * @brief SetsWidget::SetsWidget
+ * @param parent
+ */
SetsWidget::SetsWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::SetsWidget)
@@ -43,11 +47,18 @@ SetsWidget::SetsWidget(QWidget *parent) :
clear();
}
+/**
+ * @brief SetsWidget::~SetsWidget
+ */
SetsWidget::~SetsWidget()
{
delete ui;
}
+/**
+ * @brief Returns the splitter
+ * @return The splitter
+ */
QSplitter *SetsWidget::splitter()
{
return ui->splitter;
View
3 SetsWidget.h
@@ -10,6 +10,9 @@ namespace Ui {
class SetsWidget;
}
+/**
+ * @brief The SetsWidget class
+ */
class SetsWidget : public QWidget
{
Q_OBJECT
View
149 SettingsWidget.cpp
@@ -8,6 +8,10 @@
SettingsWidget *SettingsWidget::m_instance;
+/**
+ * @brief SettingsWidget::SettingsWidget
+ * @param parent
+ */
SettingsWidget::SettingsWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::SettingsWidget)
@@ -72,20 +76,29 @@ SettingsWidget::SettingsWidget(QWidget *parent) :
this->loadSettings();
}
+/**
+ * @brief SettingsWidget::~SettingsWidget
+ */
SettingsWidget::~SettingsWidget()
{
delete ui;
}
+/**
+ * @brief Returns an instance of the settings widget
+ * @return Instance of SettingsWidget
+ */
SettingsWidget *SettingsWidget::instance()
{
return m_instance;
}
+/**
+ * @brief Loads all settings
+ */
void SettingsWidget::loadSettings()
{
// Globals
- m_firstTime = m_settings.value("FirstTime", true).toBool();
m_mainWindowSize = m_settings.value("MainWindowSize").toSize();
m_mainWindowPosition = m_settings.value("MainWindowPosition").toPoint();
m_movieSplitterState = m_settings.value("MovieSplitterState").toByteArray();
@@ -177,10 +190,12 @@ void SettingsWidget::loadSettings()
ui->inputThumbnailPath->setToolTip(m_xbmcThumbnailPath);
}
+/**
+ * @brief Saves all settings
+ */
void SettingsWidget::saveSettings()
{
bool mediaInterfaceChanged = false;
- m_settings.setValue("FirstTime", false);
m_settings.beginWriteArray("Directories/Movies");
for (int i=0, n=m_movieDirectories.count() ; i<n ; ++i) {
@@ -242,10 +257,13 @@ void SettingsWidget::saveSettings()
Manager::instance()->setupMediaCenterInterface();
if (mediaInterfaceChanged) {
// TvShow File Searcher is started when Movie File Searcher has finished @see MainWindow.cpp
- QTimer::singleShot(0, FilesWidget::instance(), SLOT(startSearch()));
+ Manager::instance()->movieFileSearcher()->start();
}
}
+/**
+ * @brief Adds a movie directory
+ */
void SettingsWidget::addMovieDir()
{
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose a directory containing your movies"), QDir::homePath());
@@ -274,6 +292,9 @@ void SettingsWidget::addMovieDir()
}
}
+/**
+ * @brief Removes a movie directory
+ */
void SettingsWidget::removeMovieDir()
{
int row = ui->movieDirs->currentRow();
@@ -284,11 +305,18 @@ void SettingsWidget::removeMovieDir()
ui->movieDirs->removeRow(row);
}
+/**
+ * @brief Enables/disables the button to remove a movie dir
+ * @param currentRow Current row in the movie list
+ */
void SettingsWidget::movieListRowChanged(int currentRow)
{
ui->buttonRemoveMovieDir->setDisabled(currentRow < 0);
}
+/**
+ * @brief Adds a tv show dir
+ */
void SettingsWidget::addTvShowDir()
{
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose a directory containing your TV shows"), QDir::homePath());
@@ -314,6 +342,9 @@ void SettingsWidget::addTvShowDir()
}
}
+/**
+ * @brief Removes a tv show dir
+ */
void SettingsWidget::removeTvShowDir()
{
int row = ui->tvShowDirs->currentRow();
@@ -324,11 +355,19 @@ void SettingsWidget::removeTvShowDir()
ui->tvShowDirs->removeRow(row);
}
+/**
+ * @brief Enables/Disables the button to remove a tv show dir
+ * @param currentRow Current selected row in the list of tv show dirs
+ */
void SettingsWidget::tvShowListRowChanged(int currentRow)
{
ui->buttonRemoveTvShowDir->setDisabled(currentRow < 0);
}
+/**
+ * @brief Stores the values from the list for movie directories
+ * @param item Current item
+ */
void SettingsWidget::movieMediaCenterPathChanged(QTableWidgetItem *item)
{
if (item->row() < 0 || item->row() >= m_movieDirectories.count())
@@ -340,13 +379,20 @@ void SettingsWidget::movieMediaCenterPathChanged(QTableWidgetItem *item)
m_movieDirectories[item->row()].separateFolders = item->checkState() == Qt::Checked;
}
+/**
+ * @brief Stores the values from the list for tv show directories
+ * @param item Current item
+ */
void SettingsWidget::tvShowMediaCenterPathChanged(QTableWidgetItem *item)
{
if (item->row() < 0 || item->row() >= m_tvShowDirectories.count() || item->column() != 1)
return;
m_tvShowDirectories[item->row()].mediaCenterPath = item->text();
}
+/**
+ * @brief Handles status of MediaCenter checkboxes and inputs
+ */
void SettingsWidget::onMediaCenterXbmcXmlSelected()
{
ui->radioXbmcXml->setChecked(true);
@@ -355,6 +401,9 @@ void SettingsWidget::onMediaCenterXbmcXmlSelected()
setXbmcThumbnailPathEnabled(false);
}
+/**
+ * @brief Handles status of MediaCenter checkboxes and inputs
+ */
void SettingsWidget::onMediaCenterXbmcMysqlSelected()
{
ui->radioXbmcMysql->setChecked(true);
@@ -363,6 +412,9 @@ void SettingsWidget::onMediaCenterXbmcMysqlSelected()
setXbmcThumbnailPathEnabled(true);
}
+/**
+ * @brief Handles status of MediaCenter checkboxes and inputs
+ */
void SettingsWidget::onMediaCenterXbmcSqliteSelected()
{
ui->radioXbmcSqlite->setChecked(true);
@@ -371,6 +423,9 @@ void SettingsWidget::onMediaCenterXbmcSqliteSelected()
setXbmcThumbnailPathEnabled(true);
}
+/**
+ * @brief Handles status of MediaCenter checkboxes and inputs
+ */
void SettingsWidget::onChooseMediaCenterXbmcSqliteDatabase()
{
QFileDialog dialog(this);
@@ -385,6 +440,9 @@ void SettingsWidget::onChooseMediaCenterXbmcSqliteDatabase()
}
}
+/**
+ * @brief Shows a dialog to choose the thumbnail directory
+ */
void SettingsWidget::onChooseXbmcThumbnailPath()
{
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose a directory containing your Thumbnails"), QDir::homePath());
@@ -395,6 +453,10 @@ void SettingsWidget::onChooseXbmcThumbnailPath()
}
}
+/**
+ * @brief Enables or disables the thumbnail path
+ * @param enabled Status
+ */
void SettingsWidget::setXbmcThumbnailPathEnabled(bool enabled)
{
ui->inputThumbnailPath->setEnabled(enabled);
@@ -405,107 +467,178 @@ void SettingsWidget::setXbmcThumbnailPathEnabled(bool enabled)
/*** GETTER ***/
+/**
+ * @brief Returns the stored size of the main window
+ * @return Size of the main window
+ */
QSize SettingsWidget::mainWindowSize()
{
return m_mainWindowSize;
}
+/**
+ * @brief Returns the stored position of the main window
+ * @return Position of the main window
+ */
QPoint SettingsWidget::mainWindowPosition()
{
return m_mainWindowPosition;
}
+/**
+ * @brief Returns the state of the movie splitter
+ * @return State of the movie splitter
+ */
QByteArray SettingsWidget::movieSplitterState()
{
return m_movieSplitterState;
}
+/**
+ * @brief Returns the state of the tv show splitter
+ * @return State of the tv show splitter
+ */
QByteArray SettingsWidget::tvShowSplitterState()
{
return m_tvShowSplitterState;
}
+/**
+ * @brief Returns the state of the sets splitter
+ * @return State of the sets splitter
+ */
QByteArray SettingsWidget::movieSetsSplitterState()
{
return m_movieSetsSplitterState;
}
+/**
+ * @brief Returns a list of movie directories
+ * @return List of movie directories
+ */
QList<SettingsDir> SettingsWidget::movieDirectories()
{
return m_movieDirectories;
}
+/**
+ * @brief Returns a list of tv show directories
+ * @return List of tv show directories
+ */
QList<SettingsDir> SettingsWidget::tvShowDirectories()
{
return m_tvShowDirectories;
}
-bool SettingsWidget::firstTime()
-{
- return m_firstTime;
-}
-
+/**
+ * @brief Returns the number of the chosen MediaCenterInterface
+ * @return Number of the chosen MediaCenterInterface
+ */
int SettingsWidget::mediaCenterInterface()
{
return m_mediaCenterInterface;
}
+/**
+ * @brief Returns the host of the MySQL database
+ * @return Host of the MySQL db
+ */
QString SettingsWidget::xbmcMysqlHost()
{
return m_xbmcMysqlHost;
}
+/**
+ * @brief Returns the name of the MySQL database
+ * @return Name of the MySQL db
+ */
QString SettingsWidget::xbmcMysqlDatabase()
{
return m_xbmcMysqlDatabase;
}
+/**
+ * @brief Returns the user of the MySQL database
+ * @return User of the MySQL db
+ */
QString SettingsWidget::xbmcMysqlUser()
{
return m_xbmcMysqlUser;
}
+/**
+ * @brief Returns the password of the MySQL database
+ * @return Password of the MySQL db
+ */
QString SettingsWidget::xbmcMysqlPassword()
{
return m_xbmcMysqlPassword;
}
+/**
+ * @brief Returns the path to the SQLite database
+ * @return Path to SQLite database
+ */
QString SettingsWidget::xbmcSqliteDatabase()
{
return m_xbmcSqliteDatabase;
}
+/**
+ * @brief Returns the path to the thumbnails
+ * @return Path to thumbnails
+ */
QString SettingsWidget::xbmcThumbnailPath()
{
return m_xbmcThumbnailPath;
}
/*** SETTER ***/
+/**
+ * @brief Sets the size of the main window
+ * @param mainWindowSize Size of the main window
+ */
void SettingsWidget::setMainWindowSize(QSize mainWindowSize)
{
m_mainWindowSize = mainWindowSize;
m_settings.setValue("MainWindowSize", mainWindowSize);
}
+/**
+ * @brief Sets the position of the main window
+ * @param mainWindowPosition Position of the main window
+ */
void SettingsWidget::setMainWindowPosition(QPoint mainWindowPosition)
{
m_mainWindowPosition = mainWindowPosition;
m_settings.setValue("MainWindowPosition", mainWindowPosition);
}
+/**
+ * @brief Sets the state of the movie splitter
+ * @param state State of the splitter
+ */
void SettingsWidget::setMovieSplitterState(QByteArray state)
{
m_movieSplitterState = state;
m_settings.setValue("MovieSplitterState", state);
}
+/**
+ * @brief Sets the state of the tv show splitter
+ * @param state State of the splitter
+ */
void SettingsWidget::setTvShowSplitterState(QByteArray state)
{
m_tvShowSplitterState = state;
m_settings.setValue("TvShowSplitterState", state);
}
+/**
+ * @brief Sets the state of the movie sets splitter
+ * @param state State of the splitter
+ */
void SettingsWidget::setMovieSetsSplitterState(QByteArray state)
{
m_movieSetsSplitterState = state;
View
5 SettingsWidget.h
@@ -10,6 +10,9 @@ namespace Ui {
class SettingsWidget;
}
+/**
+ * @brief The SettingsWidget class
+ */
class SettingsWidget : public QWidget
{
Q_OBJECT
@@ -26,7 +29,6 @@ class SettingsWidget : public QWidget
QByteArray movieSetsSplitterState();
QList<SettingsDir> movieDirectories();
QList<SettingsDir> tvShowDirectories();
- bool firstTime();
int mediaCenterInterface();
QString xbmcMysqlHost();
QString xbmcMysqlDatabase();
@@ -69,7 +71,6 @@ private slots:
QByteArray m_movieSplitterState;
QByteArray m_tvShowSplitterState;
QByteArray m_movieSetsSplitterState;
- bool m_firstTime;
int m_mediaCenterInterface;
QString m_xbmcMysqlHost;
QString m_xbmcMysqlDatabase;
View
32 TvShowFilesWidget.cpp
@@ -7,6 +7,10 @@
TvShowFilesWidget *TvShowFilesWidget::m_instance;
+/**
+ * @brief TvShowFilesWidget::TvShowFilesWidget
+ * @param parent
+ */
TvShowFilesWidget::TvShowFilesWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::TvShowFilesWidget)
@@ -37,32 +41,45 @@ TvShowFilesWidget::TvShowFilesWidget(QWidget *parent) :
connect(ui->files->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(onItemActivated(QModelIndex,QModelIndex)));
}
+/**
+ * @brief TvShowFilesWidget::~TvShowFilesWidget
+ */
TvShowFilesWidget::~TvShowFilesWidget()
{
delete ui;
}
+/**
+ * @brief Returns the current instance of the widget
+ * @return Current instance of TvShowFilesWidget
+ */
TvShowFilesWidget *TvShowFilesWidget::instance()
{
return m_instance;
}
+/**
+ * @brief Sets a filter
+ * @param filter Filter text
+ */
void TvShowFilesWidget::setFilter(QString filter)
{
m_tvShowProxyModel->setFilterWildcard("*" + filter + "*");
}
-void TvShowFilesWidget::startSearch()
-{
- Manager::instance()->tvShowFileSearcher()->start();
-}
-
+/**
+ * @brief Renews the model (necessary after searching for tv shows)
+ */
void TvShowFilesWidget::renewModel()
{
m_tvShowProxyModel->setSourceModel(0);
m_tvShowProxyModel->setSourceModel(Manager::instance()->tvShowModel());
}
+/**
+ * @brief Collapses or expands items
+ * @param index
+ */
void TvShowFilesWidget::onItemClicked(QModelIndex index)
{
QModelIndex sourceIndex = m_tvShowProxyModel->mapToSource(index);
@@ -80,6 +97,11 @@ void TvShowFilesWidget::onItemClicked(QModelIndex index)
}
}
+/**
+ * @brief Emits sigTvShowSelected or sigEpisodeSelected
+ * @param index
+ * @param previous
+ */
void TvShowFilesWidget::onItemActivated(QModelIndex index, QModelIndex previous)
{
Q_UNUSED(previous);
View
6 TvShowFilesWidget.h
@@ -13,6 +13,9 @@ namespace Ui {
class TvShowFilesWidget;
}
+/**
+ * @brief The TvShowFilesWidget class
+ */
class TvShowFilesWidget : public QWidget
{
Q_OBJECT
@@ -24,9 +27,6 @@ class TvShowFilesWidget : public QWidget
void setFilter(QString filter);
static TvShowFilesWidget *instance();
-public slots:
- void startSearch();
-
signals:
void sigEpisodeSelected(TvShowEpisode *episode);
void sigTvShowSelected(TvShow *show);
View
43 TvShowSearch.cpp
@@ -3,6 +3,10 @@
#include "Manager.h"
+/**
+ * @brief TvShowSearch::TvShowSearch
+ * @param parent
+ */
TvShowSearch::TvShowSearch(QWidget *parent) :
QDialog(parent),
ui(new Ui::TvShowSearch)
@@ -24,11 +28,19 @@ TvShowSearch::TvShowSearch(QWidget *parent) :
connect(ui->buttonClose, SIGNAL(clicked()), this, SLOT(reject()));
}
+/**
+ * @brief TvShowSearch::~TvShowSearch
+ */
TvShowSearch::~TvShowSearch()
{
delete ui;
}
+/**
+ * @brief Returns the instance of the dialog
+ * @param parent Parent widget (used only the first time for constructing)
+ * @return Instance of the dialog
+ */
TvShowSearch* TvShowSearch::instance(QWidget *parent)
{
static TvShowSearch *m_instance = 0;
@@ -38,6 +50,11 @@ TvShowSearch* TvShowSearch::instance(QWidget *parent)
return m_instance;
}
+/**
+ * @brief Adjusts size and executes the dialog
+ * @param searchString String to search for
+ * @return Result of QDialog::exec
+ */
int TvShowSearch::exec(QString searchString)
{
QSize newSize;
@@ -50,19 +67,29 @@ int TvShowSearch::exec(QString searchString)
return QDialog::exec();
}
+/**
+ * @brief Clears the widgets contents
+ */
void TvShowSearch::clear()
{
ui->results->clearContents();
ui->results->setRowCount(0);
}
+/**
+ * @brief Tells the current scraper to search
+ */
void TvShowSearch::onSearch()
{
clear();
ui->searchString->setLoading(true);
Manager::instance()->tvScrapers().at(0)->search(ui->searchString->text());
}
+/**
+ * @brief Displays the results from the scraper
+ * @param results List of results
+ */
void TvShowSearch::onShowResults(QList<ScraperSearchResult> results)
{
ui->searchString->setLoading(false);
@@ -76,24 +103,40 @@ void TvShowSearch::onShowResults(QList<ScraperSearchResult> results)
}
}
+/**
+ * @brief Stores the clicked id and accepts the dialog
+ * @param item Item which was clicked
+ */
void TvShowSearch::onResultClicked(QTableWidgetItem *item)
{
m_scraperId = item->data(Qt::UserRole).toString();
this->accept();
}
+/**
+ * @brief Toggles the visibility of the "Update all episodes" checkbox
+ * @param visible Visibility
+ */
void TvShowSearch::setChkUpdateAllVisible(bool visible)
{
ui->chkUpdateAllEpisodes->setVisible(visible);
}
/*** GETTER ***/
+/**
+ * @brief Returns the id of the current scraper
+ * @return Id of the current scraper
+ */
QString TvShowSearch::scraperId()
{
return m_scraperId;
}
+/**
+ * @brief Returns the state of the "Update all episodes" checkbox
+ * @return Is update all episodes checked
+ */
bool TvShowSearch::updateAll()
{
return ui->chkUpdateAllEpisodes->isChecked();
View
3 TvShowSearch.h
@@ -9,6 +9,9 @@ namespace Ui {
class TvShowSearch;
}
+/**
+ * @brief The TvShowSearch class
+ */
class TvShowSearch : public QDialog
{
Q_OBJECT
View
36 TvShowWidget.cpp
@@ -5,6 +5,10 @@
#include "Manager.h"
#include "MessageBox.h"
+/**
+ * @brief TvShowWidget::TvShowWidget
+ * @param parent
+ */
TvShowWidget::TvShowWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::TvShowWidget)
@@ -20,29 +24,46 @@ TvShowWidget::TvShowWidget(QWidget *parent) :
connect(ui->tvShowWidget, SIGNAL(sigDownloadsFinished(int)), this, SIGNAL(sigDownloadsFinished(int)));
}
+/**
+ * @brief TvShowWidget::~TvShowWidget
+ */
TvShowWidget::~TvShowWidget()
{
delete ui;
}
+/**
+ * @brief Clears the subwidgets
+ */
void TvShowWidget::onClear()
{
ui->episodeWidget->onClear();
ui->tvShowWidget->onClear();
}
+/**
+ * @brief Shows the tv show widget and sets the show
+ * @param show Current show object
+ */
void TvShowWidget::onTvShowSelected(TvShow *show)
{
ui->stackedWidget->setCurrentIndex(0);
ui->tvShowWidget->setTvShow(show);
}
+/**
+ * @brief Shows the episode widget and set the episode
+ * @param episode Current episode object
+ */
void TvShowWidget::onEpisodeSelected(TvShowEpisode *episode)
{
ui->stackedWidget->setCurrentIndex(1);
ui->episodeWidget->setEpisode(episode);
}
+/**
+ * @brief Sets the subwidgets enabled if there are no downloads
+ */
void TvShowWidget::onSetEnabledTrue(TvShow *show)
{
if (show && show->downloadsInProgress())
@@ -54,6 +75,9 @@ void TvShowWidget::onSetEnabledTrue(TvShow *show)
emit sigSetActionSearchEnabled(true, WidgetTvShows);
}
+/**
+ * @brief Sets the subwidgets enabled if there are no downloads
+ */
void TvShowWidget::onSetEnabledTrue(TvShowEpisode *episode)
{
if (episode && episode->tvShow() && episode->tvShow()->downloadsInProgress())
@@ -65,6 +89,9 @@ void TvShowWidget::onSetEnabledTrue(TvShowEpisode *episode)
emit sigSetActionSearchEnabled(true, WidgetTvShows);
}
+/**
+ * @brief Sets the subwidgets disabled
+ */
void TvShowWidget::onSetDisabledTrue()
{
ui->episodeWidget->onSetEnabled(false);
@@ -73,6 +100,9 @@ void TvShowWidget::onSetDisabledTrue()
emit sigSetActionSearchEnabled(false, WidgetTvShows);
}
+/**
+ * @brief Delegates the save event to the current subwidget
+ */
void TvShowWidget::onSaveInformation()
{
if (ui->stackedWidget->currentIndex() == 0)
@@ -81,6 +111,9 @@ void TvShowWidget::onSaveInformation()
ui->episodeWidget->onSaveInformation();
}
+/**
+ * @brief Saves all changed tv shows and episodes
+ */
void TvShowWidget::onSaveAll()
{
QList<TvShow*> shows = Manager::instance()->tvShowModel()->tvShows();
@@ -116,6 +149,9 @@ void TvShowWidget::onSaveAll()
MessageBox::instance()->showMessage(tr("All TV Shows and Episodes Saved"));
}
+/**
+ * @brief Delegates the search to the current subwidget
+ */
void TvShowWidget::onStartScraperSearch()
{
if (ui->stackedWidget->currentIndex() == 0)
View
3 TvShowWidget.h
@@ -9,6 +9,9 @@ namespace Ui {
class TvShowWidget;
}
+/**
+ * @brief The TvShowWidget class
+ */
class TvShowWidget : public QWidget
{
Q_OBJECT
View
101 TvShowWidgetEpisode.cpp
@@ -9,6 +9,10 @@
#include "MovieImageDialog.h"
#include "TvShowSearch.h"
+/**
+ * @brief TvShowWidgetEpisode::TvShowWidgetEpisode
+ * @param parent
+ */
TvShowWidgetEpisode::TvShowWidgetEpisode(QWidget *parent) :
QWidget(parent),
ui(new Ui::TvShowWidgetEpisode)
@@ -81,17 +85,27 @@ TvShowWidgetEpisode::TvShowWidgetEpisode(QWidget *parent) :
ui->buttonRevert->setVisible(false);
}
+/**
+ * @brief TvShowWidgetEpisode::~TvShowWidgetEpisode
+ */
TvShowWidgetEpisode::~TvShowWidgetEpisode()
{
delete ui;
}
+/**
+ * @brief Repositions the saving widget
+ * @param event
+ */
void TvShowWidgetEpisode::resizeEvent(QResizeEvent *event)
{
m_savingWidget->move(size().width()/2-m_savingWidget->width(), height()/2-m_savingWidget->height());
QWidget::resizeEvent(event);
}
+/**
+ * @brief Clears all contents
+ */
void TvShowWidgetEpisode::onClear()
{
ui->tabWidget->setCurrentIndex(0);
@@ -116,18 +130,29 @@ void TvShowWidgetEpisode::onClear()
ui->buttonRevert->setVisible(false);
}
+/**
+ * @brief Sets the enabled status of the main group box
+ * @param enabled Status
+ */
void TvShowWidgetEpisode::onSetEnabled(bool enabled)
{
ui->groupBox_3->setEnabled(enabled);
}
+/**
+ * @brief Sets the episode and tells the episode to load its images
+ * @param episode Episode to set
+ */
void TvShowWidgetEpisode::setEpisode(TvShowEpisode *episode)
{
m_episode = episode;
episode->loadImages(Manager::instance()->mediaCenterInterfaceTvShow());
updateEpisodeInfo();
}
+/**
+ * @brief Updates the widgets contents with the episode info
+ */
void TvShowWidgetEpisode::updateEpisodeInfo()
{
if (m_episode == 0)
@@ -210,6 +235,9 @@ void TvShowWidgetEpisode::updateEpisodeInfo()
ui->buttonRevert->setVisible(m_episode->hasChanged());
}
+/**
+ * @brief Saves episodes infos
+ */
void TvShowWidgetEpisode::onSaveInformation()
{
if (m_episode == 0)
@@ -224,13 +252,19 @@ void TvShowWidgetEpisode::onSaveInformation()
MessageBox::instance()->showMessage(tr("Episode Saved"));
}
+/**
+ * @brief Reverts changes
+ */
void TvShowWidgetEpisode::onRevertChanges()
{
m_episode->loadData(Manager::instance()->mediaCenterInterfaceTvShow());
m_episode->loadImages(Manager::instance()->mediaCenterInterfaceTvShow());
updateEpisodeInfo();
}
+/**
+ * @brief Shows the search widget
+ */
void TvShowWidgetEpisode::onStartScraperSearch()
{
if (m_episode == 0)
@@ -249,6 +283,10 @@ void TvShowWidgetEpisode::onStartScraperSearch()
}
}
+/**
+ * @brief Called when the search widget finishes
+ * Updates infos and starts downloads
+ */
void TvShowWidgetEpisode::onLoadDone()
{
if (m_episode == 0)
@@ -273,6 +311,9 @@ void TvShowWidgetEpisode::onLoadDone()
ui->buttonRevert->setVisible(true);
}
+/**
+ * @brief Shows the MovieImageDialog and after successful execution starts downloads
+ */
void TvShowWidgetEpisode::onChooseThumbnail()
{
qDebug() << Q_FUNC_INFO;
@@ -306,6 +347,10 @@ void TvShowWidgetEpisode::onChooseThumbnail()
}
}
+/**
+ * @brief Adjusts the size of the backdrop to common values (1080p or 720p) and shows the image
+ * @param elem Downloaded element
+ */
void TvShowWidgetEpisode::onPosterDownloadFinished(DownloadManagerElement elem)
{
if (elem.imageType == TypeBackdrop) {
@@ -333,6 +378,9 @@ void TvShowWidgetEpisode::onPosterDownloadFinished(DownloadManagerElement elem)
/*** add/remove/edit Actors, Genres, Countries and Studios ***/
+/**
+ * @brief Adds a director
+ */
void TvShowWidgetEpisode::onAddDirector()
{
QString d = tr("Unknown Director");
@@ -349,6 +397,9 @@ void TvShowWidgetEpisode::onAddDirector()
ui->buttonRevert->setVisible(true);
}