removed old smplayer sources
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@364 b45a01b8-16f6-495d-af2f-9b41ad6348cc
@ -1,154 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "aboutdialog.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QTextEdit>
|
||||
#include <QPushButton>
|
||||
#include <QLayout>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
#include "images.h"
|
||||
#include "version.h"
|
||||
|
||||
AboutDialog::AboutDialog(QWidget * parent, Qt::WindowFlags f)
|
||||
: QDialog(parent, f)
|
||||
{
|
||||
setWindowTitle( tr("About SMPlayer") );
|
||||
|
||||
logo = new QLabel(this);
|
||||
logo->setPixmap( Images::icon("logo", 64) );
|
||||
|
||||
intro = new QLabel(this);
|
||||
intro->setWordWrap(true);
|
||||
|
||||
foot = new QLabel(this);
|
||||
foot->setOpenExternalLinks(true);
|
||||
|
||||
credits = new QTextEdit(this);
|
||||
credits->setReadOnly(true);
|
||||
credits->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||
|
||||
ok_button = new QDialogButtonBox( QDialogButtonBox::Ok );
|
||||
connect( ok_button, SIGNAL(accepted()), this, SLOT(accept()) );
|
||||
|
||||
QVBoxLayout * lright = new QVBoxLayout;
|
||||
lright->addWidget( intro );
|
||||
lright->addWidget( credits );
|
||||
lright->addWidget( foot );
|
||||
|
||||
QVBoxLayout * lleft = new QVBoxLayout;
|
||||
lleft->addWidget( logo );
|
||||
lleft->addStretch(1);
|
||||
|
||||
QHBoxLayout * lmain = new QHBoxLayout;
|
||||
lmain->addLayout( lleft );
|
||||
lmain->addLayout( lright );
|
||||
|
||||
QHBoxLayout * lbutton = new QHBoxLayout;
|
||||
lbutton->addStretch(1);
|
||||
lbutton->addWidget( ok_button );
|
||||
lbutton->addStretch(1);
|
||||
|
||||
QVBoxLayout * lwidget = new QVBoxLayout(this);
|
||||
lwidget->addLayout( lmain );
|
||||
//lwidget->addWidget( foot );
|
||||
lwidget->addLayout( lbutton );
|
||||
|
||||
intro->setText(
|
||||
"<b>SMPlayer</b> © 2006-2007 RVM <rvm@escomposlinux.org><br><br>"
|
||||
"<b>" + tr("Version: %1").arg(smplayerVersion()) + "</b><br>" +
|
||||
/*
|
||||
#if KDE_SUPPORT
|
||||
tr("Compiled with KDE support") + "<br>" +
|
||||
#endif
|
||||
*/
|
||||
"<br>" +
|
||||
tr("Compiled with Qt %1").arg(QT_VERSION_STR) + "<br><br>"
|
||||
"<i>" +
|
||||
tr("This program is free software; you can redistribute it and/or modify "
|
||||
"it under the terms of the GNU General Public License as published by "
|
||||
"the Free Software Foundation; either version 2 of the License, or "
|
||||
"(at your option) any later version.") + "</i>");
|
||||
|
||||
credits->setText(
|
||||
tr("Translators:") +
|
||||
"<ul>" +
|
||||
trad(tr("German"), "Henrikx") +
|
||||
trad(tr("Slovak"), "Sweto <peter.mendel@gmail.com>") +
|
||||
trad(tr("Italian"), "Giancarlo Scola <giancarlo@codexcoop.it>") +
|
||||
trad(tr("French"), tr("%1, %2 and %3")
|
||||
.arg("Olivier g <1got@caramail.com>")
|
||||
.arg("Temet <goondy@free.fr>")
|
||||
.arg("Kud Gray <kud.gray@gmail.com>") ) +
|
||||
trad(tr("Simplified-Chinese"), "Tim Green <iamtimgreen@gmail.com>") +
|
||||
trad(tr("Russian"), "Yurkovsky Andrey <anyr@tut.by>") +
|
||||
trad(tr("Hungarian"), "Charles Barcza <kbarcza@blackpanther.hu>") +
|
||||
trad(tr("Polish"), tr("%1 and %2")
|
||||
.arg("qla <qla0@vp.pl>")
|
||||
.arg("Jarek <ajep9691@wp.pl>") ) +
|
||||
trad(tr("Japanese"), "Nardog <nardog@e2umail.com>") +
|
||||
trad(tr("Dutch"), "Wesley S. <wesley@ubuntu-nl.org>") +
|
||||
trad(tr("Ukrainian"), "Motsyo Gennadi <drool@altlinux.ru>") +
|
||||
trad(tr("Portuguese - Brazil"), "Ventura <ventura.barbeiro@terra.com.br>") +
|
||||
trad(tr("Georgian"), "George Machitidze <giomac@gmail.com>") +
|
||||
trad(tr("Czech"), QString::fromUtf8("Martin Dvořák <martin.dvorak@centrum.cz>")) +
|
||||
trad(tr("Bulgarian"), "<marzeliv@mail.bg>") +
|
||||
trad(tr("Turkish"), "alper er <alperer@gmail.com>") +
|
||||
trad(tr("Swedish"), "Leif Larsson <leif.larsson@gmail.com>") +
|
||||
trad(tr("Serbian"), "Kunalagon Umuhanik <kunalagon@gmail.com>") +
|
||||
trad(tr("Traditional Chinese"), "Hoopoe <dai715.tw@yahoo.com.tw>") +
|
||||
trad(tr("Romanian"), "DoruH <doruhushhush@hotmail.com>") +
|
||||
trad(tr("Portuguese - Portugal"), "Waxman <waxman.pt@gmail.com>") +
|
||||
"</ul>" +
|
||||
tr("Logo designed by %1").arg("Charles Barcza <kbarcza@blackpanther.hu>") +
|
||||
"<br>"
|
||||
);
|
||||
|
||||
QString url;
|
||||
#ifdef Q_OS_WIN
|
||||
url = tr("http://smplayer.sourceforge.net/en/windows/download.php",
|
||||
"If the web page is translated into your language you can "
|
||||
"change the URL so it points to the download page in the translation."
|
||||
"Otherwise leave as is.");
|
||||
#else
|
||||
url = tr("http://smplayer.sourceforge.net/en/linux/download.php",
|
||||
"If the web page is translated into your language you can "
|
||||
"change the URL so it points to the download page in the translation."
|
||||
"Otherwise leave as is.");
|
||||
#endif
|
||||
|
||||
foot->setText(
|
||||
tr("Get updates at: %1")
|
||||
.arg("<br><a href=\"" + url + "\">" + url +"</a>") );
|
||||
|
||||
/*
|
||||
adjustSize();
|
||||
setFixedSize( sizeHint() );
|
||||
*/
|
||||
}
|
||||
|
||||
AboutDialog::~AboutDialog() {
|
||||
}
|
||||
|
||||
QString AboutDialog::trad(const QString & lang, const QString & author) {
|
||||
return "<li>"+ tr("<b>%1</b>: %2").arg(lang).arg(author) + "</li>";
|
||||
}
|
||||
|
||||
#include "moc_aboutdialog.cpp"
|
@ -1,54 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _ABOUTDIALOG_H_
|
||||
#define _ABOUTDIALOG_H_
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QLabel;
|
||||
class QTextEdit;
|
||||
class QDialogButtonBox;
|
||||
|
||||
//! Shows the about smplayer dialog
|
||||
|
||||
/*!
|
||||
Displays copyright info, license, translators...
|
||||
*/
|
||||
|
||||
class AboutDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AboutDialog( QWidget * parent = 0, Qt::WindowFlags f = 0 );
|
||||
~AboutDialog();
|
||||
|
||||
protected:
|
||||
//! Return a formated string with the translator and language
|
||||
QString trad(const QString & lang, const QString & author);
|
||||
|
||||
QLabel * logo;
|
||||
QLabel * intro;
|
||||
QLabel * foot;
|
||||
QTextEdit * credits;
|
||||
QDialogButtonBox * ok_button;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,611 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* This is based on qq14-actioneditor-code.zip from Qt */
|
||||
|
||||
|
||||
#include "actionseditor.h"
|
||||
|
||||
#include <QTableWidget>
|
||||
#include <QHeaderView>
|
||||
|
||||
#include <QLayout>
|
||||
#include <QObject>
|
||||
#include <QPushButton>
|
||||
#include <QString>
|
||||
#include <QSettings>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QMessageBox>
|
||||
#include <QFileInfo>
|
||||
#include <QRegExp>
|
||||
#include <QApplication>
|
||||
#include <QAction>
|
||||
|
||||
#include "images.h"
|
||||
#include "filedialog.h"
|
||||
#include "helper.h"
|
||||
|
||||
#include "shortcutgetter.h"
|
||||
|
||||
|
||||
/*
|
||||
#include <QLineEdit>
|
||||
#include <QItemDelegate>
|
||||
|
||||
class MyDelegate : public QItemDelegate
|
||||
{
|
||||
public:
|
||||
MyDelegate(QObject *parent = 0);
|
||||
|
||||
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const;
|
||||
virtual void setModelData(QWidget * editor, QAbstractItemModel * model,
|
||||
const QModelIndex & index ) const;
|
||||
};
|
||||
|
||||
MyDelegate::MyDelegate(QObject *parent) : QItemDelegate(parent)
|
||||
{
|
||||
}
|
||||
|
||||
static QString old_accel_text;
|
||||
|
||||
QWidget * MyDelegate::createEditor(QWidget *parent,
|
||||
const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index) const
|
||||
{
|
||||
qDebug("MyDelegate::createEditor");
|
||||
|
||||
old_accel_text = index.model()->data(index, Qt::DisplayRole).toString();
|
||||
//qDebug( "text: %s", old_accel_text.toUtf8().data());
|
||||
|
||||
return QItemDelegate::createEditor(parent, option, index);
|
||||
}
|
||||
|
||||
void MyDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
QLineEdit *line_edit = static_cast<QLineEdit*>(editor);
|
||||
|
||||
QString accelText = QKeySequence(line_edit->text()).toString();
|
||||
if (accelText.isEmpty() && !line_edit->text().isEmpty()) {
|
||||
model->setData(index, old_accel_text);
|
||||
}
|
||||
else {
|
||||
model->setData(index, accelText);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
#if USE_MULTIPLE_SHORTCUTS
|
||||
QString ActionsEditor::shortcutsToString(QList <QKeySequence> shortcuts_list) {
|
||||
QString accelText = "";
|
||||
|
||||
for (int n=0; n < shortcuts_list.count(); n++) {
|
||||
accelText += shortcuts_list[n].toString(QKeySequence::PortableText);
|
||||
if (n < (shortcuts_list.count()-1)) accelText += ", ";
|
||||
}
|
||||
|
||||
return accelText;
|
||||
}
|
||||
|
||||
QList <QKeySequence> ActionsEditor::stringToShortcuts(QString shortcuts) {
|
||||
QList <QKeySequence> shortcuts_list;
|
||||
|
||||
QStringList l = shortcuts.split(',');
|
||||
|
||||
for (int n=0; n < l.count(); n++) {
|
||||
//qDebug("%s", l[n].toUtf8().data());
|
||||
QString s = QKeySequence( l[n].simplified() );
|
||||
shortcuts_list.append( s );
|
||||
//qDebug("ActionsEditor::stringToShortcuts: shortcut %d: '%s'", n, s.toUtf8().data());
|
||||
}
|
||||
|
||||
return shortcuts_list;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#define COL_CONFLICTS 0
|
||||
#define COL_SHORTCUT 1
|
||||
#define COL_DESC 2
|
||||
#define COL_NAME 3
|
||||
|
||||
ActionsEditor::ActionsEditor(QWidget * parent, Qt::WindowFlags f)
|
||||
: QWidget(parent, f)
|
||||
{
|
||||
latest_dir = Helper::shortcutsPath();
|
||||
|
||||
actionsTable = new QTableWidget(0, COL_NAME +1, this);
|
||||
actionsTable->setSelectionMode( QAbstractItemView::SingleSelection );
|
||||
actionsTable->verticalHeader()->hide();
|
||||
|
||||
actionsTable->horizontalHeader()->setResizeMode(COL_DESC, QHeaderView::Stretch);
|
||||
actionsTable->horizontalHeader()->setResizeMode(COL_NAME, QHeaderView::Stretch);
|
||||
|
||||
actionsTable->setAlternatingRowColors(true);
|
||||
#if USE_SHORTCUTGETTER
|
||||
actionsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
actionsTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
#endif
|
||||
//actionsTable->setItemDelegateForColumn( COL_SHORTCUT, new MyDelegate(actionsTable) );
|
||||
|
||||
#if !USE_SHORTCUTGETTER
|
||||
connect(actionsTable, SIGNAL(currentItemChanged(QTableWidgetItem *,QTableWidgetItem *)),
|
||||
this, SLOT(recordAction(QTableWidgetItem *)) );
|
||||
connect(actionsTable, SIGNAL(itemChanged(QTableWidgetItem *)),
|
||||
this, SLOT(validateAction(QTableWidgetItem *)) );
|
||||
#else
|
||||
connect(actionsTable, SIGNAL(itemActivated(QTableWidgetItem *)),
|
||||
this, SLOT(editShortcut()) );
|
||||
#endif
|
||||
|
||||
saveButton = new QPushButton(this);
|
||||
loadButton = new QPushButton(this);
|
||||
|
||||
connect(saveButton, SIGNAL(clicked()), this, SLOT(saveActionsTable()));
|
||||
connect(loadButton, SIGNAL(clicked()), this, SLOT(loadActionsTable()));
|
||||
|
||||
#if USE_SHORTCUTGETTER
|
||||
editButton = new QPushButton(this);
|
||||
connect( editButton, SIGNAL(clicked()), this, SLOT(editShortcut()) );
|
||||
#endif
|
||||
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
||||
buttonLayout->setSpacing(8);
|
||||
#if USE_SHORTCUTGETTER
|
||||
buttonLayout->addWidget(editButton);
|
||||
#endif
|
||||
buttonLayout->addStretch(1);
|
||||
buttonLayout->addWidget(loadButton);
|
||||
buttonLayout->addWidget(saveButton);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setMargin(8);
|
||||
mainLayout->setSpacing(8);
|
||||
mainLayout->addWidget(actionsTable);
|
||||
mainLayout->addLayout(buttonLayout);
|
||||
|
||||
retranslateStrings();
|
||||
}
|
||||
|
||||
ActionsEditor::~ActionsEditor() {
|
||||
}
|
||||
|
||||
void ActionsEditor::retranslateStrings() {
|
||||
actionsTable->setHorizontalHeaderLabels( QStringList() << "" <<
|
||||
tr("Shortcut") << tr("Description") << tr("Name") );
|
||||
|
||||
saveButton->setText(tr("&Save"));
|
||||
saveButton->setIcon(Images::icon("save"));
|
||||
|
||||
loadButton->setText(tr("&Load"));
|
||||
loadButton->setIcon(Images::icon("open"));
|
||||
|
||||
#if USE_SHORTCUTGETTER
|
||||
editButton->setText(tr("&Change shortcut..."));
|
||||
#endif
|
||||
|
||||
//updateView(); // The actions are translated later, so it's useless
|
||||
}
|
||||
|
||||
bool ActionsEditor::isEmpty() {
|
||||
return actionsList.isEmpty();
|
||||
}
|
||||
|
||||
void ActionsEditor::clear() {
|
||||
actionsList.clear();
|
||||
}
|
||||
|
||||
void ActionsEditor::addActions(QWidget *widget) {
|
||||
QAction *action;
|
||||
|
||||
QList<QAction *> actions = widget->findChildren<QAction *>();
|
||||
for (int n=0; n < actions.count(); n++) {
|
||||
action = static_cast<QAction*> (actions[n]);
|
||||
if (!action->objectName().isEmpty())
|
||||
actionsList.append(action);
|
||||
}
|
||||
|
||||
updateView();
|
||||
}
|
||||
|
||||
void ActionsEditor::updateView() {
|
||||
actionsTable->setRowCount( actionsList.count() );
|
||||
|
||||
QAction *action;
|
||||
QString accelText;
|
||||
|
||||
#if !USE_SHORTCUTGETTER
|
||||
dont_validate = true;
|
||||
#endif
|
||||
//actionsTable->setSortingEnabled(false);
|
||||
|
||||
for (int n=0; n < actionsList.count(); n++) {
|
||||
action = static_cast<QAction*> (actionsList[n]);
|
||||
|
||||
#if USE_MULTIPLE_SHORTCUTS
|
||||
accelText = shortcutsToString( action->shortcuts() );
|
||||
#else
|
||||
accelText = action->shortcut().toString();
|
||||
#endif
|
||||
|
||||
// Conflict column
|
||||
QTableWidgetItem * i_conf = new QTableWidgetItem();
|
||||
|
||||
// Name column
|
||||
QTableWidgetItem * i_name = new QTableWidgetItem(action->objectName());
|
||||
|
||||
// Desc column
|
||||
QTableWidgetItem * i_desc = new QTableWidgetItem(action->text().replace("&",""));
|
||||
i_desc->setIcon( action->icon() );
|
||||
|
||||
// Shortcut column
|
||||
QTableWidgetItem * i_shortcut = new QTableWidgetItem(accelText);
|
||||
|
||||
// Set flags
|
||||
#if !USE_SHORTCUTGETTER
|
||||
i_conf->setFlags(Qt::ItemIsEnabled);
|
||||
i_name->setFlags(Qt::ItemIsEnabled);
|
||||
i_desc->setFlags(Qt::ItemIsEnabled);
|
||||
#else
|
||||
i_conf->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
i_name->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
i_desc->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
i_shortcut->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
#endif
|
||||
|
||||
// Add items to table
|
||||
actionsTable->setItem(n, COL_CONFLICTS, i_conf );
|
||||
actionsTable->setItem(n, COL_NAME, i_name );
|
||||
actionsTable->setItem(n, COL_DESC, i_desc );
|
||||
actionsTable->setItem(n, COL_SHORTCUT, i_shortcut );
|
||||
|
||||
}
|
||||
hasConflicts(); // Check for conflicts
|
||||
|
||||
actionsTable->resizeColumnsToContents();
|
||||
actionsTable->setCurrentCell(0, COL_SHORTCUT);
|
||||
|
||||
#if !USE_SHORTCUTGETTER
|
||||
dont_validate = false;
|
||||
#endif
|
||||
//actionsTable->setSortingEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
void ActionsEditor::applyChanges() {
|
||||
qDebug("ActionsEditor::applyChanges");
|
||||
|
||||
for (int row = 0; row < (int)actionsList.size(); ++row) {
|
||||
QAction *action = actionsList[row];
|
||||
QTableWidgetItem *i = actionsTable->item(row, COL_SHORTCUT);
|
||||
|
||||
#if USE_MULTIPLE_SHORTCUTS
|
||||
action->setShortcuts( stringToShortcuts(i->text()) );
|
||||
#else
|
||||
action->setShortcut( QKeySequence(i->text()) );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if !USE_SHORTCUTGETTER
|
||||
void ActionsEditor::recordAction(QTableWidgetItem * i) {
|
||||
//qDebug("ActionsEditor::recordAction");
|
||||
|
||||
//QTableWidgetItem * i = actionsTable->currentItem();
|
||||
if (i->column() == COL_SHORTCUT) {
|
||||
//qDebug("ActionsEditor::recordAction: %d %d %s", i->row(), i->column(), i->text().toUtf8().data());
|
||||
oldAccelText = i->text();
|
||||
}
|
||||
}
|
||||
|
||||
void ActionsEditor::validateAction(QTableWidgetItem * i) {
|
||||
//qDebug("ActionsEditor::validateAction");
|
||||
if (dont_validate) return;
|
||||
|
||||
if (i->column() == COL_SHORTCUT) {
|
||||
QString accelText = QKeySequence(i->text()).toString();
|
||||
|
||||
if (accelText.isEmpty() && !i->text().isEmpty()) {
|
||||
/*
|
||||
QAction * action = static_cast<QAction*> (actionsList[i->row()]);
|
||||
QString oldAccelText= action->accel().toString();
|
||||
*/
|
||||
i->setText(oldAccelText);
|
||||
}
|
||||
else {
|
||||
i->setText(accelText);
|
||||
}
|
||||
|
||||
if (hasConflicts()) qApp->beep();
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void ActionsEditor::editShortcut() {
|
||||
QTableWidgetItem * i = actionsTable->item( actionsTable->currentRow(), COL_SHORTCUT );
|
||||
if (i) {
|
||||
ShortcutGetter d;
|
||||
QString result = d.exec( i->text() );
|
||||
|
||||
if (!result.isNull()) {
|
||||
QString accelText = QKeySequence(result).toString(QKeySequence::PortableText);
|
||||
i->setText(accelText);
|
||||
if (hasConflicts()) qApp->beep();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int ActionsEditor::findActionName(const QString & name) {
|
||||
for (int row=0; row < actionsTable->rowCount(); row++) {
|
||||
if (actionsTable->item(row, COL_NAME)->text() == name) return row;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ActionsEditor::findActionAccel(const QString & accel, int ignoreRow) {
|
||||
for (int row=0; row < actionsTable->rowCount(); row++) {
|
||||
QTableWidgetItem * i = actionsTable->item(row, COL_SHORTCUT);
|
||||
if ( (i) && (i->text() == accel) ) {
|
||||
if (ignoreRow == -1) return row;
|
||||
else
|
||||
if (ignoreRow != row) return row;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool ActionsEditor::hasConflicts() {
|
||||
int found;
|
||||
bool conflict = false;
|
||||
|
||||
QString accelText;
|
||||
QTableWidgetItem *i;
|
||||
|
||||
for (int n=0; n < actionsTable->rowCount(); n++) {
|
||||
//actionsTable->setText( n, COL_CONFLICTS, " ");
|
||||
i = actionsTable->item( n, COL_CONFLICTS );
|
||||
if (i) i->setIcon( QPixmap() );
|
||||
|
||||
i = actionsTable->item(n, COL_SHORTCUT );
|
||||
if (i) {
|
||||
accelText = i->text();
|
||||
if (!accelText.isEmpty()) {
|
||||
found = findActionAccel( accelText, n );
|
||||
if ( (found != -1) && (found != n) ) {
|
||||
conflict = true;
|
||||
//actionsTable->setText( n, COL_CONFLICTS, "!");
|
||||
actionsTable->item( n, COL_CONFLICTS )->setIcon( Images::icon("conflict") );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (conflict) qApp->beep();
|
||||
return conflict;
|
||||
}
|
||||
|
||||
|
||||
void ActionsEditor::saveActionsTable() {
|
||||
QString s = MyFileDialog::getSaveFileName(
|
||||
this, tr("Choose a filename"),
|
||||
latest_dir,
|
||||
tr("Key files") +" (*.keys)" );
|
||||
|
||||
if (!s.isEmpty()) {
|
||||
// If filename has no extension, add it
|
||||
if (QFileInfo(s).suffix().isEmpty()) {
|
||||
s = s + ".keys";
|
||||
}
|
||||
if (QFileInfo(s).exists()) {
|
||||
int res = QMessageBox::question( this,
|
||||
tr("Confirm overwrite?"),
|
||||
tr("The file %1 already exists.\n"
|
||||
"Do you want to overwrite?").arg(s),
|
||||
QMessageBox::Yes,
|
||||
QMessageBox::No,
|
||||
Qt::NoButton);
|
||||
if (res == QMessageBox::No ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
latest_dir = QFileInfo(s).absolutePath();
|
||||
bool r = saveActionsTable(s);
|
||||
if (!r) {
|
||||
QMessageBox::warning(this, tr("Error"),
|
||||
tr("The file couldn't be saved"),
|
||||
QMessageBox::Ok, Qt::NoButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ActionsEditor::saveActionsTable(const QString & filename) {
|
||||
qDebug("ActionsEditor::saveActions: '%s'", filename.toUtf8().data());
|
||||
|
||||
QFile f( filename );
|
||||
if ( f.open( QIODevice::WriteOnly ) ) {
|
||||
QTextStream stream( &f );
|
||||
stream.setCodec("UTF-8");
|
||||
|
||||
for (int row=0; row < actionsTable->rowCount(); row++) {
|
||||
stream << actionsTable->item(row, COL_NAME)->text() << "\t"
|
||||
<< actionsTable->item(row, COL_SHORTCUT)->text() << "\n";
|
||||
}
|
||||
f.close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ActionsEditor::loadActionsTable() {
|
||||
QString s = MyFileDialog::getOpenFileName(
|
||||
this, tr("Choose a file"),
|
||||
latest_dir, tr("Key files") +" (*.keys)" );
|
||||
|
||||
if (!s.isEmpty()) {
|
||||
latest_dir = QFileInfo(s).absolutePath();
|
||||
bool r = loadActionsTable(s);
|
||||
if (!r) {
|
||||
QMessageBox::warning(this, tr("Error"),
|
||||
tr("The file couldn't be loaded"),
|
||||
QMessageBox::Ok, Qt::NoButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ActionsEditor::loadActionsTable(const QString & filename) {
|
||||
qDebug("ActionsEditor::loadActions: '%s'", filename.toUtf8().data());
|
||||
|
||||
QRegExp rx("^(.*)\\t(.*)");
|
||||
int row;
|
||||
|
||||
QFile f( filename );
|
||||
if ( f.open( QIODevice::ReadOnly ) ) {
|
||||
|
||||
#if !USE_SHORTCUTGETTER
|
||||
dont_validate = true;
|
||||
#endif
|
||||
|
||||
QTextStream stream( &f );
|
||||
stream.setCodec("UTF-8");
|
||||
|
||||
QString line;
|
||||
while ( !stream.atEnd() ) {
|
||||
line = stream.readLine();
|
||||
qDebug("line: '%s'", line.toUtf8().data());
|
||||
if (rx.indexIn(line) > -1) {
|
||||
QString name = rx.cap(1);
|
||||
QString accelText = rx.cap(2);
|
||||
qDebug(" name: '%s' accel: '%s'", name.toUtf8().data(), accelText.toUtf8().data());
|
||||
row = findActionName(name);
|
||||
if (row > -1) {
|
||||
qDebug("Action found!");
|
||||
actionsTable->item(row, COL_SHORTCUT)->setText(accelText);
|
||||
}
|
||||
} else {
|
||||
qDebug(" wrong line");
|
||||
}
|
||||
}
|
||||
f.close();
|
||||
hasConflicts(); // Check for conflicts
|
||||
|
||||
#if !USE_SHORTCUTGETTER
|
||||
dont_validate = false;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Static functions
|
||||
|
||||
void ActionsEditor::saveToConfig(QObject *o, QSettings *set) {
|
||||
qDebug("ActionsEditor::saveToConfig");
|
||||
|
||||
set->beginGroup("actions");
|
||||
|
||||
QAction *action;
|
||||
QList<QAction *> actions = o->findChildren<QAction *>();
|
||||
for (int n=0; n < actions.count(); n++) {
|
||||
action = static_cast<QAction*> (actions[n]);
|
||||
if (!action->objectName().isEmpty()) {
|
||||
#if USE_MULTIPLE_SHORTCUTS
|
||||
QString accelText = shortcutsToString(action->shortcuts());
|
||||
#else
|
||||
QString accelText = action->shortcut().toString();
|
||||
#endif
|
||||
set->setValue(action->objectName(), accelText);
|
||||
}
|
||||
}
|
||||
|
||||
set->endGroup();
|
||||
}
|
||||
|
||||
|
||||
void ActionsEditor::loadFromConfig(QObject *o, QSettings *set) {
|
||||
qDebug("ActionsEditor::loadFromConfig");
|
||||
|
||||
set->beginGroup("actions");
|
||||
|
||||
QAction *action;
|
||||
QString accelText;
|
||||
|
||||
QList<QAction *> actions = o->findChildren<QAction *>();
|
||||
for (int n=0; n < actions.count(); n++) {
|
||||
action = static_cast<QAction*> (actions[n]);
|
||||
if (!action->objectName().isEmpty()) {
|
||||
#if USE_MULTIPLE_SHORTCUTS
|
||||
QString current = shortcutsToString(action->shortcuts());
|
||||
accelText = set->value(action->objectName(), current).toString();
|
||||
action->setShortcuts( stringToShortcuts( accelText ) );
|
||||
#else
|
||||
accelText = set->value(action->objectName(), action->shortcut().toString()).toString();
|
||||
action->setShortcut(QKeySequence(accelText));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
set->endGroup();
|
||||
}
|
||||
|
||||
QAction * ActionsEditor::findAction(QObject *o, const QString & name) {
|
||||
QAction *action;
|
||||
|
||||
QList<QAction *> actions = o->findChildren<QAction *>();
|
||||
for (int n=0; n < actions.count(); n++) {
|
||||
action = static_cast<QAction*> (actions[n]);
|
||||
if (name == action->objectName()) return action;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QStringList ActionsEditor::actionsNames(QObject *o) {
|
||||
QStringList l;
|
||||
|
||||
QAction *action;
|
||||
|
||||
QList<QAction *> actions = o->findChildren<QAction *>();
|
||||
for (int n=0; n < actions.count(); n++) {
|
||||
action = static_cast<QAction*> (actions[n]);
|
||||
//qDebug("action name: '%s'", action->objectName().toUtf8().data());
|
||||
//qDebug("action name: '%s'", action->text().toUtf8().data());
|
||||
if (!action->objectName().isEmpty())
|
||||
l.append( action->objectName() );
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
// Language change stuff
|
||||
void ActionsEditor::changeEvent(QEvent *e) {
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
retranslateStrings();
|
||||
} else {
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_actionseditor.cpp"
|
@ -1,104 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* This is based on qq14-actioneditor-code.zip from Qt */
|
||||
|
||||
#ifndef _ACTIONSEDITOR_H_
|
||||
#define _ACTIONSEDITOR_H_
|
||||
|
||||
#include <QWidget>
|
||||
#include <QList>
|
||||
#include <QStringList>
|
||||
#include "config.h"
|
||||
|
||||
class QTableWidget;
|
||||
class QTableWidgetItem;
|
||||
class QAction;
|
||||
class QSettings;
|
||||
class QPushButton;
|
||||
|
||||
class ActionsEditor : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ActionsEditor( QWidget * parent = 0, Qt::WindowFlags f = 0 );
|
||||
~ActionsEditor();
|
||||
|
||||
// Clear the actionlist
|
||||
void clear();
|
||||
|
||||
// There are no actions yet?
|
||||
bool isEmpty();
|
||||
|
||||
void addActions(QWidget * widget);
|
||||
|
||||
// Static functions
|
||||
static QAction * findAction(QObject *o, const QString & name);
|
||||
static QStringList actionsNames(QObject *o);
|
||||
|
||||
static void saveToConfig(QObject *o, QSettings *set);
|
||||
static void loadFromConfig(QObject *o, QSettings *set);
|
||||
|
||||
#if USE_MULTIPLE_SHORTCUTS
|
||||
static QString shortcutsToString(QList <QKeySequence> shortcuts_list);
|
||||
static QList <QKeySequence> stringToShortcuts(QString shortcuts);
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
void applyChanges();
|
||||
void saveActionsTable();
|
||||
bool saveActionsTable(const QString & filename);
|
||||
void loadActionsTable();
|
||||
bool loadActionsTable(const QString & filename);
|
||||
|
||||
void updateView();
|
||||
|
||||
protected:
|
||||
virtual void retranslateStrings();
|
||||
virtual void changeEvent ( QEvent * event ) ;
|
||||
|
||||
// Find in table, not in actionslist
|
||||
int findActionName(const QString & name);
|
||||
int findActionAccel(const QString & accel, int ignoreRow = -1);
|
||||
bool hasConflicts();
|
||||
|
||||
protected slots:
|
||||
#if !USE_SHORTCUTGETTER
|
||||
void recordAction(QTableWidgetItem*);
|
||||
void validateAction(QTableWidgetItem*);
|
||||
#else
|
||||
void editShortcut();
|
||||
#endif
|
||||
|
||||
private:
|
||||
QTableWidget *actionsTable;
|
||||
QList<QAction*> actionsList;
|
||||
QPushButton *saveButton;
|
||||
QPushButton *loadButton;
|
||||
QString latest_dir;
|
||||
|
||||
#if USE_SHORTCUTGETTER
|
||||
QPushButton *editButton;
|
||||
#else
|
||||
QString oldAccelText;
|
||||
bool dont_validate;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
@ -1,474 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _BASEGUI_H_
|
||||
#define _BASEGUI_H_
|
||||
|
||||
#include <QMainWindow>
|
||||
#include "mediadata.h"
|
||||
#include "mediasettings.h"
|
||||
#include "preferences.h"
|
||||
#include "core.h"
|
||||
#include "config.h"
|
||||
|
||||
class QWidget;
|
||||
class QMenu;
|
||||
class LogWindow;
|
||||
class MplayerWindow;
|
||||
|
||||
class QLabel;
|
||||
class FilePropertiesDialog;
|
||||
class VideoEqualizer;
|
||||
class Playlist;
|
||||
|
||||
class Recents;
|
||||
class MyAction;
|
||||
class MyActionGroup;
|
||||
|
||||
class PreferencesDialog;
|
||||
class MyServer;
|
||||
|
||||
|
||||
class BaseGui : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BaseGui( QWidget* parent = 0, Qt::WindowFlags flags = 0 );
|
||||
~BaseGui();
|
||||
|
||||
/* Return true if the window shouldn't show on startup */
|
||||
virtual bool startHidden() { return false; };
|
||||
|
||||
//! Execute all actions in \a actions. The actions should be
|
||||
//! separated by spaces. Checkable actions could have a parameter:
|
||||
//! true or false.
|
||||
void runActions(QString actions);
|
||||
|
||||
public slots:
|
||||
virtual void open(QString file); // Generic open, autodetect type.
|
||||
virtual void openFile();
|
||||
virtual void openFile(QString file);
|
||||
virtual void openFiles(QStringList files);
|
||||
virtual void openURL();
|
||||
virtual void openURL(QString url);
|
||||
virtual void openVCD();
|
||||
virtual void openAudioCD();
|
||||
virtual void openDVD();
|
||||
virtual void openDVDFromFolder();
|
||||
virtual void openDVDFromFolder(QString directory);
|
||||
virtual void openDirectory();
|
||||
virtual void openDirectory(QString directory);
|
||||
|
||||
virtual void helpAbout();
|
||||
virtual void helpAboutQt();
|
||||
|
||||
virtual void loadSub();
|
||||
virtual void loadAudioFile(); // Load external audio file
|
||||
|
||||
virtual void showPlaylist();
|
||||
virtual void showPlaylist(bool b);
|
||||
virtual void showEqualizer();
|
||||
virtual void showEqualizer(bool b);
|
||||
virtual void showMplayerLog();
|
||||
virtual void showLog();
|
||||
virtual void showPreferencesDialog();
|
||||
virtual void showFilePropertiesDialog();
|
||||
|
||||
virtual void exitFullscreen();
|
||||
virtual void toggleFullscreen();
|
||||
virtual void toggleFullscreen(bool);
|
||||
|
||||
virtual void toggleCompactMode();
|
||||
virtual void toggleCompactMode(bool);
|
||||
|
||||
virtual void toggleStayOnTop();
|
||||
virtual void toggleStayOnTop(bool);
|
||||
|
||||
virtual void toggleFrameCounter();
|
||||
virtual void toggleFrameCounter(bool);
|
||||
|
||||
protected slots:
|
||||
virtual void closeWindow();
|
||||
|
||||
virtual void setJumpTexts();
|
||||
|
||||
// Replace for setCaption (in Qt 4 it's not virtual)
|
||||
virtual void setWindowCaption(const QString & title);
|
||||
|
||||
//virtual void openRecent(int item);
|
||||
virtual void openRecent();
|
||||
virtual void enterFullscreenOnPlay();
|
||||
virtual void exitFullscreenOnStop();
|
||||
virtual void exitFullscreenIfNeeded();
|
||||
virtual void playlistHasFinished();
|
||||
|
||||
virtual void displayState(Core::State state);
|
||||
virtual void displayMessage(QString message);
|
||||
virtual void gotCurrentTime(double);
|
||||
|
||||
virtual void initializeMenus();
|
||||
virtual void updateWidgets();
|
||||
virtual void updateEqualizer();
|
||||
|
||||
virtual void newMediaLoaded();
|
||||
virtual void updateMediaInfo();
|
||||
|
||||
virtual void resizeWindow(int w, int h);
|
||||
virtual void hidePanel();
|
||||
|
||||
/* virtual void playlistVisibilityChanged(); */
|
||||
|
||||
virtual void displayGotoTime(int);
|
||||
|
||||
virtual void showPopupMenu( QPoint p );
|
||||
virtual void mouseReleaseEvent( QMouseEvent * e );
|
||||
virtual void mouseDoubleClickEvent( QMouseEvent * e );
|
||||
virtual void wheelEvent( QWheelEvent * e ) ;
|
||||
|
||||
virtual void leftClickFunction();
|
||||
virtual void doubleClickFunction();
|
||||
virtual void processFunction(QString function);
|
||||
|
||||
virtual void dragEnterEvent( QDragEnterEvent * ) ;
|
||||
virtual void dropEvent ( QDropEvent * );
|
||||
|
||||
virtual void applyNewPreferences();
|
||||
virtual void applyFileProperties();
|
||||
|
||||
virtual void clearRecentsList();
|
||||
|
||||
virtual void loadActions();
|
||||
virtual void saveActions();
|
||||
|
||||
// Check the mouse pos in fullscreen mode, to
|
||||
// show the controlwidget if it's moved to
|
||||
// the bottom area.
|
||||
virtual void checkMousePos( QPoint );
|
||||
|
||||
// Single instance stuff
|
||||
// Another instance request open a file
|
||||
virtual void remoteOpen(QString file);
|
||||
virtual void remoteOpenFiles(QStringList files);
|
||||
virtual void remoteAddFiles(QStringList files);
|
||||
|
||||
// stylesheet
|
||||
virtual void loadQss(QString filename);
|
||||
virtual void changeStyleSheet(QString style);
|
||||
|
||||
#if NEW_RESIZE_CODE
|
||||
void calculateDiff(); //!< Updates diff_size
|
||||
#endif
|
||||
|
||||
signals:
|
||||
void frameChanged(int);
|
||||
void timeChanged(double, int, QString);
|
||||
|
||||
void cursorNearTop(QPoint);
|
||||
void cursorNearBottom(QPoint);
|
||||
void cursorFarEdges();
|
||||
|
||||
void wheelUp();
|
||||
void wheelDown();
|
||||
void doubleClicked();
|
||||
void leftClicked();
|
||||
|
||||
protected:
|
||||
virtual void retranslateStrings();
|
||||
virtual void changeEvent(QEvent * event);
|
||||
virtual void hideEvent( QHideEvent * );
|
||||
virtual void showEvent( QShowEvent * );
|
||||
|
||||
virtual void aboutToEnterFullscreen();
|
||||
virtual void aboutToExitFullscreen();
|
||||
virtual void aboutToEnterCompactMode();
|
||||
virtual void aboutToExitCompactMode();
|
||||
|
||||
protected:
|
||||
void createCore();
|
||||
void createMplayerWindow();
|
||||
void createVideoEqualizer();
|
||||
void createPlaylist();
|
||||
void createPanel();
|
||||
void createPreferencesDialog();
|
||||
void createFilePropertiesDialog();
|
||||
void setDataToFileProperties();
|
||||
void initializeGui();
|
||||
void createActions();
|
||||
void createMenus();
|
||||
void updateRecents();
|
||||
void configureDiscDevices();
|
||||
/* virtual void closeEvent( QCloseEvent * e ); */
|
||||
|
||||
protected:
|
||||
QWidget * panel;
|
||||
|
||||
// Menu File
|
||||
MyAction * openFileAct;
|
||||
MyAction * openDirectoryAct;
|
||||
MyAction * openPlaylistAct;
|
||||
MyAction * openVCDAct;
|
||||
MyAction * openAudioCDAct;
|
||||
MyAction * openDVDAct;
|
||||
MyAction * openDVDFolderAct;
|
||||
MyAction * openURLAct;
|
||||
MyAction * exitAct;
|
||||
MyAction * clearRecentsAct;
|
||||
|
||||
// Menu Play
|
||||
MyAction * playAct;
|
||||
MyAction * playOrPauseAct;
|
||||
MyAction * pauseAct;
|
||||
MyAction * pauseAndStepAct;
|
||||
MyAction * stopAct;
|
||||
MyAction * frameStepAct;
|
||||
MyAction * rewind1Act;
|
||||
MyAction * rewind2Act;
|
||||
MyAction * rewind3Act;
|
||||
MyAction * forward1Act;
|
||||
MyAction * forward2Act;
|
||||
MyAction * forward3Act;
|
||||
MyAction * repeatAct;
|
||||
|
||||
// Menu Speed
|
||||
MyAction * normalSpeedAct;
|
||||
MyAction * halveSpeedAct;
|
||||
MyAction * doubleSpeedAct;
|
||||
MyAction * decSpeedAct;
|
||||
MyAction * incSpeedAct;
|
||||
|
||||
// Menu Video
|
||||
MyAction * fullscreenAct;
|
||||
MyAction * compactAct;
|
||||
MyAction * equalizerAct;
|
||||
MyAction * screenshotAct;
|
||||
MyAction * onTopAct;
|
||||
MyAction * flipAct;
|
||||
MyAction * postProcessingAct;
|
||||
MyAction * phaseAct;
|
||||
MyAction * deblockAct;
|
||||
MyAction * deringAct;
|
||||
MyAction * addNoiseAct;
|
||||
|
||||
// Menu Audio
|
||||
MyAction * muteAct;
|
||||
MyAction * decVolumeAct;
|
||||
MyAction * incVolumeAct;
|
||||
MyAction * decAudioDelayAct;
|
||||
MyAction * incAudioDelayAct;
|
||||
MyAction * extrastereoAct;
|
||||
MyAction * karaokeAct;
|
||||
MyAction * volnormAct;
|
||||
MyAction * loadAudioAct;
|
||||
MyAction * unloadAudioAct;
|
||||
|
||||
// Menu Subtitles
|
||||
MyAction * loadSubsAct;
|
||||
MyAction * unloadSubsAct;
|
||||
MyAction * decSubDelayAct;
|
||||
MyAction * incSubDelayAct;
|
||||
MyAction * decSubPosAct;
|
||||
MyAction * incSubPosAct;
|
||||
MyAction * incSubStepAct;
|
||||
MyAction * decSubStepAct;
|
||||
MyAction * useAssAct;
|
||||
|
||||
// Menu Options
|
||||
MyAction * showPlaylistAct;
|
||||
MyAction * showPropertiesAct;
|
||||
MyAction * frameCounterAct;
|
||||
MyAction * showPreferencesAct;
|
||||
MyAction * showLogMplayerAct;
|
||||
MyAction * showLogSmplayerAct;
|
||||
|
||||
// Menu Help
|
||||
MyAction * aboutQtAct;
|
||||
MyAction * aboutThisAct;
|
||||
|
||||
// Playlist
|
||||
MyAction * playPrevAct;
|
||||
MyAction * playNextAct;
|
||||
|
||||
// Actions not in menus
|
||||
#if !USE_MULTIPLE_SHORTCUTS
|
||||
MyAction * decVolume2Act;
|
||||
MyAction * incVolume2Act;
|
||||
#endif
|
||||
MyAction * exitFullscreenAct;
|
||||
MyAction * nextOSDAct;
|
||||
MyAction * decContrastAct;
|
||||
MyAction * incContrastAct;
|
||||
MyAction * decBrightnessAct;
|
||||
MyAction * incBrightnessAct;
|
||||
MyAction * decHueAct;
|
||||
MyAction * incHueAct;
|
||||
MyAction * decSaturationAct;
|
||||
MyAction * incSaturationAct;
|
||||
MyAction * decGammaAct;
|
||||
MyAction * incGammaAct;
|
||||
MyAction * nextAudioAct;
|
||||
MyAction * nextSubtitleAct;
|
||||
MyAction * nextChapterAct;
|
||||
MyAction * prevChapterAct;
|
||||
MyAction * doubleSizeAct;
|
||||
|
||||
// Moving and zoom
|
||||
MyAction * moveUpAct;
|
||||
MyAction * moveDownAct;
|
||||
MyAction * moveLeftAct;
|
||||
MyAction * moveRightAct;
|
||||
MyAction * incZoomAct;
|
||||
MyAction * decZoomAct;
|
||||
MyAction * resetZoomAct;
|
||||
|
||||
// OSD Action Group
|
||||
MyActionGroup * osdGroup;
|
||||
MyAction * osdNoneAct;
|
||||
MyAction * osdSeekAct;
|
||||
MyAction * osdTimerAct;
|
||||
MyAction * osdTotalAct;
|
||||
|
||||
// Denoise Action Group
|
||||
MyActionGroup * denoiseGroup;
|
||||
MyAction * denoiseNoneAct;
|
||||
MyAction * denoiseNormalAct;
|
||||
MyAction * denoiseSoftAct;
|
||||
|
||||
// Window Size Action Group
|
||||
MyActionGroup * sizeGroup;
|
||||
MyAction * size50;
|
||||
MyAction * size75;
|
||||
MyAction * size100;
|
||||
MyAction * size125;
|
||||
MyAction * size150;
|
||||
MyAction * size175;
|
||||
MyAction * size200;
|
||||
MyAction * size300;
|
||||
MyAction * size400;
|
||||
|
||||
// Deinterlace Action Group
|
||||
MyActionGroup * deinterlaceGroup;
|
||||
MyAction * deinterlaceNoneAct;
|
||||
MyAction * deinterlaceL5Act;
|
||||
MyAction * deinterlaceYadif0Act;
|
||||
MyAction * deinterlaceYadif1Act;
|
||||
MyAction * deinterlaceLBAct;
|
||||
MyAction * deinterlaceKernAct;
|
||||
|
||||
// Aspect Action Group
|
||||
MyActionGroup * aspectGroup;
|
||||
MyAction * aspectDetectAct;
|
||||
MyAction * aspect43Act;
|
||||
MyAction * aspect54Act;
|
||||
MyAction * aspect149Act;
|
||||
MyAction * aspect169Act;
|
||||
MyAction * aspect1610Act;
|
||||
MyAction * aspect235Act;
|
||||
MyAction * aspect43LetterAct;
|
||||
MyAction * aspect169LetterAct;
|
||||
MyAction * aspect43PanscanAct;
|
||||
MyAction * aspect43To169Act;
|
||||
|
||||
// Audio Channels Action Group
|
||||
MyActionGroup * channelsGroup;
|
||||
/* MyAction * channelsDefaultAct; */
|
||||
MyAction * channelsStereoAct;
|
||||
MyAction * channelsSurroundAct;
|
||||
MyAction * channelsFull51Act;
|
||||
|
||||
// Stereo Mode Action Group
|
||||
MyActionGroup * stereoGroup;
|
||||
MyAction * stereoAct;
|
||||
MyAction * leftChannelAct;
|
||||
MyAction * rightChannelAct;
|
||||
|
||||
// Audio Track Group
|
||||
MyActionGroup * audioTrackGroup;
|
||||
MyActionGroup * subtitleTrackGroup;
|
||||
MyActionGroup * titleGroup;
|
||||
MyActionGroup * angleGroup;
|
||||
MyActionGroup * chapterGroup;
|
||||
|
||||
// MENUS
|
||||
QMenu *openMenu;
|
||||
QMenu *playMenu;
|
||||
QMenu *videoMenu;
|
||||
QMenu *audioMenu;
|
||||
QMenu *subtitlesMenu;
|
||||
QMenu *browseMenu;
|
||||
QMenu *optionsMenu;
|
||||
QMenu *helpMenu;
|
||||
|
||||
QMenu * subtitlestrack_menu;
|
||||
QMenu * audiotrack_menu;
|
||||
QMenu * titles_menu;
|
||||
QMenu * chapters_menu;
|
||||
QMenu * angles_menu;
|
||||
QMenu * aspect_menu;
|
||||
QMenu * osd_menu;
|
||||
QMenu * deinterlace_menu;
|
||||
//QMenu * denoise_menu;
|
||||
QMenu * videosize_menu;
|
||||
QMenu * audiochannels_menu;
|
||||
QMenu * stereomode_menu;
|
||||
|
||||
QMenu * speed_menu;
|
||||
QMenu * videofilter_menu;
|
||||
QMenu * audiofilter_menu;
|
||||
QMenu * logs_menu;
|
||||
QMenu * panscan_menu;
|
||||
|
||||
QMenu * popup;
|
||||
QMenu * recentfiles_menu;
|
||||
|
||||
LogWindow * mplayer_log_window;
|
||||
LogWindow * smplayer_log_window;
|
||||
|
||||
PreferencesDialog *pref_dialog;
|
||||
FilePropertiesDialog *file_dialog;
|
||||
Playlist * playlist;
|
||||
VideoEqualizer * equalizer;
|
||||
|
||||
Core * core;
|
||||
MplayerWindow *mplayerwindow;
|
||||
|
||||
Recents * recents;
|
||||
|
||||
MyServer * server;
|
||||
|
||||
QStringList actions_list;
|
||||
|
||||
private:
|
||||
QString default_style;
|
||||
|
||||
int last_second;
|
||||
bool near_top;
|
||||
bool near_bottom;
|
||||
|
||||
// Variables to restore pos and size of the window
|
||||
// when exiting from fullscreen mode.
|
||||
QPoint win_pos;
|
||||
QSize win_size;
|
||||
|
||||
#if NEW_RESIZE_CODE
|
||||
QSize diff_size; //!< Main window size - panel size
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,405 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "baseguiplus.h"
|
||||
#include "myaction.h"
|
||||
#include "global.h"
|
||||
#include "images.h"
|
||||
#include "playlist.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QCloseEvent>
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
#include <QDockWidget>
|
||||
#include "playlistdock.h"
|
||||
#include "desktopinfo.h"
|
||||
#endif
|
||||
|
||||
|
||||
BaseGuiPlus::BaseGuiPlus( QWidget * parent, Qt::WindowFlags flags )
|
||||
: BaseGui( parent, flags ),
|
||||
mainwindow_visible(true),
|
||||
//infowindow_visible(false),
|
||||
trayicon_playlist_was_visible(false)
|
||||
{
|
||||
mainwindow_pos = pos();
|
||||
|
||||
tray = new QSystemTrayIcon( Images::icon("logo", 22), this );
|
||||
|
||||
tray->setToolTip( "SMPlayer" );
|
||||
connect( tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
||||
this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
|
||||
|
||||
quitAct = new MyAction(this, "quit");
|
||||
connect( quitAct, SIGNAL(triggered()), this, SLOT(quit()) );
|
||||
openMenu->addAction(quitAct);
|
||||
|
||||
showTrayAct = new MyAction(this, "show_tray_icon" );
|
||||
showTrayAct->setCheckable(true);
|
||||
connect( showTrayAct, SIGNAL(toggled(bool)),
|
||||
tray, SLOT(setVisible(bool)) );
|
||||
optionsMenu->addAction(showTrayAct);
|
||||
|
||||
showAllAct = new MyAction(this, "restore/hide");
|
||||
connect( showAllAct, SIGNAL(triggered()),
|
||||
this, SLOT(toggleShowAll()) );
|
||||
|
||||
context_menu = new QMenu(this);
|
||||
context_menu->addAction(showAllAct);
|
||||
context_menu->addSeparator();
|
||||
context_menu->addAction(openFileAct);
|
||||
context_menu->addMenu(recentfiles_menu);
|
||||
context_menu->addAction(openDVDAct);
|
||||
context_menu->addAction(openURLAct);
|
||||
context_menu->addSeparator();
|
||||
context_menu->addAction(playOrPauseAct);
|
||||
context_menu->addAction(stopAct);
|
||||
context_menu->addSeparator();
|
||||
context_menu->addAction(playPrevAct);
|
||||
context_menu->addAction(playNextAct);
|
||||
context_menu->addSeparator();
|
||||
context_menu->addAction(showPlaylistAct);
|
||||
context_menu->addAction(showPreferencesAct);
|
||||
context_menu->addSeparator();
|
||||
context_menu->addAction(quitAct);
|
||||
|
||||
tray->setContextMenu( context_menu );
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
// Playlistdock
|
||||
playlistdock = new PlaylistDock(this);
|
||||
playlistdock->setObjectName("playlist");
|
||||
playlistdock->setFloating(true);
|
||||
playlistdock->setWidget(playlist);
|
||||
playlistdock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, playlistdock);
|
||||
playlistdock->hide();
|
||||
|
||||
connect( playlistdock, SIGNAL(closed()), this, SLOT(playlistClosed()) );
|
||||
connect( playlistdock, SIGNAL(docked()), this, SLOT(stretchWindow()) );
|
||||
connect( playlistdock, SIGNAL(undocked()), this, SLOT(shrinkWindow()) );
|
||||
|
||||
ignore_playlist_events = false;
|
||||
#endif
|
||||
|
||||
retranslateStrings();
|
||||
|
||||
loadConfig();
|
||||
}
|
||||
|
||||
BaseGuiPlus::~BaseGuiPlus() {
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
bool BaseGuiPlus::startHidden() {
|
||||
if ( (!showTrayAct->isChecked()) || (mainwindow_visible) )
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
void BaseGuiPlus::closeEvent( QCloseEvent * e ) {
|
||||
qDebug("BaseGuiPlus::closeEvent");
|
||||
e->ignore();
|
||||
closeWindow();
|
||||
}
|
||||
|
||||
void BaseGuiPlus::closeWindow() {
|
||||
qDebug("BaseGuiPlus::closeWindow");
|
||||
|
||||
if (tray->isVisible()) {
|
||||
//e->ignore();
|
||||
exitFullscreen();
|
||||
showAll(false); // Hide windows
|
||||
if (core->state() == Core::Playing) core->stop();
|
||||
|
||||
if (pref->balloon_count > 0) {
|
||||
tray->showMessage( "SMPlayer",
|
||||
tr("SMPlayer is still running here"),
|
||||
QSystemTrayIcon::Information, 3000 );
|
||||
pref->balloon_count--;
|
||||
}
|
||||
|
||||
} else {
|
||||
BaseGui::closeWindow();
|
||||
}
|
||||
//tray->hide();
|
||||
|
||||
}
|
||||
|
||||
void BaseGuiPlus::quit() {
|
||||
qDebug("BaseGuiPlus::quit");
|
||||
BaseGui::closeWindow();
|
||||
}
|
||||
|
||||
void BaseGuiPlus::retranslateStrings() {
|
||||
BaseGui::retranslateStrings();
|
||||
|
||||
quitAct->change( Images::icon("exit"), tr("&Quit") );
|
||||
showTrayAct->change( Images::icon("systray"), tr("S&how icon in system tray") );
|
||||
|
||||
updateShowAllAct();
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
playlistdock->setWindowTitle( tr("Playlist") );
|
||||
#endif
|
||||
}
|
||||
|
||||
void BaseGuiPlus::updateShowAllAct() {
|
||||
if (isVisible())
|
||||
showAllAct->change( tr("&Hide") );
|
||||
else
|
||||
showAllAct->change( tr("&Restore") );
|
||||
}
|
||||
|
||||
void BaseGuiPlus::saveConfig() {
|
||||
qDebug("BaseGuiPlus::saveConfig");
|
||||
|
||||
QSettings * set = settings;
|
||||
|
||||
set->beginGroup( "base_gui_plus");
|
||||
|
||||
set->setValue( "show_tray_icon", showTrayAct->isChecked() );
|
||||
set->setValue( "mainwindow_visible", isVisible() );
|
||||
|
||||
/*
|
||||
#if DOCK_PLAYLIST
|
||||
set->setValue( "playlist_and_toolbars_state", saveState() );
|
||||
#endif
|
||||
*/
|
||||
|
||||
set->endGroup();
|
||||
}
|
||||
|
||||
void BaseGuiPlus::loadConfig() {
|
||||
qDebug("BaseGuiPlus::loadConfig");
|
||||
|
||||
QSettings * set = settings;
|
||||
|
||||
set->beginGroup( "base_gui_plus");
|
||||
|
||||
bool show_tray_icon = set->value( "show_tray_icon", false).toBool();
|
||||
showTrayAct->setChecked( show_tray_icon );
|
||||
//tray->setVisible( show_tray_icon );
|
||||
|
||||
mainwindow_visible = set->value("mainwindow_visible", true).toBool();
|
||||
|
||||
/*
|
||||
#if DOCK_PLAYLIST
|
||||
restoreState( set->value( "playlist_and_toolbars_state" ).toByteArray() );
|
||||
#endif
|
||||
*/
|
||||
|
||||
set->endGroup();
|
||||
|
||||
updateShowAllAct();
|
||||
}
|
||||
|
||||
|
||||
void BaseGuiPlus::trayIconActivated(QSystemTrayIcon::ActivationReason reason) {
|
||||
qDebug("DefaultGui::trayIconActivated: %d", reason);
|
||||
|
||||
updateShowAllAct();
|
||||
|
||||
if (reason == QSystemTrayIcon::Trigger) {
|
||||
toggleShowAll();
|
||||
}
|
||||
else
|
||||
if (reason == QSystemTrayIcon::MiddleClick) {
|
||||
core->pause();
|
||||
}
|
||||
}
|
||||
|
||||
void BaseGuiPlus::toggleShowAll() {
|
||||
showAll( !isVisible() );
|
||||
}
|
||||
|
||||
void BaseGuiPlus::showAll(bool b) {
|
||||
if (!b) {
|
||||
// Hide all
|
||||
#if DOCK_PLAYLIST
|
||||
trayicon_playlist_was_visible = (playlistdock->isVisible() &&
|
||||
playlistdock->isFloating() );
|
||||
if (trayicon_playlist_was_visible)
|
||||
playlistdock->hide();
|
||||
|
||||
/*
|
||||
trayicon_playlist_was_visible = playlistdock->isVisible();
|
||||
playlistdock->hide();
|
||||
*/
|
||||
#else
|
||||
trayicon_playlist_was_visible = playlist->isVisible();
|
||||
playlist_pos = playlist->pos();
|
||||
playlist->hide();
|
||||
#endif
|
||||
|
||||
mainwindow_pos = pos();
|
||||
hide();
|
||||
|
||||
/*
|
||||
infowindow_visible = info_window->isVisible();
|
||||
infowindow_pos = info_window->pos();
|
||||
info_window->hide();
|
||||
*/
|
||||
} else {
|
||||
// Show all
|
||||
move(mainwindow_pos);
|
||||
show();
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
if (trayicon_playlist_was_visible) {
|
||||
playlistdock->show();
|
||||
}
|
||||
#else
|
||||
if (trayicon_playlist_was_visible) {
|
||||
playlist->move(playlist_pos);
|
||||
playlist->show();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
if (infowindow_visible) {
|
||||
info_window->show();
|
||||
info_window->move(infowindow_pos);
|
||||
}
|
||||
*/
|
||||
}
|
||||
updateShowAllAct();
|
||||
}
|
||||
|
||||
void BaseGuiPlus::resizeWindow(int w, int h) {
|
||||
qDebug("BaseGuiPlus::resizeWindow: %d, %d", w, h);
|
||||
|
||||
if ( (tray->isVisible()) && (!isVisible()) ) showAll(true);
|
||||
|
||||
BaseGui::resizeWindow(w, h );
|
||||
}
|
||||
|
||||
void BaseGuiPlus::updateMediaInfo() {
|
||||
qDebug("BaseGuiPlus::updateMediaInfo");
|
||||
BaseGui::updateMediaInfo();
|
||||
|
||||
tray->setToolTip( windowTitle() );
|
||||
}
|
||||
|
||||
void BaseGuiPlus::setWindowCaption(const QString & title) {
|
||||
tray->setToolTip( title );
|
||||
|
||||
BaseGui::setWindowCaption( title );
|
||||
}
|
||||
|
||||
|
||||
// Playlist stuff
|
||||
void BaseGuiPlus::aboutToEnterFullscreen() {
|
||||
qDebug("BaseGuiPlus::aboutToEnterFullscreen");
|
||||
|
||||
BaseGui::aboutToEnterFullscreen();
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
fullscreen_playlist_was_visible = playlistdock->isVisible();
|
||||
fullscreen_playlist_was_floating = playlistdock->isFloating();
|
||||
//showPlaylistAct->setEnabled(false);
|
||||
ignore_playlist_events = true;
|
||||
playlistdock->setFloating(true);
|
||||
playlistdock->hide();
|
||||
//showPlaylistAct->setChecked(false);
|
||||
//playlist_state = saveState();
|
||||
#endif
|
||||
}
|
||||
|
||||
void BaseGuiPlus::aboutToExitFullscreen() {
|
||||
qDebug("BaseGuiPlus::aboutToExitFullscreen");
|
||||
|
||||
BaseGui::aboutToExitFullscreen();
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
if (fullscreen_playlist_was_visible) {
|
||||
playlistdock->show();
|
||||
}
|
||||
playlistdock->setFloating( fullscreen_playlist_was_floating );
|
||||
//restoreState( playlist_state );
|
||||
ignore_playlist_events = false;
|
||||
//showPlaylistAct->setEnabled(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void BaseGuiPlus::aboutToEnterCompactMode() {
|
||||
BaseGui::aboutToEnterCompactMode();
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
compact_playlist_was_visible = (playlistdock->isVisible() &&
|
||||
!playlistdock->isFloating());
|
||||
if (compact_playlist_was_visible)
|
||||
playlistdock->hide();
|
||||
#endif
|
||||
}
|
||||
|
||||
void BaseGuiPlus::aboutToExitCompactMode() {
|
||||
BaseGui::aboutToExitCompactMode();
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
if (compact_playlist_was_visible)
|
||||
playlistdock->show();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
void BaseGuiPlus::showPlaylist(bool b) {
|
||||
if ( !b ) {
|
||||
playlistdock->hide();
|
||||
} else {
|
||||
exitFullscreenIfNeeded();
|
||||
playlistdock->show();
|
||||
}
|
||||
//updateWidgets();
|
||||
}
|
||||
|
||||
void BaseGuiPlus::playlistClosed() {
|
||||
showPlaylistAct->setChecked(false);
|
||||
}
|
||||
|
||||
void BaseGuiPlus::stretchWindow() {
|
||||
qDebug("BaseGuiPlus::stretchWindow");
|
||||
if ((ignore_playlist_events) || (pref->resize_method!=Preferences::Always)) return;
|
||||
|
||||
int new_height = height() + playlistdock->height();
|
||||
|
||||
//if (new_height > DesktopInfo::desktop_size(this).height())
|
||||
// new_height = DesktopInfo::desktop_size(this).height() - 20;
|
||||
|
||||
qDebug("BaseGuiPlus::stretchWindow: stretching: new height: %d", new_height);
|
||||
resize( width(), new_height );
|
||||
|
||||
//resizeWindow(core->mset.win_width, core->mset.win_height);
|
||||
}
|
||||
|
||||
void BaseGuiPlus::shrinkWindow() {
|
||||
qDebug("BaseGuiPlus::shrinkWindow");
|
||||
if ((ignore_playlist_events) || (pref->resize_method!=Preferences::Always)) return;
|
||||
|
||||
int new_height = height() - playlistdock->height();
|
||||
qDebug("DefaultGui::shrinkWindow: shrinking: new height: %d", new_height);
|
||||
resize( width(), new_height );
|
||||
|
||||
//resizeWindow(core->mset.win_width, core->mset.win_height);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#include "moc_baseguiplus.cpp"
|
@ -1,102 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _BASEGUIPLUS_H_
|
||||
#define _BASEGUIPLUS_H_
|
||||
|
||||
#include "basegui.h"
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QPoint>
|
||||
#include "config.h"
|
||||
|
||||
class QMenu;
|
||||
class PlaylistDock;
|
||||
|
||||
class BaseGuiPlus : public BaseGui
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BaseGuiPlus( QWidget* parent = 0, Qt::WindowFlags flags = 0 );
|
||||
~BaseGuiPlus();
|
||||
|
||||
virtual bool startHidden();
|
||||
|
||||
protected:
|
||||
virtual void retranslateStrings();
|
||||
|
||||
void loadConfig();
|
||||
void saveConfig();
|
||||
void updateShowAllAct();
|
||||
|
||||
virtual void aboutToEnterFullscreen();
|
||||
virtual void aboutToExitFullscreen();
|
||||
virtual void aboutToEnterCompactMode();
|
||||
virtual void aboutToExitCompactMode();
|
||||
|
||||
virtual void closeEvent( QCloseEvent * e );
|
||||
|
||||
protected slots:
|
||||
// Reimplemented methods
|
||||
virtual void closeWindow();
|
||||
virtual void setWindowCaption(const QString & title);
|
||||
virtual void resizeWindow(int w, int h);
|
||||
virtual void updateMediaInfo();
|
||||
// New
|
||||
virtual void trayIconActivated(QSystemTrayIcon::ActivationReason);
|
||||
virtual void toggleShowAll();
|
||||
virtual void showAll(bool b);
|
||||
virtual void quit();
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
virtual void showPlaylist(bool b);
|
||||
void playlistClosed();
|
||||
|
||||
void stretchWindow();
|
||||
void shrinkWindow();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
QSystemTrayIcon * tray;
|
||||
QMenu * context_menu;
|
||||
|
||||
MyAction * quitAct;
|
||||
MyAction * showTrayAct;
|
||||
MyAction * showAllAct;
|
||||
|
||||
// To save state
|
||||
QPoint mainwindow_pos;
|
||||
bool mainwindow_visible;
|
||||
|
||||
QPoint playlist_pos;
|
||||
bool trayicon_playlist_was_visible;
|
||||
|
||||
//QPoint infowindow_pos;
|
||||
//bool infowindow_visible;
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
PlaylistDock * playlistdock;
|
||||
bool fullscreen_playlist_was_visible;
|
||||
bool fullscreen_playlist_was_floating;
|
||||
bool compact_playlist_was_visible;
|
||||
bool ignore_playlist_events;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -1,94 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _CONFIG_H_
|
||||
#define _CONFIG_H_
|
||||
|
||||
|
||||
// SUBTITLES_BY_INDEX 1
|
||||
// New code for subtitle handling.
|
||||
|
||||
#define SUBTITLES_BY_INDEX 1
|
||||
|
||||
|
||||
// CONTROLWIDGET_OVER_VIDEO
|
||||
// if set to 1, the controlwidget will be shown in fullscreen
|
||||
// *over* the video (not moving the video) when the user move the mouse
|
||||
// to the bottom area of the screen.
|
||||
|
||||
#define CONTROLWIDGET_OVER_VIDEO 1
|
||||
|
||||
|
||||
// NEW_CONTROLWIDGET
|
||||
// New design for the floating control, with only one row.
|
||||
|
||||
#define NEW_CONTROLWIDGET 1
|
||||
|
||||
|
||||
// DOCK_PLAYLIST
|
||||
// if 1, the playlist will be docked in the main window, instead
|
||||
// of being a top level window
|
||||
|
||||
#define DOCK_PLAYLIST 1
|
||||
|
||||
|
||||
// STYLE_SWITCHING
|
||||
// if 1, the preferences dialog will have an option to switch
|
||||
// the Qt style
|
||||
|
||||
#define STYLE_SWITCHING 1
|
||||
|
||||
|
||||
// New code to resize the main window
|
||||
|
||||
#define NEW_RESIZE_CODE 1
|
||||
|
||||
|
||||
// Allow to use multiple shortcuts for actions
|
||||
|
||||
#define USE_MULTIPLE_SHORTCUTS 1
|
||||
|
||||
|
||||
// EXTERNAL_SLEEP
|
||||
// if 1, it will be used the function usleep() from unistd.h
|
||||
// instead of QThread::msleep()
|
||||
// It can be useful if your Qt doesn't have QThread support.
|
||||
// Note: not much test it
|
||||
// Note 2: not used anymore
|
||||
|
||||
#define EXTERNAL_SLEEP 0
|
||||
|
||||
|
||||
// USE_SHORTCUTGETTER
|
||||
// if 1, a new dialog will be used to ask the user for a
|
||||
// keyshortcut.
|
||||
|
||||
#define USE_SHORTCUTGETTER 1
|
||||
|
||||
|
||||
// USE_SUBFONT
|
||||
// if 1, use -subfont option.
|
||||
|
||||
#define USE_SUBFONT 0
|
||||
|
||||
|
||||
// Testing with a QGLWidget (for Windows)
|
||||
#define USE_GL_WIDGET 0
|
||||
|
||||
|
||||
#endif
|
@ -1,29 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _CONSTANTS_H_
|
||||
#define _CONSTANTS_H_
|
||||
|
||||
#define COMPANY "RVM"
|
||||
#define PROGRAM "smplayer"
|
||||
|
||||
#define IS_PLAYLIST_TAG "|smplayer:isplaylist"
|
||||
#define IS_PLAYLIST_TAG_RX "\\|smplayer\\:isplaylist$"
|
||||
|
||||
#endif
|
||||
|
@ -1,273 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _CORE_H_
|
||||
#define _CORE_H_
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "mediadata.h"
|
||||
#include "mediasettings.h"
|
||||
|
||||
|
||||
class MplayerProcess;
|
||||
class MplayerWindow;
|
||||
|
||||
class Core : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum State { Stopped = 0, Playing = 1, Paused = 2 };
|
||||
|
||||
Core( MplayerWindow *mpw, QWidget* parent = 0 );
|
||||
~Core();
|
||||
|
||||
MediaData mdat;
|
||||
MediaSettings mset;
|
||||
|
||||
QString mplayer_log;
|
||||
|
||||
//! Return the current state
|
||||
State state() { return _state; };
|
||||
|
||||
//! Return a string with the name of the current state,
|
||||
//! so it can be printed on debugging messages.
|
||||
QString stateToString();
|
||||
|
||||
protected:
|
||||
//! Change the current state (Stopped, Playing or Paused)
|
||||
//! And sends the stateChanged() signal.
|
||||
void setState(State s);
|
||||
|
||||
public slots:
|
||||
//! Generic open, with autodetection of type
|
||||
void open(QString file, int seek=-1);
|
||||
void openFile(QString filename, int seek=-1);
|
||||
void openStream(QString name);
|
||||
/*
|
||||
void openDVD( bool from_folder, QString directory = "");
|
||||
void openDVD(); // Plays title 1
|
||||
void openDVD(int title = 1);
|
||||
*/
|
||||
void openDVD(QString dvd_url);
|
||||
void openVCD(int title = -1);
|
||||
void openAudioCD(int title = -1);
|
||||
|
||||
void loadSub(const QString & sub);
|
||||
void unloadSub();
|
||||
|
||||
void loadAudioFile(const QString & audiofile);
|
||||
void unloadAudioFile();
|
||||
|
||||
void stop();
|
||||
void play();
|
||||
void play_or_pause();
|
||||
void pause_and_frame_step();
|
||||
void pause();
|
||||
void frameStep();
|
||||
void screenshot();
|
||||
|
||||
//! Public restart, for the GUI.
|
||||
void restart();
|
||||
|
||||
void goToPos( int perc );
|
||||
/*void goToSec( double sec );*/
|
||||
|
||||
void toggleRepeat();
|
||||
void toggleRepeat(bool b);
|
||||
|
||||
void toggleFlip();
|
||||
void toggleFlip(bool b);
|
||||
|
||||
// Audio filters
|
||||
void toggleKaraoke();
|
||||
void toggleKaraoke(bool b);
|
||||
void toggleExtrastereo();
|
||||
void toggleExtrastereo(bool b);
|
||||
void toggleVolnorm();
|
||||
void toggleVolnorm(bool b);
|
||||
|
||||
void setAudioChannels(int channels);
|
||||
void setStereoMode(int mode);
|
||||
|
||||
// Video filters
|
||||
void toggleAutophase();
|
||||
void toggleAutophase(bool b);
|
||||
void toggleDeblock();
|
||||
void toggleDeblock(bool b);
|
||||
void toggleDering();
|
||||
void toggleDering(bool b);
|
||||
void toggleNoise();
|
||||
void toggleNoise(bool b);
|
||||
void togglePostprocessing();
|
||||
void togglePostprocessing(bool b);
|
||||
void changeDenoise(int);
|
||||
|
||||
void seek(int secs);
|
||||
void sforward(); // + 10 seconds
|
||||
void srewind(); // - 10 seconds
|
||||
void forward(); // + 1 minute
|
||||
void rewind(); // -1 minute
|
||||
void fastforward(); // + 10 minutes
|
||||
void fastrewind(); // - 10 minutes
|
||||
void forward(int secs);
|
||||
void rewind(int secs);
|
||||
void wheelUp();
|
||||
void wheelDown();
|
||||
|
||||
void setSpeed( double value );
|
||||
void incSpeed();
|
||||
void decSpeed();
|
||||
void doubleSpeed();
|
||||
void halveSpeed();
|
||||
void normalSpeed();
|
||||
|
||||
void setVolume(int volume, bool force = false);
|
||||
void switchMute();
|
||||
void mute(bool b);
|
||||
void incVolume();
|
||||
void decVolume();
|
||||
|
||||
void setBrightness(int value);
|
||||
void setContrast(int value);
|
||||
void setGamma(int value);
|
||||
void setHue(int value);
|
||||
void setSaturation(int value);
|
||||
|
||||
void incBrightness();
|
||||
void decBrightness();
|
||||
void incContrast();
|
||||
void decContrast();
|
||||
void incGamma();
|
||||
void decGamma();
|
||||
void incHue();
|
||||
void decHue();
|
||||
void incSaturation();
|
||||
void decSaturation();
|
||||
|
||||
void incSubDelay();
|
||||
void decSubDelay();
|
||||
|
||||
void incAudioDelay();
|
||||
void decAudioDelay();
|
||||
|
||||
void incSubPos();
|
||||
void decSubPos();
|
||||
|
||||
//! Select next line in subtitle file
|
||||
void incSubStep();
|
||||
//! Select previous line in subtitle file
|
||||
void decSubStep();
|
||||
|
||||
void changeDeinterlace(int);
|
||||
void changeSubtitle(int);
|
||||
void nextSubtitle();
|
||||
void changeAudio(int);
|
||||
void nextAudio();
|
||||
void changeTitle(int);
|
||||
void changeChapter(int);
|
||||
void prevChapter();
|
||||
void nextChapter();
|
||||
void changeAngle(int);
|
||||
void changeAspectRatio(int);
|
||||
void changeOSD(int);
|
||||
void nextOSD();
|
||||
|
||||
void changeSize(int); // Size of the window
|
||||
void toggleDoubleSize();
|
||||
void changePanscan(double); // Zoom on mplayerwindow
|
||||
|
||||
void incPanscan();
|
||||
void decPanscan();
|
||||
void resetPanscan();
|
||||
|
||||
void changeUseAss(bool);
|
||||
|
||||
// Pass a command to mplayer by stdin:
|
||||
void tellmp(const QString & command);
|
||||
|
||||
protected slots:
|
||||
void changeCurrentSec(double sec);
|
||||
void changePause();
|
||||
void gotWindowResolution( int w, int h );
|
||||
void gotNoVideo();
|
||||
void gotVO(QString);
|
||||
void gotAO(QString);
|
||||
void gotStartingTime(double);
|
||||
|
||||
void finishRestart();
|
||||
void processFinished();
|
||||
void fileReachedEnd();
|
||||
|
||||
void updateLog(QString line);
|
||||
|
||||
void displayMessage(QString text);
|
||||
void displayScreenshotName(QString filename);
|
||||
|
||||
void streamTitleAndUrlChanged(QString,QString);
|
||||
|
||||
protected:
|
||||
void playNewFile(QString file, int seek=-1);
|
||||
void restartPlay();
|
||||
void initPlaying(int seek=-1);
|
||||
void newMediaPlaying();
|
||||
|
||||
void startMplayer(QString file, double seek = -1 );
|
||||
void stopMplayer();
|
||||
|
||||
bool checkHaveSettingsSaved(QString filename);
|
||||
void saveMediaInfo();
|
||||
void loadMediaInfo(QString filename);
|
||||
|
||||
void initializeMenus();
|
||||
void updateWidgets();
|
||||
|
||||
signals:
|
||||
void aboutToStartPlaying(); // Signal emited just before to start mplayer
|
||||
void mediaLoaded();
|
||||
void mediaInfoChanged();
|
||||
void stateChanged(Core::State state);
|
||||
void mediaStartPlay();
|
||||
void mediaFinished(); // Media has arrived to the end.
|
||||
void mediaStoppedByUser();
|
||||
void showMessage(QString text);
|
||||
void menusNeedInitialize();
|
||||
void widgetsNeedUpdate();
|
||||
void equalizerNeedsUpdate();
|
||||
void showTime(double sec);
|
||||
void showFrame(int frame);
|
||||
void needResize(int w, int h);
|
||||
void mplayerFinishedWithError(int);
|
||||
void noVideo();
|
||||
void volumeChanged(int);
|
||||
|
||||
protected:
|
||||
MplayerProcess * proc;
|
||||
MplayerWindow *mplayerwindow;
|
||||
|
||||
private:
|
||||
// Some variables to proper restart
|
||||
bool we_are_restarting;
|
||||
|
||||
bool just_loaded_external_subs;
|
||||
bool just_unloaded_external_subs;
|
||||
State _state;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,641 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "defaultgui.h"
|
||||
#include "helper.h"
|
||||
#include "core.h"
|
||||
#include "global.h"
|
||||
#include "timeslider.h"
|
||||
#include "playlist.h"
|
||||
#include "mplayerwindow.h"
|
||||
#include "floatingcontrol.h"
|
||||
#include "myaction.h"
|
||||
#include "images.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QToolBar>
|
||||
#include <QSettings>
|
||||
#include <QLabel>
|
||||
#include <QStatusBar>
|
||||
#include <QPushButton>
|
||||
#include <QToolButton>
|
||||
#include <QMenuBar>
|
||||
|
||||
#if !NEW_CONTROLWIDGET
|
||||
#include <QLCDNumber>
|
||||
#endif
|
||||
|
||||
|
||||
DefaultGui::DefaultGui( QWidget * parent, Qt::WindowFlags flags )
|
||||
: BaseGuiPlus( parent, flags ),
|
||||
floating_control_width(100) //%
|
||||
{
|
||||
createStatusBar();
|
||||
|
||||
connect( this, SIGNAL(timeChanged(double, int, QString)),
|
||||
this, SLOT(displayTime(double, int, QString)) );
|
||||
connect( this, SIGNAL(frameChanged(int)),
|
||||
this, SLOT(displayFrame(int)) );
|
||||
|
||||
connect( this, SIGNAL(cursorNearBottom(QPoint)),
|
||||
this, SLOT(showFloatingControl(QPoint)) );
|
||||
connect( this, SIGNAL(cursorNearTop(QPoint)),
|
||||
this, SLOT(showFloatingMenu(QPoint)) );
|
||||
connect( this, SIGNAL(cursorFarEdges()),
|
||||
this, SLOT(hideFloatingControls()) );
|
||||
|
||||
createMainToolBars();
|
||||
createActions();
|
||||
createControlWidget();
|
||||
createControlWidgetMini();
|
||||
createFloatingControl();
|
||||
createMenus();
|
||||
|
||||
retranslateStrings();
|
||||
|
||||
loadConfig();
|
||||
|
||||
//if (playlist_visible) showPlaylist(true);
|
||||
|
||||
if (pref->compact_mode) {
|
||||
controlwidget->hide();
|
||||
toolbar1->hide();
|
||||
toolbar2->hide();
|
||||
}
|
||||
}
|
||||
|
||||
DefaultGui::~DefaultGui() {
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
/*
|
||||
void DefaultGui::closeEvent( QCloseEvent * ) {
|
||||
qDebug("DefaultGui::closeEvent");
|
||||
|
||||
//BaseGuiPlus::closeEvent(e);
|
||||
qDebug("w: %d h: %d", width(), height() );
|
||||
}
|
||||
*/
|
||||
|
||||
void DefaultGui::createActions() {
|
||||
showMainToolbarAct = new MyAction(Qt::Key_F5, this, "show_main_toolbar" );
|
||||
showMainToolbarAct->setCheckable(true);
|
||||
connect( showMainToolbarAct, SIGNAL(toggled(bool)),
|
||||
this, SLOT(showMainToolbar(bool)) );
|
||||
|
||||
showLanguageToolbarAct = new MyAction(Qt::Key_F6, this, "show_language_toolbar" );
|
||||
showLanguageToolbarAct->setCheckable(true);
|
||||
connect( showLanguageToolbarAct, SIGNAL(toggled(bool)),
|
||||
this, SLOT(showLanguageToolbar(bool)) );
|
||||
}
|
||||
|
||||
void DefaultGui::createMenus() {
|
||||
toolbar_menu = new QMenu(this);
|
||||
toolbar_menu->addAction(showMainToolbarAct);
|
||||
toolbar_menu->addAction(showLanguageToolbarAct);
|
||||
|
||||
optionsMenu->addSeparator();
|
||||
optionsMenu->addMenu(toolbar_menu);
|
||||
}
|
||||
|
||||
QMenu * DefaultGui::createPopupMenu() {
|
||||
QMenu * m = new QMenu(this);
|
||||
m->addAction(showMainToolbarAct);
|
||||
m->addAction(showLanguageToolbarAct);
|
||||
return m;
|
||||
}
|
||||
|
||||
void DefaultGui::createMainToolBars() {
|
||||
toolbar1 = new QToolBar( this );
|
||||
toolbar1->setObjectName("toolbar1");
|
||||
//toolbar1->setMovable(false);
|
||||
addToolBar(Qt::TopToolBarArea, toolbar1);
|
||||
|
||||
toolbar1->addAction(openFileAct);
|
||||
toolbar1->addAction(openDVDAct);
|
||||
toolbar1->addAction(openURLAct);
|
||||
toolbar1->addSeparator();
|
||||
toolbar1->addAction(compactAct);
|
||||
toolbar1->addAction(fullscreenAct);
|
||||
toolbar1->addSeparator();
|
||||
toolbar1->addAction(screenshotAct);
|
||||
toolbar1->addSeparator();
|
||||
toolbar1->addAction(showPropertiesAct);
|
||||
toolbar1->addAction(showPlaylistAct);
|
||||
toolbar1->addAction(showPreferencesAct);
|
||||
toolbar1->addSeparator();
|
||||
toolbar1->addAction(playPrevAct);
|
||||
toolbar1->addAction(playNextAct);
|
||||
|
||||
toolbar2 = new QToolBar( this );
|
||||
toolbar2->setObjectName("toolbar2");
|
||||
//toolbar2->setMovable(false);
|
||||
addToolBar(Qt::TopToolBarArea, toolbar2);
|
||||
|
||||
select_audio = new QPushButton( this );
|
||||
select_audio->setMenu( audiotrack_menu );
|
||||
toolbar2->addWidget(select_audio);
|
||||
|
||||
select_subtitle = new QPushButton( this );
|
||||
select_subtitle->setMenu( subtitlestrack_menu );
|
||||
toolbar2->addWidget(select_subtitle);
|
||||
|
||||
/*
|
||||
toolbar1->show();
|
||||
toolbar2->show();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void DefaultGui::createControlWidgetMini() {
|
||||
controlwidget_mini = new QToolBar( this );
|
||||
controlwidget_mini->setObjectName("controlwidget_mini");
|
||||
//controlwidget_mini->setResizeEnabled(false);
|
||||
controlwidget_mini->setMovable(false);
|
||||
//addDockWindow(controlwidget_mini, Qt::DockBottom );
|
||||
addToolBar(Qt::BottomToolBarArea, controlwidget_mini);
|
||||
|
||||
controlwidget_mini->addAction(playOrPauseAct);
|
||||
controlwidget_mini->addAction(stopAct);
|
||||
controlwidget_mini->addSeparator();
|
||||
|
||||
controlwidget_mini->addAction(rewind1Act);
|
||||
|
||||
timeslider_mini = new TimeSlider( this );
|
||||
connect( timeslider_mini, SIGNAL( posChanged(int) ),
|
||||
core, SLOT(goToPos(int)) );
|
||||
connect( timeslider_mini, SIGNAL( draggingPos(int) ),
|
||||
this, SLOT(displayGotoTime(int)) );
|
||||
//controlwidget_mini->setStretchableWidget( timeslider_mini );
|
||||
controlwidget_mini->addWidget(timeslider_mini);
|
||||
|
||||
controlwidget_mini->addAction(forward1Act);
|
||||
|
||||
controlwidget_mini->addSeparator();
|
||||
|
||||
controlwidget_mini->addAction(muteAct );
|
||||
|
||||
volumeslider_mini = new MySlider( this );
|
||||
volumeslider_mini->setValue(50);
|
||||
volumeslider_mini->setMinimum(0);
|
||||
volumeslider_mini->setMaximum(100);
|
||||
volumeslider_mini->setOrientation( Qt::Horizontal );
|
||||
volumeslider_mini->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
|
||||
volumeslider_mini->setFocusPolicy( Qt::NoFocus );
|
||||
volumeslider_mini->setTickPosition( QSlider::TicksBelow );
|
||||
volumeslider_mini->setTickInterval( 10 );
|
||||
volumeslider_mini->setSingleStep( 1 );
|
||||
volumeslider_mini->setPageStep( 10 );
|
||||
connect( volumeslider_mini, SIGNAL( valueChanged(int) ),
|
||||
core, SLOT( setVolume(int) ) );
|
||||
connect( core, SIGNAL(volumeChanged(int)),
|
||||
volumeslider_mini, SLOT(setValue(int)) );
|
||||
controlwidget_mini->addWidget(volumeslider_mini);
|
||||
|
||||
controlwidget_mini->hide();
|
||||
}
|
||||
|
||||
void DefaultGui::createControlWidget() {
|
||||
controlwidget = new QToolBar( this );
|
||||
controlwidget->setObjectName("controlwidget");
|
||||
//controlwidget->setResizeEnabled(false);
|
||||
controlwidget->setMovable(false);
|
||||
//addDockWindow(controlwidget, Qt::DockBottom );
|
||||
addToolBar(Qt::BottomToolBarArea, controlwidget);
|
||||
|
||||
controlwidget->addAction(playAct);
|
||||
controlwidget->addAction(pauseAndStepAct);
|
||||
controlwidget->addAction(stopAct);
|
||||
|
||||
controlwidget->addSeparator();
|
||||
|
||||
controlwidget->addAction(rewind3Act);
|
||||
controlwidget->addAction(rewind2Act);
|
||||
controlwidget->addAction(rewind1Act);
|
||||
|
||||
timeslider = new TimeSlider( this );
|
||||
connect( timeslider, SIGNAL( posChanged(int) ),
|
||||
core, SLOT(goToPos(int)) );
|
||||
connect( timeslider, SIGNAL( draggingPos(int) ),
|
||||
this, SLOT(displayGotoTime(int)) );
|
||||
//controlwidget->setStretchableWidget( timeslider );
|
||||
controlwidget->addWidget(timeslider);
|
||||
|
||||
controlwidget->addAction(forward1Act);
|
||||
controlwidget->addAction(forward2Act);
|
||||
controlwidget->addAction(forward3Act);
|
||||
|
||||
controlwidget->addSeparator();
|
||||
|
||||
controlwidget->addAction(fullscreenAct);
|
||||
controlwidget->addAction(muteAct);
|
||||
|
||||
volumeslider = new MySlider( this );
|
||||
volumeslider->setMinimum(0);
|
||||
volumeslider->setMaximum(100);
|
||||
volumeslider->setValue(50);
|
||||
volumeslider->setOrientation( Qt::Horizontal );
|
||||
volumeslider->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
|
||||
volumeslider->setFocusPolicy( Qt::NoFocus );
|
||||
volumeslider->setTickPosition( QSlider::TicksBelow );
|
||||
volumeslider->setTickInterval( 10 );
|
||||
volumeslider->setSingleStep( 1 );
|
||||
volumeslider->setPageStep( 10 );
|
||||
connect( volumeslider, SIGNAL( valueChanged(int) ),
|
||||
core, SLOT( setVolume(int) ) );
|
||||
connect( core, SIGNAL(volumeChanged(int)),
|
||||
volumeslider, SLOT(setValue(int)) );
|
||||
|
||||
controlwidget->addWidget(volumeslider);
|
||||
|
||||
/*
|
||||
controlwidget->show();
|
||||
*/
|
||||
}
|
||||
|
||||
void DefaultGui::createFloatingControl() {
|
||||
floating_control = new FloatingControl(this);
|
||||
|
||||
connect( floating_control->rewind3, SIGNAL(clicked()),
|
||||
core, SLOT(fastrewind()) );
|
||||
connect( floating_control->rewind2, SIGNAL(clicked()),
|
||||
core, SLOT(rewind()) );
|
||||
connect( floating_control->rewind1, SIGNAL(clicked()),
|
||||
core, SLOT(srewind()) );
|
||||
|
||||
connect( floating_control->forward1, SIGNAL(clicked()),
|
||||
core, SLOT(sforward()) );
|
||||
connect( floating_control->forward2, SIGNAL(clicked()),
|
||||
core, SLOT(forward()) );
|
||||
connect( floating_control->forward3, SIGNAL(clicked()),
|
||||
core, SLOT(fastforward()) );
|
||||
|
||||
connect( floating_control->play, SIGNAL(clicked()),
|
||||
core, SLOT(play()) );
|
||||
connect( floating_control->pause, SIGNAL(clicked()),
|
||||
core, SLOT(pause_and_frame_step()) );
|
||||
connect( floating_control->stop, SIGNAL(clicked()),
|
||||
core, SLOT(stop()) );
|
||||
|
||||
connect( floating_control->mute, SIGNAL(toggled(bool)),
|
||||
core, SLOT(mute(bool)) );
|
||||
|
||||
connect( floating_control->fullscreen, SIGNAL(toggled(bool)),
|
||||
this, SLOT(toggleFullscreen(bool)) );
|
||||
|
||||
connect( floating_control->volume, SIGNAL( valueChanged(int) ),
|
||||
core, SLOT( setVolume(int) ) );
|
||||
connect( core, SIGNAL(volumeChanged(int)),
|
||||
floating_control->volume, SLOT(setValue(int)) );
|
||||
|
||||
connect( floating_control->time, SIGNAL( posChanged(int) ),
|
||||
core, SLOT(goToPos(int)) );
|
||||
connect( floating_control->time, SIGNAL( draggingPos(int) ),
|
||||
this, SLOT(displayGotoTime(int)) );
|
||||
}
|
||||
|
||||
void DefaultGui::createStatusBar() {
|
||||
qDebug("DefaultGui::createStatusBar");
|
||||
|
||||
time_display = new QLabel( statusBar() );
|
||||
time_display->setAlignment(Qt::AlignRight);
|
||||
time_display->setFrameShape(QFrame::NoFrame);
|
||||
time_display->setText(" 88:88:88 / 88:88:88 ");
|
||||
time_display->setMinimumSize(time_display->sizeHint());
|
||||
|
||||
frame_display = new QLabel( statusBar() );
|
||||
frame_display->setAlignment(Qt::AlignRight);
|
||||
frame_display->setFrameShape(QFrame::NoFrame);
|
||||
frame_display->setText("88888888");
|
||||
frame_display->setMinimumSize(frame_display->sizeHint());
|
||||
|
||||
statusBar()->setAutoFillBackground(TRUE);
|
||||
|
||||
Helper::setBackgroundColor( statusBar(), QColor(0,0,0) );
|
||||
Helper::setForegroundColor( statusBar(), QColor(255,255,255) );
|
||||
Helper::setBackgroundColor( time_display, QColor(0,0,0) );
|
||||
Helper::setForegroundColor( time_display, QColor(255,255,255) );
|
||||
Helper::setBackgroundColor( frame_display, QColor(0,0,0) );
|
||||
Helper::setForegroundColor( frame_display, QColor(255,255,255) );
|
||||
statusBar()->setSizeGripEnabled(FALSE);
|
||||
|
||||
statusBar()->showMessage( tr("Welcome to SMPlayer") );
|
||||
statusBar()->addPermanentWidget( frame_display, 0 );
|
||||
frame_display->setText( "0" );
|
||||
|
||||
statusBar()->addPermanentWidget( time_display, 0 );
|
||||
time_display->setText(" 00:00:00 / 00:00:00 ");
|
||||
|
||||
time_display->show();
|
||||
frame_display->hide();
|
||||
}
|
||||
|
||||
void DefaultGui::retranslateStrings() {
|
||||
BaseGuiPlus::retranslateStrings();
|
||||
|
||||
showMainToolbarAct->change( Images::icon("main_toolbar"), tr("&Main toolbar") );
|
||||
showLanguageToolbarAct->change( Images::icon("lang_toolbar"), tr("&Language toolbar") );
|
||||
|
||||
toolbar_menu->menuAction()->setText( tr("&Toolbars") );
|
||||
toolbar_menu->menuAction()->setIcon( Images::icon("toolbars") );
|
||||
|
||||
volumeslider->setToolTip( tr("Volume") );
|
||||
volumeslider_mini->setToolTip( tr("Volume") );
|
||||
|
||||
select_audio->setText( tr("Audio") );
|
||||
select_subtitle->setText( tr("Subtitle") );
|
||||
}
|
||||
|
||||
|
||||
void DefaultGui::displayTime(double sec, int perc, QString text) {
|
||||
time_display->setText( text );
|
||||
timeslider->setPos(perc);
|
||||
timeslider_mini->setPos(perc);
|
||||
|
||||
//if (floating_control->isVisible()) {
|
||||
floating_control->time->setPos(perc);
|
||||
#if NEW_CONTROLWIDGET
|
||||
//floating_control->time_label->setText( Helper::formatTime((int)sec) );
|
||||
floating_control->time_label->setText( text );
|
||||
#else
|
||||
floating_control->lcd->display( Helper::formatTime((int)sec) );
|
||||
#endif
|
||||
//}
|
||||
}
|
||||
|
||||
void DefaultGui::displayFrame(int frame) {
|
||||
if (frame_display->isVisible()) {
|
||||
frame_display->setNum( frame );
|
||||
}
|
||||
}
|
||||
|
||||
void DefaultGui::updateWidgets() {
|
||||
qDebug("DefaultGui::updateWidgets");
|
||||
|
||||
BaseGuiPlus::updateWidgets();
|
||||
|
||||
// Frame counter
|
||||
frame_display->setVisible( pref->show_frame_counter );
|
||||
|
||||
floating_control->fullscreen->setChecked(pref->fullscreen);
|
||||
floating_control->mute->setChecked(core->mset.mute);
|
||||
|
||||
/*
|
||||
showMainToolbarAct->setOn( show_main_toolbar );
|
||||
showLanguageToolbarAct->setOn( show_language_toolbar );
|
||||
*/
|
||||
|
||||
panel->setFocus();
|
||||
}
|
||||
|
||||
void DefaultGui::aboutToEnterFullscreen() {
|
||||
qDebug("DefaultGui::aboutToEnterFullscreen");
|
||||
|
||||
BaseGuiPlus::aboutToEnterFullscreen();
|
||||
|
||||
if (!pref->compact_mode) {
|
||||
//menuBar()->hide();
|
||||
//statusBar()->hide();
|
||||
controlwidget->hide();
|
||||
controlwidget_mini->hide();
|
||||
toolbar1->hide();
|
||||
toolbar2->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void DefaultGui::aboutToExitFullscreen() {
|
||||
qDebug("DefaultGui::aboutToExitFullscreen");
|
||||
|
||||
BaseGuiPlus::aboutToExitFullscreen();
|
||||
|
||||
floating_control->hide();
|
||||
|
||||
if (!pref->compact_mode) {
|
||||
//menuBar()->show();
|
||||
//statusBar()->show();
|
||||
controlwidget->show();
|
||||
|
||||
showMainToolbar( show_main_toolbar );
|
||||
showLanguageToolbar( show_language_toolbar );
|
||||
}
|
||||
}
|
||||
|
||||
void DefaultGui::aboutToEnterCompactMode() {
|
||||
BaseGuiPlus::aboutToEnterCompactMode();
|
||||
|
||||
//menuBar()->hide();
|
||||
//statusBar()->hide();
|
||||
controlwidget->hide();
|
||||
controlwidget_mini->hide();
|
||||
toolbar1->hide();
|
||||
toolbar2->hide();
|
||||
}
|
||||
|
||||
void DefaultGui::aboutToExitCompactMode() {
|
||||
BaseGuiPlus::aboutToExitCompactMode();
|
||||
|
||||
//menuBar()->show();
|
||||
//statusBar()->show();
|
||||
controlwidget->show();
|
||||
|
||||
showMainToolbar( show_main_toolbar );
|
||||
showLanguageToolbar( show_language_toolbar );
|
||||
|
||||
// Recheck size of controlwidget
|
||||
resizeEvent( new QResizeEvent( size(), size() ) );
|
||||
}
|
||||
|
||||
void DefaultGui::showFloatingControl(QPoint /*p*/) {
|
||||
qDebug("DefaultGui::showFloatingControl");
|
||||
|
||||
#if CONTROLWIDGET_OVER_VIDEO
|
||||
//int w = mplayerwindow->width() / 2;
|
||||
int w = mplayerwindow->width() * floating_control_width / 100;
|
||||
int h = floating_control->height();
|
||||
floating_control->resize( w, h );
|
||||
|
||||
//int x = ( mplayerwindow->width() - floating_control->width() ) / 2;
|
||||
//int y = mplayerwindow->height() - floating_control->height();
|
||||
|
||||
int x = ( panel->x() + panel->width() - floating_control->width() ) / 2;
|
||||
int y = panel->y() + panel->height() - floating_control->height();
|
||||
floating_control->move( mapToGlobal(QPoint(x, y)) );
|
||||
|
||||
floating_control->show();
|
||||
#else
|
||||
if (!controlwidget->isVisible()) {
|
||||
controlwidget->show();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DefaultGui::showFloatingMenu(QPoint /*p*/) {
|
||||
#if !CONTROLWIDGET_OVER_VIDEO
|
||||
qDebug("DefaultGui::showFloatingMenu");
|
||||
|
||||
if (!menuBar()->isVisible())
|
||||
menuBar()->show();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DefaultGui::hideFloatingControls() {
|
||||
qDebug("DefaultGui::hideFloatingControls");
|
||||
|
||||
#if CONTROLWIDGET_OVER_VIDEO
|
||||
floating_control->hide();
|
||||
#else
|
||||
if (controlwidget->isVisible())
|
||||
controlwidget->hide();
|
||||
|
||||
if (menuBar()->isVisible())
|
||||
menuBar()->hide();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DefaultGui::resizeEvent( QResizeEvent * ) {
|
||||
/*
|
||||
qDebug("defaultGui::resizeEvent");
|
||||
qDebug(" controlwidget width: %d", controlwidget->width() );
|
||||
qDebug(" controlwidget_mini width: %d", controlwidget_mini->width() );
|
||||
*/
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
#define LIMIT 470
|
||||
#else
|
||||
#define LIMIT 570
|
||||
#endif
|
||||
|
||||
if ( (controlwidget->isVisible()) && (width() < LIMIT) ) {
|
||||
controlwidget->hide();
|
||||
controlwidget_mini->show();
|
||||
}
|
||||
else
|
||||
if ( (controlwidget_mini->isVisible()) && (width() > LIMIT) ) {
|
||||
controlwidget_mini->hide();
|
||||
controlwidget->show();
|
||||
}
|
||||
}
|
||||
|
||||
void DefaultGui::showMainToolbar(bool b) {
|
||||
qDebug("DefaultGui::showMainToolBar: %d", b);
|
||||
|
||||
show_main_toolbar = b;
|
||||
if (b) {
|
||||
toolbar1->show();
|
||||
}
|
||||
else {
|
||||
toolbar1->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void DefaultGui::showLanguageToolbar(bool b) {
|
||||
qDebug("DefaultGui::showLanguageToolBar: %d", b);
|
||||
|
||||
show_language_toolbar = b;
|
||||
if (b) {
|
||||
toolbar2->show();
|
||||
}
|
||||
else {
|
||||
toolbar2->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void DefaultGui::saveConfig() {
|
||||
qDebug("DefaultGui::saveConfig");
|
||||
|
||||
QSettings * set = settings;
|
||||
|
||||
set->beginGroup( "default_gui");
|
||||
|
||||
/*
|
||||
QString str;
|
||||
QTextOStream out(&str);
|
||||
out << *this;
|
||||
set->writeEntry( "data", str);
|
||||
*/
|
||||
|
||||
set->setValue( "show_main_toolbar", show_main_toolbar );
|
||||
set->setValue( "show_language_toolbar", show_language_toolbar );
|
||||
set->setValue( "floating_control_width", floating_control_width );
|
||||
|
||||
if (pref->save_window_size_on_exit) {
|
||||
qDebug("DefaultGui::saveConfig: w: %d h: %d", width(), height());
|
||||
set->setValue( "x", x() );
|
||||
set->setValue( "y", y() );
|
||||
set->setValue( "width", width() );
|
||||
set->setValue( "height", height() );
|
||||
}
|
||||
|
||||
set->setValue( "toolbars_state", saveState() );
|
||||
|
||||
set->endGroup();
|
||||
}
|
||||
|
||||
void DefaultGui::loadConfig() {
|
||||
qDebug("DefaultGui::loadConfig");
|
||||
|
||||
QSettings * set = settings;
|
||||
|
||||
set->beginGroup( "default_gui");
|
||||
|
||||
/*
|
||||
QString str = set->readEntry("data");
|
||||
QTextIStream in(&str);
|
||||
in >> *this;
|
||||
*/
|
||||
|
||||
show_main_toolbar = set->value( "show_main_toolbar", true ).toBool();
|
||||
show_language_toolbar = set->value( "show_language_toolbar", true ).toBool();
|
||||
floating_control_width = set->value( "floating_control_width", floating_control_width ).toInt();
|
||||
|
||||
if (pref->save_window_size_on_exit) {
|
||||
int x = set->value( "x", this->x() ).toInt();
|
||||
int y = set->value( "y", this->y() ).toInt();
|
||||
int width = set->value( "width", this->width() ).toInt();
|
||||
int height = set->value( "height", this->height() ).toInt();
|
||||
|
||||
if (height < 200) {
|
||||
width = 580;
|
||||
height = 440;
|
||||
}
|
||||
|
||||
move(x,y);
|
||||
resize(width,height);
|
||||
}
|
||||
|
||||
restoreState( set->value( "toolbars_state" ).toByteArray() );
|
||||
|
||||
set->endGroup();
|
||||
|
||||
showMainToolbarAct->setChecked( show_main_toolbar );
|
||||
showLanguageToolbarAct->setChecked( show_language_toolbar );
|
||||
|
||||
showMainToolbar( show_main_toolbar );
|
||||
showLanguageToolbar( show_language_toolbar );
|
||||
|
||||
updateWidgets();
|
||||
}
|
||||
|
||||
void DefaultGui::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
hide();
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
|
||||
#include "moc_defaultgui.cpp"
|
@ -1,117 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _DEFAULTGUI_H_
|
||||
#define _DEFAULTGUI_H_
|
||||
|
||||
#include "config.h"
|
||||
#include "baseguiplus.h"
|
||||
#include <QPoint>
|
||||
|
||||
class QLabel;
|
||||
class QToolBar;
|
||||
class TimeSlider;
|
||||
class MySlider;
|
||||
class QPushButton;
|
||||
class QResizeEvent;
|
||||
class FloatingControl;
|
||||
class MyAction;
|
||||
class QMenu;
|
||||
|
||||
class DefaultGui : public BaseGuiPlus
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DefaultGui( QWidget* parent = 0, Qt::WindowFlags flags = 0 );
|
||||
~DefaultGui();
|
||||
|
||||
public slots:
|
||||
//virtual void showPlaylist(bool b);
|
||||
virtual void showMainToolbar(bool b);
|
||||
virtual void showLanguageToolbar(bool b);
|
||||
|
||||
protected:
|
||||
void closeEvent (QCloseEvent * event);
|
||||
virtual void retranslateStrings();
|
||||
virtual QMenu * createPopupMenu();
|
||||
|
||||
void createStatusBar();
|
||||
void createMainToolBars();
|
||||
void createControlWidget();
|
||||
void createControlWidgetMini();
|
||||
void createFloatingControl();
|
||||
void createActions();
|
||||
void createMenus();
|
||||
|
||||
void loadConfig();
|
||||
void saveConfig();
|
||||
|
||||
virtual void aboutToEnterFullscreen();
|
||||
virtual void aboutToExitFullscreen();
|
||||
virtual void aboutToEnterCompactMode();
|
||||
virtual void aboutToExitCompactMode();
|
||||
|
||||
virtual void resizeEvent( QResizeEvent * );
|
||||
/* virtual void closeEvent( QCloseEvent * ); */
|
||||
|
||||
protected slots:
|
||||
virtual void updateWidgets();
|
||||
virtual void displayTime(double sec, int perc, QString text);
|
||||
virtual void displayFrame(int frame);
|
||||
|
||||
virtual void showFloatingControl(QPoint p);
|
||||
virtual void showFloatingMenu(QPoint p);
|
||||
virtual void hideFloatingControls();
|
||||
|
||||
protected:
|
||||
QLabel * time_display;
|
||||
QLabel * frame_display;
|
||||
|
||||
QToolBar * controlwidget;
|
||||
QToolBar * controlwidget_mini;
|
||||
|
||||
QToolBar * toolbar1;
|
||||
QToolBar * toolbar2;
|
||||
|
||||
QPushButton * select_audio;
|
||||
QPushButton * select_subtitle;
|
||||
|
||||
TimeSlider * timeslider;
|
||||
TimeSlider * timeslider_mini;
|
||||
|
||||
MySlider * volumeslider;
|
||||
MySlider * volumeslider_mini;
|
||||
|
||||
FloatingControl * floating_control;
|
||||
|
||||
MyAction * showMainToolbarAct;
|
||||
MyAction * showLanguageToolbarAct;
|
||||
|
||||
QMenu * toolbar_menu;
|
||||
|
||||
int last_second;
|
||||
|
||||
// Properties to save
|
||||
bool show_main_toolbar;
|
||||
bool show_language_toolbar;
|
||||
|
||||
int floating_control_width; // Percentage of screen
|
||||
};
|
||||
|
||||
#endif
|
@ -1,42 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "desktopinfo.h"
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
QSize DesktopInfo::desktop_size(QWidget *w) {
|
||||
QDesktopWidget * dw = QApplication::desktop();
|
||||
qDebug("DesktopInfo::desktop_size: primary screen: %d", dw->primaryScreen());
|
||||
|
||||
QSize s = dw->screen( dw->primaryScreen() )->size();
|
||||
|
||||
qDebug("DesktopInfo::desktop_size: size of primary screen: %d x %d", s.width(), s.height() );
|
||||
//return dw->screen( dw->primaryScreen() )->size();
|
||||
|
||||
QRect r = dw->screenGeometry(w);
|
||||
qDebug("DesktopInfo::desktop_size: size of screen: %d x %d", r.width(), r.height() );
|
||||
|
||||
return QSize(r.width(), r.height() );
|
||||
}
|
||||
|
||||
double DesktopInfo::desktop_aspectRatio(QWidget *w) {
|
||||
QSize s = DesktopInfo::desktop_size(w);
|
||||
return (double) s.width() / s.height() ;
|
||||
}
|
||||
|
@ -1,34 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _DESKTOPINFO_H_
|
||||
#define _DESKTOPINFO_H_
|
||||
|
||||
#include <QSize>
|
||||
|
||||
class QWidget;
|
||||
|
||||
class DesktopInfo
|
||||
{
|
||||
public:
|
||||
static QSize desktop_size(QWidget *w);
|
||||
static double desktop_aspectRatio(QWidget *w);
|
||||
};
|
||||
|
||||
#endif
|
@ -1,75 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "encodings.h"
|
||||
#include <QRegExp>
|
||||
|
||||
Encodings::Encodings( QObject * parent ) : QObject(parent)
|
||||
{
|
||||
retranslate();
|
||||
}
|
||||
|
||||
void Encodings::retranslate() {
|
||||
l.clear();
|
||||
l.append( "Unicode" );
|
||||
l.append( "UTF-8" );
|
||||
l.append( tr("Western European Languages") + " (ISO-8859-1)");
|
||||
l.append( tr("Western European Languages with Euro") + " (ISO-8859-15)");
|
||||
l.append( tr("Slavic/Central European Languages") + " (ISO-8859-2)");
|
||||
l.append( tr("Esperanto, Galician, Maltese, Turkish") + " (ISO-8859-3)");
|
||||
l.append( tr("Old Baltic charset") + " (ISO-8859-4)");
|
||||
l.append( tr("Cyrillic") + " (ISO-8859-5)");
|
||||
l.append( tr("Arabic") + " (ISO-8859-6)");
|
||||
l.append( tr("Modern Greek") + " (ISO-8859-7)");
|
||||
l.append( tr( "Turkish") + " (ISO-8859-9)");
|
||||
l.append( tr( "Baltic") + " (ISO-8859-13)");
|
||||
l.append( tr( "Celtic") + " (ISO-8859-14)");
|
||||
l.append( tr( "Hebrew charsets") + " (ISO-8859-8)");
|
||||
l.append( tr( "Russian") + " (KOI8-R)");
|
||||
l.append( tr( "Ukrainian, Belarusian") + " (KOI8-U/RU)");
|
||||
l.append( tr( "Simplified Chinese charset") + " (CP936)");
|
||||
l.append( tr( "Traditional Chinese charset") + " (BIG5)");
|
||||
l.append( tr( "Japanese charsets") + " (SHIFT-JIS)");
|
||||
l.append( tr( "Korean charset") + " (CP949)");
|
||||
l.append( tr( "Thai charset") + " (CP874)");
|
||||
l.append( tr( "Cyrillic Windows") + " (CP1251)");
|
||||
l.append( tr( "Slavic/Central European Windows") + " (CP1250)");
|
||||
l.append( tr( "Arabic Windows") + " (CP1256)");
|
||||
}
|
||||
|
||||
Encodings::~Encodings() {
|
||||
}
|
||||
|
||||
QString Encodings::parseEncoding(QString item) {
|
||||
QRegExp s(".* \\((.*)\\)");
|
||||
if (s.indexIn(item) != -1 )
|
||||
return s.cap(1);
|
||||
else
|
||||
return item;
|
||||
}
|
||||
|
||||
int Encodings::findEncoding(QString encoding) {
|
||||
int n;
|
||||
for (n=0; n < l.count(); n++) {
|
||||
if (l[n].contains("(" + encoding + ")") > 0)
|
||||
return n;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#include "moc_encodings.cpp"
|
@ -1,43 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _ENCODINGS_H_
|
||||
#define _ENCODINGS_H_
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
|
||||
class Encodings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Encodings( QObject * parent = 0 );
|
||||
~Encodings();
|
||||
|
||||
QStringList list() { return l;} ;
|
||||
QString parseEncoding(QString item);
|
||||
int findEncoding(QString encoding);
|
||||
|
||||
void retranslate();
|
||||
|
||||
private:
|
||||
QStringList l;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,78 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "eqslider.h"
|
||||
#include <QSlider>
|
||||
#include <QLabel>
|
||||
#include <QPixmap>
|
||||
#include "verticaltext.h"
|
||||
|
||||
|
||||
EqSlider::EqSlider( QWidget* parent, Qt::WindowFlags f)
|
||||
: QWidget(parent, f)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
_icon->setText( QString::null );
|
||||
_slider->setFocusPolicy( Qt::StrongFocus );
|
||||
_slider->setTickPosition( QSlider::TicksRight );
|
||||
_slider->setTickInterval( 10 );
|
||||
_slider->setSingleStep( 1 );
|
||||
_slider->setPageStep( 10 );
|
||||
|
||||
connect( _slider, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(sliderValueChanged(int)) );
|
||||
}
|
||||
|
||||
EqSlider::~EqSlider() {
|
||||
}
|
||||
|
||||
/*
|
||||
void EqSlider::languageChange() {
|
||||
}
|
||||
*/
|
||||
|
||||
void EqSlider::setIcon( QPixmap i) {
|
||||
_icon->setPixmap(i);
|
||||
}
|
||||
|
||||
const QPixmap * EqSlider::icon() const {
|
||||
return _icon->pixmap();
|
||||
}
|
||||
|
||||
void EqSlider::setLabel( QString s) {
|
||||
_label->setText(s);
|
||||
}
|
||||
|
||||
QString EqSlider::label() const {
|
||||
return _label->text();
|
||||
}
|
||||
|
||||
void EqSlider::setValue(int value) {
|
||||
_slider->setValue(value);
|
||||
}
|
||||
|
||||
int EqSlider::value() const {
|
||||
return _slider->value();
|
||||
}
|
||||
|
||||
void EqSlider::sliderValueChanged(int v) {
|
||||
emit valueChanged( v );
|
||||
}
|
||||
|
||||
#include "moc_eqslider.cpp"
|
@ -1,58 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _EQSLIDER_H_
|
||||
#define _EQSLIDER_H_
|
||||
|
||||
#include "ui_eqslider.h"
|
||||
#include <QPixmap>
|
||||
|
||||
class EqSlider : public QWidget, public Ui::EqSlider
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QPixmap icon READ icon WRITE setIcon)
|
||||
Q_PROPERTY(QString label READ label WRITE setLabel)
|
||||
Q_PROPERTY(int value READ value WRITE setValue)
|
||||
|
||||
public:
|
||||
EqSlider( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
||||
~EqSlider();
|
||||
|
||||
public slots:
|
||||
void setIcon( QPixmap i);
|
||||
void setLabel( QString s);
|
||||
void setValue(int value);
|
||||
|
||||
public:
|
||||
int value() const;
|
||||
const QPixmap * icon() const;
|
||||
QString label() const;
|
||||
|
||||
signals:
|
||||
void valueChanged(int);
|
||||
|
||||
protected slots:
|
||||
void sliderValueChanged(int);
|
||||
|
||||
protected:
|
||||
/* virtual void languageChange(); */
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -1,85 +0,0 @@
|
||||
<ui version="4.0" >
|
||||
<class>EqSlider</class>
|
||||
<widget class="QWidget" name="EqSlider" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>124</width>
|
||||
<height>205</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowIcon" >
|
||||
<iconset/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="_icon" >
|
||||
<property name="text" >
|
||||
<string>icon</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="VerticalText" native="1" name="_label" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="_slider" >
|
||||
<property name="minimum" >
|
||||
<number>-100</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="0" margin="0" />
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>VerticalText</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>verticaltext.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<includes>
|
||||
<include location="local" >verticaltext.h</include>
|
||||
</includes>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,60 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "filedialog.h"
|
||||
#include <QWidget>
|
||||
|
||||
QString MyFileDialog::getOpenFileName( QWidget * parent,
|
||||
const QString & caption,
|
||||
const QString & dir, const QString & filter,
|
||||
QString * selectedFilter, QFileDialog::Options options )
|
||||
{
|
||||
return QFileDialog::getOpenFileName( parent, caption, dir, filter,
|
||||
selectedFilter, options );
|
||||
}
|
||||
|
||||
QString MyFileDialog::getExistingDirectory ( QWidget * parent,
|
||||
const QString & caption,
|
||||
const QString & dir,
|
||||
QFileDialog::Options options )
|
||||
{
|
||||
return QFileDialog::getExistingDirectory( parent, caption, dir, options );
|
||||
}
|
||||
|
||||
QString MyFileDialog::getSaveFileName ( QWidget * parent,
|
||||
const QString & caption,
|
||||
const QString & dir,
|
||||
const QString & filter,
|
||||
QString * selectedFilter,
|
||||
QFileDialog::Options options )
|
||||
{
|
||||
return QFileDialog::getSaveFileName( parent, caption, dir, filter,
|
||||
selectedFilter, options );
|
||||
}
|
||||
|
||||
QStringList MyFileDialog::getOpenFileNames ( QWidget * parent,
|
||||
const QString & caption,
|
||||
const QString & dir,
|
||||
const QString & filter,
|
||||
QString * selectedFilter,
|
||||
QFileDialog::Options options )
|
||||
{
|
||||
return QFileDialog::getOpenFileNames( parent, caption, dir, filter,
|
||||
selectedFilter, options );
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _FILEDIALOG_H
|
||||
#define _FILEDIALOG_H
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QFileDialog>
|
||||
|
||||
class QWidget;
|
||||
|
||||
class MyFileDialog {
|
||||
|
||||
public:
|
||||
static QString getOpenFileName( QWidget * parent = 0,
|
||||
const QString & caption = QString(),
|
||||
const QString & dir = QString(),
|
||||
const QString & filter = QString(),
|
||||
QString * selectedFilter = 0,
|
||||
QFileDialog::Options options = QFileDialog::DontResolveSymlinks ) ;
|
||||
|
||||
static QString getExistingDirectory ( QWidget * parent = 0,
|
||||
const QString & caption = QString(),
|
||||
const QString & dir = QString(),
|
||||
QFileDialog::Options options = QFileDialog::ShowDirsOnly );
|
||||
|
||||
static QString getSaveFileName ( QWidget * parent = 0,
|
||||
const QString & caption = QString(),
|
||||
const QString & dir = QString(),
|
||||
const QString & filter = QString(),
|
||||
QString * selectedFilter = 0,
|
||||
QFileDialog::Options options = QFileDialog::DontResolveSymlinks |
|
||||
QFileDialog::DontConfirmOverwrite );
|
||||
|
||||
static QStringList getOpenFileNames ( QWidget * parent = 0,
|
||||
const QString & caption = QString(),
|
||||
const QString & dir = QString(),
|
||||
const QString & filter = QString(),
|
||||
QString * selectedFilter = 0,
|
||||
QFileDialog::Options options = QFileDialog::DontResolveSymlinks );
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,225 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "filepropertiesdialog.h"
|
||||
#include <QListWidget>
|
||||
#include <QLineEdit>
|
||||
#include <QTextEdit>
|
||||
#include <QPushButton>
|
||||
#include "images.h"
|
||||
#include "infofile.h"
|
||||
|
||||
|
||||
FilePropertiesDialog::FilePropertiesDialog( QWidget* parent, Qt::WindowFlags f )
|
||||
: QDialog(parent, f)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
// Setup buttons
|
||||
okButton = buttonBox->button(QDialogButtonBox::Ok);
|
||||
cancelButton = buttonBox->button(QDialogButtonBox::Cancel);
|
||||
applyButton = buttonBox->button(QDialogButtonBox::Apply);
|
||||
connect( applyButton, SIGNAL(clicked()), this, SLOT(apply()) );
|
||||
|
||||
codecs_set = FALSE;
|
||||
|
||||
// Read codec info from InfoReader:
|
||||
InfoReader *i = InfoReader::obj();
|
||||
setCodecs( i->vcList(), i->acList(), i->demuxerList() );
|
||||
|
||||
retranslateStrings();
|
||||
}
|
||||
|
||||
FilePropertiesDialog::~FilePropertiesDialog() {
|
||||
}
|
||||
|
||||
void FilePropertiesDialog::setMediaData(MediaData md) {
|
||||
media_data = md;
|
||||
showInfo();
|
||||
}
|
||||
|
||||
void FilePropertiesDialog::showInfo() {
|
||||
InfoFile info;
|
||||
info_edit->setText( info.getInfo(media_data) );
|
||||
}
|
||||
|
||||
void FilePropertiesDialog::retranslateStrings() {
|
||||
retranslateUi(this);
|
||||
|
||||
setWindowIcon( Images::icon("logo") );
|
||||
|
||||
showInfo();
|
||||
|
||||
// Qt 4.2 doesn't update the buttons' text
|
||||
#if QT_VERSION < 0x040300
|
||||
okButton->setText( tr("OK") );
|
||||
cancelButton->setText( tr("Cancel") );
|
||||
applyButton->setText( tr("Apply") );
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void FilePropertiesDialog::accept() {
|
||||
qDebug("FilePropertiesDialog::accept");
|
||||
|
||||
hide();
|
||||
setResult( QDialog::Accepted );
|
||||
emit applied();
|
||||
}
|
||||
|
||||
void FilePropertiesDialog::apply() {
|
||||
qDebug("FilePropertiesDialog::apply");
|
||||
|
||||
setResult( QDialog::Accepted );
|
||||
emit applied();
|
||||
}
|
||||
|
||||
void FilePropertiesDialog::setCodecs(InfoList vc, InfoList ac, InfoList demuxer)
|
||||
{
|
||||
vclist = vc;
|
||||
aclist = ac;
|
||||
demuxerlist = demuxer;
|
||||
|
||||
InfoList::iterator it;
|
||||
|
||||
for ( it = vclist.begin(); it != vclist.end(); ++it ) {
|
||||
vc_listbox->addItem( (*it).name() +" - "+ (*it).desc() );
|
||||
}
|
||||
|
||||
for ( it = aclist.begin(); it != aclist.end(); ++it ) {
|
||||
ac_listbox->addItem( (*it).name() +" - "+ (*it).desc() );
|
||||
}
|
||||
|
||||
for ( it = demuxerlist.begin(); it != demuxerlist.end(); ++it ) {
|
||||
demuxer_listbox->addItem( (*it).name() +" - "+ (*it).desc() );
|
||||
}
|
||||
|
||||
codecs_set = TRUE;
|
||||
}
|
||||
|
||||
void FilePropertiesDialog::setDemuxer(QString demuxer, QString original_demuxer) {
|
||||
qDebug("FilePropertiesDialog::setDemuxer");
|
||||
if (!original_demuxer.isEmpty()) orig_demuxer = original_demuxer;
|
||||
int pos = find(demuxer, demuxerlist );
|
||||
if (pos != -1) demuxer_listbox->setCurrentRow(pos);
|
||||
|
||||
qDebug(" * demuxer: '%s', pos: %d", demuxer.toUtf8().data(), pos );
|
||||
}
|
||||
|
||||
QString FilePropertiesDialog::demuxer() {
|
||||
int pos = demuxer_listbox->currentRow();
|
||||
if ( pos < 0 )
|
||||
return "";
|
||||
else
|
||||
return demuxerlist[pos].name();
|
||||
}
|
||||
|
||||
void FilePropertiesDialog::setVideoCodec(QString vc, QString original_vc) {
|
||||
qDebug("FilePropertiesDialog::setVideoCodec");
|
||||
if (!original_vc.isEmpty()) orig_vc = original_vc;
|
||||
int pos = find(vc, vclist );
|
||||
if (pos != -1) vc_listbox->setCurrentRow(pos);
|
||||
|
||||
qDebug(" * vc: '%s', pos: %d", vc.toUtf8().data(), pos );
|
||||
}
|
||||
|
||||
QString FilePropertiesDialog::videoCodec() {
|
||||
int pos = vc_listbox->currentRow();
|
||||
if ( pos < 0 )
|
||||
return "";
|
||||
else
|
||||
return vclist[pos].name();
|
||||
}
|
||||
|
||||
void FilePropertiesDialog::setAudioCodec(QString ac, QString original_ac) {
|
||||
qDebug("FilePropertiesDialog::setAudioCodec");
|
||||
if (!original_ac.isEmpty()) orig_ac = original_ac;
|
||||
int pos = find(ac, aclist );
|
||||
if (pos != -1) ac_listbox->setCurrentRow(pos);
|
||||
|
||||
qDebug(" * ac: '%s', pos: %d", ac.toUtf8().data(), pos );
|
||||
}
|
||||
|
||||
QString FilePropertiesDialog::audioCodec() {
|
||||
int pos = ac_listbox->currentRow();
|
||||
if ( pos < 0 )
|
||||
return "";
|
||||
else
|
||||
return aclist[pos].name();
|
||||
}
|
||||
|
||||
void FilePropertiesDialog::on_resetDemuxerButton_clicked() {
|
||||
setDemuxer( orig_demuxer );
|
||||
}
|
||||
|
||||
void FilePropertiesDialog::on_resetACButton_clicked() {
|
||||
setAudioCodec( orig_ac );
|
||||
}
|
||||
|
||||
void FilePropertiesDialog::on_resetVCButton_clicked() {
|
||||
setVideoCodec( orig_vc );
|
||||
}
|
||||
|
||||
int FilePropertiesDialog::find(QString s, InfoList &list) {
|
||||
qDebug("FilePropertiesDialog::find");
|
||||
|
||||
int n=0;
|
||||
InfoList::iterator it;
|
||||
|
||||
for ( it = list.begin(); it != list.end(); ++it ) {
|
||||
//qDebug(" * item: '%s', s: '%s'", (*it).name().toUtf8().data(), s.toUtf8().data());
|
||||
if ((*it).name() == s) return n;
|
||||
n++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void FilePropertiesDialog::setMplayerAdditionalArguments(QString args) {
|
||||
mplayer_args_edit->setText(args);
|
||||
}
|
||||
|
||||
QString FilePropertiesDialog::mplayerAdditionalArguments() {
|
||||
return mplayer_args_edit->text();
|
||||
}
|
||||
|
||||
void FilePropertiesDialog::setMplayerAdditionalVideoFilters(QString s) {
|
||||
mplayer_vfilters_edit->setText(s);
|
||||
}
|
||||
|
||||
QString FilePropertiesDialog::mplayerAdditionalVideoFilters() {
|
||||
return mplayer_vfilters_edit->text();
|
||||
}
|
||||
|
||||
void FilePropertiesDialog::setMplayerAdditionalAudioFilters(QString s) {
|
||||
mplayer_afilters_edit->setText(s);
|
||||
}
|
||||
|
||||
QString FilePropertiesDialog::mplayerAdditionalAudioFilters() {
|
||||
return mplayer_afilters_edit->text();
|
||||
}
|
||||
|
||||
// Language change stuff
|
||||
void FilePropertiesDialog::changeEvent(QEvent *e) {
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
retranslateStrings();
|
||||
} else {
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_filepropertiesdialog.cpp"
|
@ -1,91 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _FILEPROPERTIESDIALOG_H_
|
||||
#define _FILEPROPERTIESDIALOG_H_
|
||||
|
||||
#include "ui_filepropertiesdialog.h"
|
||||
#include "inforeader.h"
|
||||
#include "mediadata.h"
|
||||
|
||||
class QPushButton;
|
||||
|
||||
class FilePropertiesDialog : public QDialog, public Ui::FilePropertiesDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FilePropertiesDialog( QWidget* parent = 0, Qt::WindowFlags f = 0 );
|
||||
~FilePropertiesDialog();
|
||||
|
||||
void setMediaData(MediaData md);
|
||||
|
||||
void setDemuxer(QString demuxer, QString original_demuxer="");
|
||||
QString demuxer();
|
||||
|
||||
void setVideoCodec(QString vc, QString original_vc="");
|
||||
QString videoCodec();
|
||||
|
||||
void setAudioCodec(QString ac, QString original_ac="");
|
||||
QString audioCodec();
|
||||
|
||||
void setMplayerAdditionalArguments(QString args);
|
||||
QString mplayerAdditionalArguments();
|
||||
|
||||
void setMplayerAdditionalVideoFilters(QString s);
|
||||
QString mplayerAdditionalVideoFilters();
|
||||
|
||||
void setMplayerAdditionalAudioFilters(QString s);
|
||||
QString mplayerAdditionalAudioFilters();
|
||||
|
||||
public slots:
|
||||
void accept(); // Reimplemented to send a signal
|
||||
void apply();
|
||||
|
||||
signals:
|
||||
void applied();
|
||||
|
||||
protected slots:
|
||||
virtual void on_resetDemuxerButton_clicked();
|
||||
virtual void on_resetACButton_clicked();
|
||||
virtual void on_resetVCButton_clicked();
|
||||
|
||||
protected:
|
||||
// Call it as soon as possible
|
||||
void setCodecs(InfoList vc, InfoList ac, InfoList demuxer);
|
||||
bool hasCodecsList() { return codecs_set; };
|
||||
|
||||
int find(QString s, InfoList &list);
|
||||
void showInfo();
|
||||
|
||||
protected:
|
||||
virtual void retranslateStrings();
|
||||
virtual void changeEvent ( QEvent * event ) ;
|
||||
|
||||
private:
|
||||
bool codecs_set;
|
||||
InfoList vclist, aclist, demuxerlist;
|
||||
QString orig_demuxer, orig_ac, orig_vc;
|
||||
MediaData media_data;
|
||||
|
||||
QPushButton * okButton;
|
||||
QPushButton * cancelButton;
|
||||
QPushButton * applyButton;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,502 +0,0 @@
|
||||
<ui version="4.0" >
|
||||
<author>Ricardo Villalba</author>
|
||||
<class>FilePropertiesDialog</class>
|
||||
<widget class="QDialog" name="FilePropertiesDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>502</width>
|
||||
<height>455</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>SMPlayer - File properties</string>
|
||||
</property>
|
||||
<property name="windowIcon" >
|
||||
<iconset/>
|
||||
</property>
|
||||
<property name="sizeGripEnabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget" >
|
||||
<property name="currentIndex" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="info_page" >
|
||||
<attribute name="title" >
|
||||
<string>&Information</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QTextEdit" name="info_edit" >
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="demuxer_page" >
|
||||
<attribute name="title" >
|
||||
<string>&Demuxer</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel2" >
|
||||
<property name="text" >
|
||||
<string>&Select the demuxer that will be used for this file:</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>demuxer_listbox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="demuxer_listbox" />
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>241</width>
|
||||
<height>41</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="resetDemuxerButton" >
|
||||
<property name="text" >
|
||||
<string>&Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="vc_page" >
|
||||
<attribute name="title" >
|
||||
<string>&Video codec</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel3" >
|
||||
<property name="text" >
|
||||
<string>&Select the video codec:</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>vc_listbox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="vc_listbox" />
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>241</width>
|
||||
<height>41</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="resetVCButton" >
|
||||
<property name="text" >
|
||||
<string>&Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="ac_page" >
|
||||
<attribute name="title" >
|
||||
<string>A&udio codec</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel4" >
|
||||
<property name="text" >
|
||||
<string>&Select the audio codec:</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>ac_listbox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="ac_listbox" />
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>241</width>
|
||||
<height>41</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="resetACButton" >
|
||||
<property name="text" >
|
||||
<string>&Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="options_page" >
|
||||
<attribute name="title" >
|
||||
<string>&MPlayer options</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<string>Additional Options for MPlayer</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel3_2" >
|
||||
<property name="text" >
|
||||
<string>Here you can pass extra options to MPlayer.
|
||||
Write them separated by spaces.
|
||||
Example: -flip -nosound</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel1_3" >
|
||||
<property name="text" >
|
||||
<string>&Options:</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>mplayer_args_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="mplayer_args_edit" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line2" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::HLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel4_2" >
|
||||
<property name="text" >
|
||||
<string>You can also pass additional video filters.
|
||||
Separate them with ",". Do not use spaces!
|
||||
Example: scale=512:-2,eq2=1.1</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel2_3" >
|
||||
<property name="text" >
|
||||
<string>V&ideo filters:</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>mplayer_vfilters_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="mplayer_vfilters_edit" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line3" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::HLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel5_2" >
|
||||
<property name="text" >
|
||||
<string>And finally audio filters. Same rule as for video filters.
|
||||
Example: resample=44100:0:0,volnorm</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel3_3" >
|
||||
<property name="text" >
|
||||
<string>Audio &filters:</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>mplayer_afilters_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="mplayer_afilters_edit" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11" />
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
<tabstop>resetDemuxerButton</tabstop>
|
||||
<tabstop>resetVCButton</tabstop>
|
||||
<tabstop>resetACButton</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>FilePropertiesDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>267</x>
|
||||
<y>468</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>267</x>
|
||||
<y>246</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>FilePropertiesDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>267</x>
|
||||
<y>468</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>267</x>
|
||||
<y>246</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -1,247 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "floatingcontrol.h"
|
||||
|
||||
#include <QToolButton>
|
||||
#include <QIcon>
|
||||
#include <QLCDNumber>
|
||||
#include <QLabel>
|
||||
#include <QFrame>
|
||||
#include <QHBoxLayout>
|
||||
#include <QEvent>
|
||||
#include <QApplication>
|
||||
|
||||
#include "timeslider.h"
|
||||
#include "images.h"
|
||||
#include "helper.h"
|
||||
|
||||
|
||||
class MyToolButton : public QToolButton {
|
||||
public:
|
||||
MyToolButton ( QWidget * parent );
|
||||
};
|
||||
|
||||
MyToolButton::MyToolButton( QWidget * parent ) : QToolButton(parent)
|
||||
{
|
||||
setAutoRaise(true);
|
||||
setIconSize( QSize(32,32) );
|
||||
}
|
||||
|
||||
|
||||
FloatingControl::FloatingControl( QWidget * parent )
|
||||
: QWidget( parent, Qt::Window | Qt::FramelessWindowHint |
|
||||
Qt::WindowStaysOnTopHint |
|
||||
Qt::X11BypassWindowManagerHint )
|
||||
{
|
||||
play = new MyToolButton(this);
|
||||
pause = new MyToolButton(this);
|
||||
stop = new MyToolButton(this);
|
||||
|
||||
rewind3 = new MyToolButton(this);
|
||||
rewind2 = new MyToolButton(this);
|
||||
rewind1 = new MyToolButton(this);
|
||||
|
||||
time = new TimeSlider(this);
|
||||
|
||||
forward1 = new MyToolButton(this);
|
||||
forward2 = new MyToolButton(this);
|
||||
forward3 = new MyToolButton(this);
|
||||
|
||||
#if NEW_CONTROLWIDGET
|
||||
time_label = new QLabel(this);
|
||||
time_label->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
|
||||
time_label->setAutoFillBackground(TRUE);
|
||||
|
||||
Helper::setBackgroundColor( time_label, QColor(0,0,0) );
|
||||
Helper::setForegroundColor( time_label, QColor(255,255,255) );
|
||||
time_label->setText( "00:00:00" );
|
||||
time_label->setFrameShape( QFrame::Panel );
|
||||
time_label->setFrameShadow( QFrame::Sunken );
|
||||
#else
|
||||
lcd = new QLCDNumber(this);
|
||||
lcd->setNumDigits(10); // maximum time with 10 digits is 9999:59:59
|
||||
lcd->setFrameShape( QFrame::WinPanel );
|
||||
lcd->setFrameShadow( QFrame::Sunken );
|
||||
lcd->setAutoFillBackground(TRUE);
|
||||
|
||||
Helper::setBackgroundColor( lcd, QColor(0,0,0) );
|
||||
Helper::setForegroundColor( lcd, QColor(200,200,200) );
|
||||
lcd->setSegmentStyle( QLCDNumber::Flat );
|
||||
lcd->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
#endif
|
||||
|
||||
fullscreen = new MyToolButton(this);
|
||||
fullscreen->setCheckable(true);
|
||||
|
||||
mute = new MyToolButton(this);
|
||||
mute->setCheckable(true);
|
||||
|
||||
volume = new MySlider(this);
|
||||
volume->setMinimum(0);
|
||||
volume->setMaximum(100);
|
||||
volume->setValue(50);
|
||||
volume->setTickPosition( QSlider::TicksBelow );
|
||||
volume->setTickInterval( 10 );
|
||||
volume->setSingleStep( 1 );
|
||||
volume->setPageStep( 10 );
|
||||
volume->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
// No focus on widgets
|
||||
rewind3->setFocusPolicy( Qt::NoFocus );
|
||||
rewind2->setFocusPolicy( Qt::NoFocus );
|
||||
rewind1->setFocusPolicy( Qt::NoFocus );
|
||||
|
||||
forward1->setFocusPolicy( Qt::NoFocus );
|
||||
forward2->setFocusPolicy( Qt::NoFocus );
|
||||
forward3->setFocusPolicy( Qt::NoFocus );
|
||||
|
||||
play->setFocusPolicy( Qt::NoFocus );
|
||||
pause->setFocusPolicy( Qt::NoFocus );
|
||||
stop->setFocusPolicy( Qt::NoFocus );
|
||||
#if !NEW_CONTROLWIDGET
|
||||
lcd->setFocusPolicy( Qt::NoFocus );
|
||||
#endif
|
||||
fullscreen->setFocusPolicy( Qt::NoFocus );
|
||||
mute->setFocusPolicy( Qt::NoFocus );
|
||||
volume->setFocusPolicy( Qt::NoFocus );
|
||||
|
||||
// Layout
|
||||
#if NEW_CONTROLWIDGET
|
||||
QHBoxLayout * l = new QHBoxLayout;
|
||||
l->setMargin(2);
|
||||
l->setSpacing(1);
|
||||
|
||||
l->addWidget( play );
|
||||
l->addWidget( pause );
|
||||
l->addWidget( stop );
|
||||
l->addSpacing( 10 );
|
||||
l->addWidget( rewind3 );
|
||||
l->addWidget( rewind2 );
|
||||
l->addWidget( rewind1 );
|
||||
l->addWidget( time );
|
||||
l->addWidget( forward1 );
|
||||
l->addWidget( forward2 );
|
||||
l->addWidget( forward3 );
|
||||
l->addSpacing( 10 );
|
||||
l->addWidget( fullscreen );
|
||||
l->addWidget( mute );
|
||||
l->addWidget( volume );
|
||||
l->addSpacing( 10 );
|
||||
l->addWidget( time_label );
|
||||
|
||||
setLayout(l);
|
||||
#else
|
||||
QHBoxLayout * l1 = new QHBoxLayout;
|
||||
l1->setMargin(0);
|
||||
l1->setSpacing(0);
|
||||
|
||||
l1->addWidget( rewind3 );
|
||||
l1->addWidget( rewind2 );
|
||||
l1->addWidget( rewind1 );
|
||||
l1->addWidget( time );
|
||||
l1->addWidget( forward1 );
|
||||
l1->addWidget( forward2 );
|
||||
l1->addWidget( forward3 );
|
||||
|
||||
QSpacerItem * spacer1 = new QSpacerItem( 20, 10, QSizePolicy::Expanding,
|
||||
QSizePolicy::Minimum );
|
||||
|
||||
QSpacerItem * spacer2 = new QSpacerItem( 20, 10, QSizePolicy::Expanding,
|
||||
QSizePolicy::Minimum );
|
||||
|
||||
QHBoxLayout * l2 = new QHBoxLayout;
|
||||
l2->setMargin(0);
|
||||
l2->setSpacing(0);
|
||||
|
||||
l2->addWidget( play );
|
||||
l2->addWidget( pause );
|
||||
l2->addWidget( stop );
|
||||
l2->addItem( spacer1 );
|
||||
l2->addWidget( lcd );
|
||||
l2->addItem( spacer2 );
|
||||
l2->addWidget( fullscreen );
|
||||
l2->addWidget( mute );
|
||||
l2->addWidget( volume );
|
||||
|
||||
QVBoxLayout * l = new QVBoxLayout;
|
||||
l->setMargin(0);
|
||||
l->setSpacing(0);
|
||||
|
||||
l->addLayout(l1);
|
||||
l->addLayout(l2);
|
||||
|
||||
setLayout(l);
|
||||
#endif
|
||||
|
||||
retranslateStrings();
|
||||
|
||||
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
|
||||
FloatingControl::~FloatingControl()
|
||||
{
|
||||
}
|
||||
|
||||
void FloatingControl::retranslateStrings() {
|
||||
int size = 22;
|
||||
|
||||
pause->setIcon( Images::icon("pause", size) );
|
||||
stop->setIcon( Images::icon("stop", size) );
|
||||
|
||||
if (qApp->isLeftToRight()) {
|
||||
play->setIcon( Images::icon("play", size) );
|
||||
|
||||
forward1->setIcon( Images::icon("forward10s", size) );
|
||||
forward2->setIcon( Images::icon("forward1m", size) );
|
||||
forward3->setIcon( Images::icon("forward10m", size) );
|
||||
|
||||
rewind1->setIcon( Images::icon("rewind10s", size) );
|
||||
rewind2->setIcon( Images::icon("rewind1m", size) );
|
||||
rewind3->setIcon( Images::icon("rewind10m", size) );
|
||||
} else {
|
||||
play->setIcon( Images::flippedIcon("play", size) );
|
||||
|
||||
forward1->setIcon( Images::flippedIcon("forward10s", size) );
|
||||
forward2->setIcon( Images::flippedIcon("forward1m", size) );
|
||||
forward3->setIcon( Images::flippedIcon("forward10m", size) );
|
||||
|
||||
rewind1->setIcon( Images::flippedIcon("rewind10s", size) );
|
||||
rewind2->setIcon( Images::flippedIcon("rewind1m", size) );
|
||||
rewind3->setIcon( Images::flippedIcon("rewind10m", size) );
|
||||
}
|
||||
|
||||
fullscreen->setIcon( Images::icon("fullscreen", size) );
|
||||
|
||||
QIcon icset( Images::icon("volume", size) );
|
||||
icset.addPixmap( Images::icon("mute", size), QIcon::Normal, QIcon::On );
|
||||
mute->setIcon( icset );
|
||||
}
|
||||
|
||||
// Language change stuff
|
||||
void FloatingControl::changeEvent(QEvent *e) {
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
retranslateStrings();
|
||||
} else {
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_floatingcontrol.cpp"
|
@ -1,65 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _FLOATINGCONTROL_H_
|
||||
#define _FLOATINGCONTROL_H_
|
||||
|
||||
#include <QWidget>
|
||||
#include "config.h"
|
||||
|
||||
class QToolButton;
|
||||
class TimeSlider;
|
||||
class MySlider;
|
||||
class QLCDNumber;
|
||||
class QLabel;
|
||||
|
||||
class FloatingControl : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
FloatingControl( QWidget * parent = 0);
|
||||
~FloatingControl();
|
||||
|
||||
QToolButton * rewind1;
|
||||
QToolButton * rewind2;
|
||||
QToolButton * rewind3;
|
||||
QToolButton * forward1;
|
||||
QToolButton * forward2;
|
||||
QToolButton * forward3;
|
||||
QToolButton * play;
|
||||
QToolButton * stop;
|
||||
QToolButton * pause;
|
||||
TimeSlider * time;
|
||||
QToolButton * fullscreen;
|
||||
QToolButton * mute;
|
||||
MySlider * volume;
|
||||
#if NEW_CONTROLWIDGET
|
||||
QLabel * time_label;
|
||||
#else
|
||||
QLCDNumber * lcd;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void retranslateStrings();
|
||||
virtual void changeEvent ( QEvent * event ) ;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,71 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#include "global.h"
|
||||
#include "constants.h"
|
||||
#include <QSettings>
|
||||
#include "preferences.h"
|
||||
#include "translator.h"
|
||||
#include "helper.h"
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
|
||||
QSettings * settings;
|
||||
Preferences * pref;
|
||||
Translator * translator;
|
||||
|
||||
|
||||
void global_init(const QString & ini_path) {
|
||||
qDebug("global_init");
|
||||
|
||||
// Translator
|
||||
translator = new Translator();
|
||||
|
||||
// settings
|
||||
if (!ini_path.isEmpty()) {
|
||||
QString file = ini_path + "/smplayer.ini";
|
||||
settings = new QSettings( file, QSettings::IniFormat );
|
||||
qDebug("global_init: config file: '%s'", file.toUtf8().data());
|
||||
}
|
||||
else
|
||||
if (QFile::exists(Helper::appHomePath())) {
|
||||
QString file = Helper::appHomePath() + "/smplayer.ini";
|
||||
settings = new QSettings( file, QSettings::IniFormat );
|
||||
qDebug("global_init: config file: '%s'", file.toUtf8().data());
|
||||
}
|
||||
else
|
||||
{
|
||||
settings = new QSettings(QSettings::IniFormat, QSettings::UserScope,
|
||||
QString(COMPANY), QString(PROGRAM) );
|
||||
}
|
||||
|
||||
// Preferences
|
||||
pref = new Preferences();
|
||||
}
|
||||
|
||||
void global_end() {
|
||||
qDebug("global_end");
|
||||
|
||||
// delete
|
||||
delete pref;
|
||||
pref = 0;
|
||||
|
||||
delete settings;
|
||||
delete translator;
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _GLOBAL_H_
|
||||
#define _GLOBAL_H_
|
||||
|
||||
#include <QString>
|
||||
|
||||
// Some global objects
|
||||
|
||||
class QSettings;
|
||||
class Preferences;
|
||||
class Translator;
|
||||
|
||||
|
||||
// Read and store application settings
|
||||
extern QSettings * settings;
|
||||
|
||||
// Prefences
|
||||
extern Preferences * pref;
|
||||
|
||||
// Translator (for changing language)
|
||||
extern Translator * translator;
|
||||
|
||||
|
||||
void global_init(const QString & ini_path);
|
||||
void global_end();
|
||||
|
||||
#endif
|
||||
|
@ -1,351 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "helper.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QFileInfo>
|
||||
#include <QColor>
|
||||
#include <QRegExp>
|
||||
#include <QDir>
|
||||
#include <QTextCodec>
|
||||
#include <QWidget>
|
||||
#include "config.h"
|
||||
|
||||
#include <QLibraryInfo>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <windows.h> // For the screensaver stuff
|
||||
#endif
|
||||
|
||||
/*
|
||||
#if EXTERNAL_SLEEP
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <qthread.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if !EXTERNAL_SLEEP
|
||||
class Sleeper : public QThread
|
||||
{
|
||||
public:
|
||||
static void sleep(unsigned long secs) {QThread::sleep(secs);}
|
||||
static void msleep(unsigned long msecs) {
|
||||
//qDebug("sleeping...");
|
||||
QThread::msleep(msecs);
|
||||
//qDebug("finished");
|
||||
}
|
||||
static void usleep(unsigned long usecs) {QThread::usleep(usecs);}
|
||||
};
|
||||
#endif
|
||||
*/
|
||||
|
||||
|
||||
QString Helper::logs;
|
||||
QString Helper::app_path;
|
||||
|
||||
|
||||
void Helper::setAppPath(QString path) {
|
||||
app_path = path;
|
||||
}
|
||||
|
||||
QString Helper::appPath() {
|
||||
return app_path;
|
||||
}
|
||||
|
||||
QString Helper::dataPath() {
|
||||
#ifdef DATA_PATH
|
||||
QString path = QString(DATA_PATH);
|
||||
if (!path.isEmpty())
|
||||
return path;
|
||||
else
|
||||
return appPath();
|
||||
#else
|
||||
return appPath();
|
||||
#endif
|
||||
}
|
||||
|
||||
QString Helper::translationPath() {
|
||||
#ifdef TRANSLATION_PATH
|
||||
QString path = QString(TRANSLATION_PATH);
|
||||
if (!path.isEmpty())
|
||||
return path;
|
||||
else
|
||||
return appPath() + "/translations";
|
||||
#else
|
||||
return appPath() + "/translations";
|
||||
#endif
|
||||
}
|
||||
|
||||
QString Helper::docPath() {
|
||||
#ifdef DOC_PATH
|
||||
QString path = QString(DOC_PATH);
|
||||
if (!path.isEmpty())
|
||||
return path;
|
||||
else
|
||||
return appPath();
|
||||
#else
|
||||
return appPath();
|
||||
#endif
|
||||
}
|
||||
|
||||
QString Helper::confPath() {
|
||||
#ifdef CONF_PATH
|
||||
QString path = QString(CONF_PATH);
|
||||
if (!path.isEmpty())
|
||||
return path;
|
||||
else
|
||||
return appPath();
|
||||
#else
|
||||
return appPath();
|
||||
#endif
|
||||
}
|
||||
|
||||
QString Helper::themesPath() {
|
||||
#ifdef THEMES_PATH
|
||||
QString path = QString(THEMES_PATH);
|
||||
if (!path.isEmpty())
|
||||
return path;
|
||||
else
|
||||
return appPath() + "/themes";
|
||||
#else
|
||||
return appPath() + "/themes";
|
||||
#endif
|
||||
}
|
||||
|
||||
QString Helper::shortcutsPath() {
|
||||
#ifdef SHORTCUTS_PATH
|
||||
QString path = QString(SHORTCUTS_PATH);
|
||||
if (!path.isEmpty())
|
||||
return path;
|
||||
else
|
||||
return appPath() + "/shortcuts";
|
||||
#else
|
||||
return appPath() + "/shortcuts";
|
||||
#endif
|
||||
}
|
||||
|
||||
QString Helper::qtTranslationPath() {
|
||||
return QLibraryInfo::location(QLibraryInfo::TranslationsPath);
|
||||
}
|
||||
|
||||
QString Helper::appHomePath() {
|
||||
return QDir::homePath() + "/.smplayer";
|
||||
}
|
||||
|
||||
QString Helper::filenameForPref(const QString & filename) {
|
||||
QString s = filename;
|
||||
s = s.replace('/', '_');
|
||||
s = s.replace('\\', '_');
|
||||
s = s.replace(':', '_');
|
||||
s = s.replace('.', '_');
|
||||
s = s.replace(' ', '_');
|
||||
|
||||
QFileInfo fi(filename);
|
||||
if (fi.exists()) {
|
||||
s += "_" + QString::number( fi.size() );
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
QString Helper::dvdForPref(const QString & dvd_id, int title) {
|
||||
return QString("DVD_%1_%2").arg(dvd_id).arg(title);
|
||||
}
|
||||
|
||||
|
||||
void Helper::addLog(QString s) {
|
||||
logs += s + "\n";
|
||||
}
|
||||
|
||||
QString Helper::log() {
|
||||
return logs;
|
||||
}
|
||||
|
||||
QString Helper::formatTime(int secs) {
|
||||
int t = secs;
|
||||
int hours = (int) t / 3600;
|
||||
t -= hours*3600;
|
||||
int minutes = (int) t / 60;
|
||||
t -= minutes*60;
|
||||
int seconds = t;
|
||||
|
||||
QString tf;
|
||||
return tf.sprintf("%02d:%02d:%02d",hours,minutes,seconds);
|
||||
}
|
||||
|
||||
QString Helper::timeForJumps(int secs) {
|
||||
int minutes = (int) secs / 60;
|
||||
int seconds = secs % 60;
|
||||
|
||||
if (minutes==0) {
|
||||
if (seconds==1)
|
||||
return QObject::tr("1 second");
|
||||
else
|
||||
return QObject::tr("%1 seconds").arg(seconds);
|
||||
}
|
||||
else {
|
||||
if (minutes==1) {
|
||||
if (seconds==0)
|
||||
return QObject::tr("1 minute");
|
||||
else
|
||||
if (seconds==1)
|
||||
return QObject::tr("1 minute and 1 second");
|
||||
else
|
||||
return QObject::tr("1 minute and %1 seconds").arg(seconds);
|
||||
} else {
|
||||
if (seconds==0)
|
||||
return QObject::tr("%1 minutes").arg(minutes);
|
||||
else
|
||||
if (seconds==1)
|
||||
return QObject::tr("%1 minutes and 1 second").arg(minutes);
|
||||
else
|
||||
return QObject::tr("%1 minutes and %2 seconds").arg(minutes)
|
||||
.arg(seconds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Helper::setScreensaverEnabled(bool b) {
|
||||
qDebug("Helper::setScreensaverEnabled: %d", b);
|
||||
#ifdef Q_OS_WIN
|
||||
if (b) {
|
||||
// Activate screensaver
|
||||
SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, true, 0, SPIF_SENDWININICHANGE);
|
||||
SystemParametersInfo( SPI_SETLOWPOWERACTIVE, 1, NULL, 0);
|
||||
SystemParametersInfo( SPI_SETPOWEROFFACTIVE, 1, NULL, 0);
|
||||
} else {
|
||||
SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, false, 0, SPIF_SENDWININICHANGE);
|
||||
SystemParametersInfo( SPI_SETLOWPOWERACTIVE, 0, NULL, 0);
|
||||
SystemParametersInfo( SPI_SETPOWEROFFACTIVE, 0, NULL, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
void Helper::msleep(int ms) {
|
||||
#if EXTERNAL_SLEEP
|
||||
qDebug("Helper::msleep: %d (using usleep)", ms);
|
||||
usleep(ms*1000);
|
||||
#else
|
||||
qDebug("Helper::msleep: %d (using QThread::msleep)", ms);
|
||||
Sleeper::msleep( ms );
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
|
||||
QString Helper::colorToRGBA(unsigned int color) {
|
||||
QColor c;
|
||||
c.setRgb( color );
|
||||
|
||||
QString s;
|
||||
return s.sprintf("%02x%02x%02x00", c.red(), c.green(), c.blue() );
|
||||
}
|
||||
|
||||
QString Helper::colorToRGB(unsigned int color) {
|
||||
QColor c;
|
||||
c.setRgb( color );
|
||||
|
||||
QString s;
|
||||
return s.sprintf("%02x%02x%02x", c.red(), c.green(), c.blue() );
|
||||
}
|
||||
|
||||
void Helper::setForegroundColor(QWidget * w, const QColor & color) {
|
||||
QPalette p = w->palette();
|
||||
p.setColor(w->foregroundRole(), color);
|
||||
w->setPalette(p);
|
||||
}
|
||||
|
||||
void Helper::setBackgroundColor(QWidget * w, const QColor & color) {
|
||||
QPalette p = w->palette();
|
||||
p.setColor(w->backgroundRole(), color);
|
||||
w->setPalette(p);
|
||||
}
|
||||
|
||||
QString Helper::changeSlashes(QString filename) {
|
||||
// Only change if file exists (it's a local file)
|
||||
if (QFileInfo(filename).exists())
|
||||
return filename.replace('/', '\\');
|
||||
else
|
||||
return filename;
|
||||
}
|
||||
|
||||
QString Helper::dvdSplitFolder(QString dvd_url) {
|
||||
qDebug("Helper::dvdSplitFolder: '%s'", dvd_url.toUtf8().data());
|
||||
QRegExp s("^dvd://(\\d+):(.*)", Qt::CaseInsensitive);
|
||||
if (s.indexIn(dvd_url)!=-1) {
|
||||
return s.cap(2);
|
||||
} else {
|
||||
return QString::null;
|
||||
}
|
||||
}
|
||||
|
||||
int Helper::dvdSplitTitle(QString dvd_url) {
|
||||
qDebug("Helper::dvdSplitTitle: '%s'", dvd_url.toUtf8().data());
|
||||
QRegExp s("^dvd://(\\d+)(.*)", Qt::CaseInsensitive);
|
||||
if (s.indexIn(dvd_url)!=-1) {
|
||||
return s.cap(1).toInt();
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Helper::directoryContainsDVD(QString directory) {
|
||||
//qDebug("Helper::directoryContainsDVD: '%s'", directory.latin1());
|
||||
|
||||
QDir dir(directory);
|
||||
QStringList l = dir.entryList();
|
||||
bool valid = FALSE;
|
||||
for (int n=0; n < l.count(); n++) {
|
||||
//qDebug(" * entry %d: '%s'", n, l[n].toUtf8().data());
|
||||
if (l[n].toLower() == "video_ts") valid = TRUE;
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
/*
|
||||
#ifdef Q_OS_WIN
|
||||
QString Helper::mplayer_intermediate(QString mplayer_bin) {
|
||||
// Windows 98 and ME: call another program as intermediate
|
||||
|
||||
QString intermediate = "w9xpopen.exe";
|
||||
|
||||
QFileInfo fi(mplayer_bin);
|
||||
if (fi.exists()) {
|
||||
mplayer_bin = fi.absoluteFilePath();
|
||||
}
|
||||
|
||||
QString mplayer_path = QFileInfo(mplayer_bin).absolutePath();
|
||||
qDebug("Helper::mplayer_intermediate: mplayer_path: %s", mplayer_path.toUtf8().data());
|
||||
QString intermediate_bin = mplayer_path + "/" + intermediate;
|
||||
qDebug("Helper::mplayer_intermediate: intermediate_bin: %s", intermediate_bin.toUtf8().data());
|
||||
|
||||
if (QFile::exists(intermediate_bin)) {
|
||||
return intermediate_bin;
|
||||
} else {
|
||||
qDebug("Helper::mplayer_intermediate: intermediate_bin doesn't exist");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
@ -1,97 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2007 Ricardo Villalba <rvm@escomposlinux.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _HELPER_H_
|
||||
#define _HELPER_H_
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
class QWidget;
|
||||
class QColor;
|
||||
|
||||
class Helper
|
||||
{
|
||||
public:
|
||||
|
||||
static void setAppPath(QString path);
|
||||
static QString appPath();
|
||||
|
||||
static QString dataPath();
|
||||
static QString translationPath();
|
||||
static QString docPath();
|
||||
static QString confPath();
|
||||
static QString themesPath();
|
||||
static QString shortcutsPath();
|
||||
static QString qtTranslationPath();
|
||||
|
||||
//! Return the user's home
|
||||
static QString appHomePath();
|
||||
|
||||
// Format a time (hh:mm:ss)
|
||||
static QString formatTime(int secs);
|
||||
|
||||
static QString timeForJumps(int secs);
|
||||
|
||||
// Give a name for config (group name) based on filename
|
||||
static QString filenameForPref(const QString & filename);
|
||||
|
||||
// Give a name for config (group name) based on dvd id
|
||||
static QString dvdForPref(const QString & dvd_id, int title);
|
||||
|
||||
//! Adds a line to the log
|
||||
static void addLog(QString s);
|
||||
|
||||
//! Returns the log (the debugging messages)
|
||||
static QString log();
|
||||
|
||||
//! Enable or disables the screensaver
|
||||
static void setScreensaverEnabled(bool b);
|
||||
|
||||
/* static void msleep(int ms); */
|
||||
|
||||
static QString colorToRGBA(unsigned int color);
|
||||
static QString colorToRGB(unsigned int color);
|
||||
|
||||
//! Changes the foreground color of the specified widget
|
||||
static void setForegroundColor(QWidget * w, const QColor & color);
|
||||
|
||||
//! Changes the background color of the specified widget
|
||||
static void setBackgroundColor(QWidget * w, const QColor & color);
|
||||
|
||||
//! Change filenames like "C:/Program Files/" to "C:\Program Files\"
|
||||
static QString changeSlashes(QString filename);
|
||||
|
||||
static QString dvdSplitFolder(QString dvd_url);
|
||||
static int dvdSplitTitle(QString dvd_url);
|
||||
|
||||
static bool directoryContainsDVD(QString directory);
|
||||
|
||||
/*
|
||||
#ifdef Q_OS_WIN
|
||||
static QString mplayer_intermediate(QString mplayer_bin);
|
||||
#endif
|
||||
*/
|
||||
|
||||
private:
|
||||
static QString logs;
|
||||
static QString app_path;
|
||||
};
|
||||
|
||||
#endif
|
Before Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 213 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 490 B |
Before Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 909 B |
Before Width: | Height: | Size: 951 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 197 B |
Before Width: | Height: | Size: 197 B |
Before Width: | Height: | Size: 199 B |
Before Width: | Height: | Size: 973 B |
Before Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 212 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 620 B |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 984 B |
Before Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 740 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 179 B |
Before Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 911 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 975 B |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 936 B |
Before Width: | Height: | Size: 984 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 806 B |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 218 B |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 924 B |
Before Width: | Height: | Size: 211 B |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 179 B |
Before Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 3.9 KiB |