Permalink
Browse files

Fixes #60 Finally finished the docu and little cleanup

  • Loading branch information...
Daniel Kabel
Daniel Kabel committed Sep 6, 2012
1 parent 1d4fd2d commit e432c06ffa4120e6d2040d3bc0f99dd847bab9ac
View
@@ -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
@@ -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
@@ -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
@@ -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;
Oops, something went wrong.

0 comments on commit e432c06

Please sign in to comment.