#ifdef qApp
# undef qApp
-# define qApp (AniPlayer::instance())
#endif
+#define qApp (AniPlayer::instance())
class AniPlayer : public QApplication
{
--- /dev/null
+#ifndef CONSTANTS_H
+#define CONSTANTS_H
+
+#define STRINGIFY_INTERNAL(x) #x
+#define STRINGIFY(x) STRINGIFY_INTERNAL(x)
+
+#ifdef REVISION
+static const char *revisionString = STRINGIFY(REVISION);
+#else
+static const char *revisionString = "Unknown revision";
+#endif
+
+static const char *applicationName = "AniPlayer";
+static const char *applicationVersion = "1.0.0A1";
+static const char *organizationName = "APTX";
+
+#endif // CONSTANTS_H
int EpisodeVoteDialog::vote() const
{
- return qBound(1, int(m_ui->vote->value() * 10.0), 100);
+ return qBound(100, int(m_ui->vote->value() * 100.0), 1000);
}
void EpisodeVoteDialog::setVote(int value)
{
- m_ui->vote->setValue(double(value) / 10.0);
+ m_ui->vote->setValue(double(value) / 100.0);
}
void EpisodeVoteDialog::changeEvent(QEvent *e)
#include "aniplayer.h"
#include "videowindow.h"
+#include "constants.h"
+
#ifndef BROWSERPLUGIN_BUILD
int main(int argc, char *argv[])
{
- AniPlayer::setApplicationName("AniPlayer");
- AniPlayer::setOrganizationName("APTX");
- AniPlayer::setApplicationVersion("1.0.0A1");
+ AniPlayer::setApplicationName(QLatin1String(applicationName));
+ AniPlayer::setOrganizationName(QLatin1String(organizationName));
+ AniPlayer::setApplicationVersion(QLatin1String(applicationVersion));
qsrand(QTime().msecsTo(QTime::currentTime()));
# Project created by QtCreator 2009-02-11T10:09:59
# -------------------------------------------------
QT += phonon
-
unix {
message(Using system (KDE?) Phonon)
QT -= phonon
aniplayer.cpp \
directoryplaylist.cpp \
anidbconfigdialog.cpp \
- episodevotedialog.cpp
+ episodevotedialog.cpp \
+ versiondialog.cpp
HEADERS += menu.h \
videowindow.h \
videowidget.h \
abstractplaylist.h \
directoryplaylist.h \
anidbconfigdialog.h \
- episodevotedialog.h
+ episodevotedialog.h \
+ versiondialog.h \
+ constants.h
FORMS += menu.ui \
anidbconfigdialog.ui \
episodevotedialog.ui
DEFINES += STATIC_BUILD
DESTDIR = ../build-static/
}
+REV = $$system(git show-ref -s HEAD)
+DEFINES += REVISION=\"$${REV}\"
include(../lib/anidbudpclient/anidbudpclient.pri)
--- /dev/null
+#include "versiondialog.h"
+
+#include <QGridLayout>
+#include <QLabel>
+#include <QDialogButtonBox>
+#include <QPushButton>
+
+#include "constants.h"
+#include "aniplayer.h"
+
+VersionDialog::VersionDialog(QWidget *parent) : QDialog(parent)
+{
+ setWindowTitle(tr("About %1").arg(qApp->applicationName()));
+
+ setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
+
+ QGridLayout *layout = new QGridLayout(this);
+ layout->setSizeConstraint(QLayout::SetFixedSize);
+
+ const QString description = tr(
+ "<h3>%1 %2</h3>"
+ "Built with Qt\t%3;running with Qt\t%4<br/>"
+ "<br/>"
+ "Built on " __DATE__ " at " __TIME__ " "
+#ifdef REVISION
+ "from revision %6<br/>"
+#endif
+ "<br/>"
+ "<br/>"
+ "Copyright (C) 2009 %5. All rights reserved.<br/>"
+ "<br/>"
+ "The program is provided AS IS with NO WARRANTY OF ANY KIND, "
+ "INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
+ "PARTICULAR PURPOSE.<br/>")
+ .arg(qApp->applicationName())
+ .arg(qApp->applicationVersion())
+ .arg(QLatin1String(QT_VERSION_STR))
+ .arg(QLatin1String(qVersion()))
+ .arg(qApp->organizationName())
+#ifdef REVISION
+ .arg(QLatin1String(revisionString))
+#endif
+ ; // It's important!
+
+ QLabel *copyRightLabel = new QLabel(description);
+ copyRightLabel->setWordWrap(true);
+ copyRightLabel->setOpenExternalLinks(true);
+ copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
+
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
+ QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
+
+ buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
+ connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));
+
+ layout->addWidget(copyRightLabel, 0, 1, 4, 4);
+ layout->addWidget(buttonBox, 4, 0, 1, 5);
+}
--- /dev/null
+#ifndef VERSIONDIALOG_H
+#define VERSIONDIALOG_H
+
+#include <QDialog>
+
+class VersionDialog : public QDialog
+{
+public:
+ VersionDialog(QWidget *parent = 0);
+};
+
+#endif // VERSIONDIALOG_H
#include "aniplayer.h"
#include "directoryplaylist.h"
#include "anidbconfigdialog.h"
+#include "versiondialog.h"
#include <anidbudpclient.h>
#include <rawcommand.h>
#endif
addAction("markWatched", "Mark Watched", QKeySequence("CTRL+M"));
addAction("settings", "Settings", QKeySequence("F7"));
+ addAction("about", "About", QKeySequence());
menu = new Menu(this);
menu->addActions(QWidget::actions());
connect(m_actions["markWatched"], SIGNAL(triggered()), this, SLOT(markWatched()));
connect(m_actions["settings"], SIGNAL(triggered()), this, SLOT(anidbSettings()));
+ connect(m_actions["about"], SIGNAL(triggered()), this, SLOT(about()));
connect(m_actions["open"], SIGNAL(triggered()), this, SLOT(open()));
connect(m_actions["play"], SIGNAL(triggered()), this, SLOT(play()));
mediaObject->seek(mediaObject->currentTime() + msec);
}
+void VideoWindow::about()
+{
+ VersionDialog dialog(this);
+ dialog.exec();
+}
+
void VideoWindow::handleStateChange(Phonon::State newstate, Phonon::State oldstate)
{
qDebug() << "Media changed state from" << oldstate << "to" << newstate;
void skip(int msec = 85000);
+ void about();
+
protected:
virtual void mousePressEvent(QMouseEvent *event);