#include "anidbconfigdialog.h"
#include "ui_anidbconfigdialog.h"
+#include <QDir>
+
AniDBConfigDialog::AniDBConfigDialog(QWidget *parent) :
QDialog(parent),
m_ui(new Ui::AniDBConfigDialog)
m_ui->automark->setValue(percent);
}
+QStringList AniDBConfigDialog::paths() const
+{
+ return QDir::fromNativeSeparators(m_ui->paths->text()).split(';');
+}
+
+void AniDBConfigDialog::setPaths(const QStringList &paths)
+{
+ m_ui->paths->setText(QDir::toNativeSeparators(paths.join(";")));
+}
+
AniDBConfigDialog::~AniDBConfigDialog()
{
delete m_ui;
int automark() const;
void setAutomark(int percent);
+ QStringList paths() const;
+ void setPaths(const QStringList &paths);
+
protected:
virtual void changeEvent(QEvent *e);
<property name="text">
<string>Host:</string>
</property>
+ <property name="buddy">
+ <cstring>host</cstring>
+ </property>
</widget>
</item>
<item row="0" column="1">
<property name="text">
<string>Port:</string>
</property>
+ <property name="buddy">
+ <cstring>hostPort</cstring>
+ </property>
</widget>
</item>
<item row="1" column="1">
<property name="text">
<string>Local Port:</string>
</property>
+ <property name="buddy">
+ <cstring>localPort</cstring>
+ </property>
</widget>
</item>
<item row="2" column="1">
<property name="text">
<string>User:</string>
</property>
+ <property name="buddy">
+ <cstring>user</cstring>
+ </property>
</widget>
</item>
<item row="3" column="1">
<property name="text">
<string>Password:</string>
</property>
+ <property name="buddy">
+ <cstring>pass</cstring>
+ </property>
</widget>
</item>
<item row="4" column="1">
<property name="text">
<string>Automark on:</string>
</property>
+ <property name="buddy">
+ <cstring>automark</cstring>
+ </property>
</widget>
</item>
<item row="5" column="1">
</property>
</widget>
</item>
+ <item row="6" column="1">
+ <widget class="QLineEdit" name="paths"/>
+ </item>
+ <item row="6" column="0">
+ <widget class="QLabel" name="lPaths">
+ <property name="text">
+ <string>Paths:</string>
+ </property>
+ <property name="buddy">
+ <cstring>paths</cstring>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
+ <x>257</x>
+ <y>290</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
+ <x>325</x>
+ <y>290</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
return;
}
- AniDBUdpClient::Hash *h = new AniDBUdpClient::Hash(this);
- h->hashFile(fileInfo);
-
-
playlist->setDirectory(fileInfo.absoluteDir());
playlist->setCurrent(playlist->indexOfFile(file));
Phonon::MediaSource mediaSource(file);
videoPlayer->open(mediaSource);
+#ifndef NO_ANIDBUDPCLIENT
+ updateAutomarkable();
+#endif
+
m_closeOnStop = closeOnStop;
}
menu->tick(time);
#ifndef NO_ANIDBUDPCLIENT
- if (!m_automark || m_marked)
+ if (!m_automarkable || !m_automark || m_marked)
return;
int percentPlayed = int(double(time) / double(videoPlayer->totalTime()) * double(100));
dialog.setUser(anidb->user());
dialog.setPass(anidb->pass());
dialog.setAutomark(m_automark);
+ dialog.setPaths(m_automarkPaths);
if (!dialog.exec())
{
anidb->setUser(dialog.user());
anidb->setPass(dialog.pass());
m_automark = dialog.automark();
+ m_automarkPaths = dialog.paths();
+
+ updateAutomarkable();
+}
+
+void VideoWindow::updateAutomarkable()
+{
+ if (m_automarkPaths.isEmpty())
+ {
+ m_automarkable = true;
+ }
+ else
+ {
+ m_automarkable = false;
+ QString absoluteFilePath = QFileInfo(videoPlayer->currentFile()).absoluteFilePath();
+qDebug() << "FULL" << absoluteFilePath;
+ foreach (const QString &p, m_automarkPaths)
+ {
+qDebug() << "PART" << p;
+ if (absoluteFilePath.startsWith(p, Qt::CaseSensitive))
+ {
+ m_automarkable = true;
+ break;
+ }
+ }
+ }
}
#endif
settings.setValue("user", anidb->user());
settings.setValue("pass", anidb->pass());
settings.setValue("automark", m_automark);
+ settings.setValue("paths", m_automarkPaths);
settings.endGroup();
# endif
#endif
anidb->setUser(settings.value("user").toString());
anidb->setPass(settings.value("pass").toString());
m_automark = settings.value("automark", 0).toInt();
+ m_automarkPaths = settings.value("paths", QStringList()).toStringList();
settings.endGroup();
# endif
#endif
void showMarkResult(bool success);
void anidbSettings();
+ void updateAutomarkable();
+
#endif
private:
void addAction(const QString &name, const QString &text, const QKeySequence &shortcut = QKeySequence(), bool checkable = false);
#ifndef NO_ANIDBUDPCLIENT
int m_automark;
+ QStringList m_automarkPaths;
bool m_marked;
+ bool m_automarkable;
AniDBUdpClient::Client *anidb;
AniDBUdpClient::MylistAddCommand *addCommand;
#endif