--- /dev/null
+#include "configdialog.h"
+#include "ui_configdialog.h"
+
+#include <QDir>
+
+ConfigDialog::ConfigDialog(QWidget *parent) :
+ QDialog(parent),
+ m_ui(new Ui::ConfigDialog)
+{
+ m_ui->setupUi(this);
+}
+
+int ConfigDialog::automark() const
+{
+ return m_ui->automark->value();
+}
+
+void ConfigDialog::setAutomark(int percent)
+{
+ m_ui->automark->setValue(percent);
+}
+
+QStringList ConfigDialog::paths() const
+{
+ return QDir::fromNativeSeparators(m_ui->paths->text()).split(';');
+}
+
+void ConfigDialog::setPaths(const QStringList &paths)
+{
+ m_ui->paths->setText(QDir::toNativeSeparators(paths.join(";")));
+}
+
+int ConfigDialog::opSkip() const
+{
+ return m_ui->opSkip->value();
+}
+
+void ConfigDialog::setOpSkip(int seconds)
+{
+ m_ui->opSkip->setValue(seconds);
+}
+
+ConfigDialog::~ConfigDialog()
+{
+ delete m_ui;
+}
+
+void ConfigDialog::changeEvent(QEvent *e)
+{
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ m_ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
--- /dev/null
+#ifndef ANIDBCONFIGDIALOG_H
+#define ANIDBCONFIGDIALOG_H
+
+#include <QDialog>
+
+namespace Ui {
+ class ConfigDialog;
+}
+
+class ConfigDialog : public QDialog {
+ Q_OBJECT
+ Q_DISABLE_COPY(ConfigDialog)
+public:
+ explicit ConfigDialog(QWidget *parent = 0);
+ virtual ~ConfigDialog();
+
+ int automark() const;
+ void setAutomark(int percent);
+
+ QStringList paths() const;
+ void setPaths(const QStringList &paths);
+
+ int opSkip() const;
+ void setOpSkip(int seconds);
+
+protected:
+ virtual void changeEvent(QEvent *e);
+
+private:
+ Ui::ConfigDialog *m_ui;
+
+};
+
+#endif // ANIDBCONFIGDIALOG_H
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ConfigDialog</class>
+ <widget class="QDialog" name="ConfigDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>302</width>
+ <height>185</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>AniPlayer Settings</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Automark</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="lAutomark">
+ <property name="text">
+ <string>Automark on:</string>
+ </property>
+ <property name="buddy">
+ <cstring>automark</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="automark">
+ <property name="specialValueText">
+ <string>Disabled</string>
+ </property>
+ <property name="suffix">
+ <string>%</string>
+ </property>
+ <property name="minimum">
+ <number>0</number>
+ </property>
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="lPaths">
+ <property name="text">
+ <string>Paths:</string>
+ </property>
+ <property name="buddy">
+ <cstring>paths</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="paths"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="title">
+ <string>OP/ED skip</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout_3">
+ <item row="0" column="0">
+ <widget class="QLabel" name="lOpSkip">
+ <property name="text">
+ <string>Skip:</string>
+ </property>
+ <property name="buddy">
+ <cstring>opSkip</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QSpinBox" name="opSkip">
+ <property name="suffix">
+ <string>s</string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>1000</number>
+ </property>
+ <property name="singleStep">
+ <number>5</number>
+ </property>
+ <property name="value">
+ <number>85</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>automark</tabstop>
+ <tabstop>paths</tabstop>
+ <tabstop>opSkip</tabstop>
+ <tabstop>buttonBox</tabstop>
+ </tabstops>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>ConfigDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>292</x>
+ <y>397</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>426</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>ConfigDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>292</x>
+ <y>397</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>548</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
{
if (a.arguments().count() > 1)
a.sendMessage("open " + a.arguments().at(1));
-
return 0;
}
MainWindow w;
+ a.setActivationWindow(&w);
+
QObject::connect(&a, SIGNAL(openFileRequested(QString)), &w, SLOT(play(QString)));
w.show();
#include "seekslider.h"
#include <volumeslider.h>
#include "versiondialog.h"
+#include "configdialog.h"
#include <QDebug>
connect(player, SIGNAL(stateChanged(AniPlayer::State, AniPlayer::State)), this, SLOT(handleStateChange(AniPlayer::State,AniPlayer::State)));
// connect(videoPlayer->mediaController(), SIGNAL(availableSubtitlesChanged()), this, SLOT(updateSubtitles()));
connect(m_actions["markWatched"], SIGNAL(triggered()), player, SLOT(markWatched()));
-// connect(m_actions["settings"], SIGNAL(triggered()), this, SLOT(anidbSettings()));
+ connect(m_actions["settings"], SIGNAL(triggered()), this, SLOT(showConfigDialog()));
connect(m_actions["about"], SIGNAL(triggered()), this, SLOT(about()));
connect(m_actions["open"], SIGNAL(triggered()), this, SLOT(open()));
show();
}
+void MainWindow::showConfigDialog()
+{
+ ConfigDialog dialog(this);
+
+ dialog.setAutomark(player->automark());
+ dialog.setPaths(m_automarkPaths);
+ dialog.setOpSkip(m_opSkip);
+
+ if (!dialog.exec())
+ {
+ return;
+ }
+
+ player->setAutomark(dialog.automark());
+ m_automarkPaths = dialog.paths();
+ m_opSkip = dialog.opSkip();
+}
+
void MainWindow::chaptersChanged()
{
/*
void chaptersChanged();
void streamsChanged();
+ void showConfigDialog();
+
protected:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
int m_opSkip;
- int m_automark;
QStringList m_automarkPaths;
bool m_marked;
bool m_automarkable;
HEADERS += mainwindow.h \
menu.h \
seekslider.h \
- versiondialog.h
+ versiondialog.h \
+ configdialog.h
SOURCES += main.cpp\
mainwindow.cpp \
menu.cpp \
seekslider.cpp \
- versiondialog.cpp
+ versiondialog.cpp \
+ configdialog.cpp
FORMS += mainwindow.ui \
- menu.ui
+ menu.ui \
+ configdialog.ui
include(../config.pri)
include(../aniplayer/aniplayer.pri)