mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
added smplayer_plugin
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@986 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
fb01f61bb2
commit
e36aee2663
@ -91,7 +91,6 @@ DEPENDPATH += . \
|
||||
gui\elastic
|
||||
|
||||
INCLUDEPATH += . \
|
||||
apps/smplayer
|
||||
|
||||
# Input
|
||||
HEADERS += rshare.h \
|
||||
|
@ -1,177 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 "about.h"
|
||||
#include "images.h"
|
||||
#include "version.h"
|
||||
#include "global.h"
|
||||
#include "preferences.h"
|
||||
#include "helper.h"
|
||||
|
||||
#include <QFile>
|
||||
|
||||
using namespace Global;
|
||||
|
||||
About::About(QWidget * parent, Qt::WindowFlags f)
|
||||
: QDialog(parent, f)
|
||||
{
|
||||
setupUi(this);
|
||||
setWindowIcon( Images::icon("logo", 64) );
|
||||
|
||||
logo->setPixmap( Images::icon("logo", 64) );
|
||||
contrib_icon->setPixmap( Images::icon("contributors" ) );
|
||||
translators_icon->setPixmap( Images::icon("translators" ) );
|
||||
license_icon->setPixmap( Images::icon("license" ) );
|
||||
|
||||
QString mplayer_version;
|
||||
if (pref->mplayer_detected_version > 0) {
|
||||
mplayer_version = tr("Using MPlayer SVN r%1").arg(pref->mplayer_detected_version) + "<br><br>";
|
||||
}
|
||||
|
||||
info->setText(
|
||||
"<b>SMPlayer</b> © 2006-2008 Ricardo Villalba <rvm@escomposlinux.org><br><br>"
|
||||
"<b>" + tr("Version: %1").arg(smplayerVersion()) + "</b>" +
|
||||
"<br>" +
|
||||
tr("Compiled with Qt %1").arg(QT_VERSION_STR) + "<br><br>" +
|
||||
mplayer_version +
|
||||
tr("Visit our web for updates:") +"<br>"+
|
||||
link("http://smplayer.berlios.de") + "<br>" +
|
||||
link("http://smplayer.sf.net") +
|
||||
"<br><br>" +
|
||||
tr("Get help in our forum:") +"<br>" + link("http://smplayer.berlios.de/forums") +
|
||||
"<br><br>" +
|
||||
tr("You can support SMPlayer by making a donation.") +" "+
|
||||
link("https://sourceforge.net/donate/index.php?group_id=185512", tr("More info"))
|
||||
);
|
||||
|
||||
|
||||
QString license_file = Helper::doc("gpl.html", pref->language);
|
||||
if (QFile::exists(license_file)) {
|
||||
QFont fixed_font;
|
||||
fixed_font.setStyleHint(QFont::TypeWriter);
|
||||
fixed_font.setFamily("Courier");
|
||||
license->setFont(fixed_font);
|
||||
|
||||
QFile f(license_file);
|
||||
if (f.open(QIODevice::ReadOnly)) {
|
||||
license->setText(QString::fromUtf8(f.readAll().constData()));
|
||||
}
|
||||
f.close();
|
||||
} else {
|
||||
license->setText(
|
||||
"<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>");
|
||||
}
|
||||
|
||||
translators->setText( getTranslators() );
|
||||
|
||||
contributions->setText(
|
||||
tr("Some people have helped with their contributions:") +
|
||||
"<ul>" +
|
||||
contr("Charles Barcza <kbarcza@blackpanther.hu>", tr("SMPlayer logo")) +
|
||||
contr("Florin Braghis <florin@libertv.ro>", tr("file associations for Windows")) +
|
||||
contr("Matvey Kozhev <sikon@lucidfox.org>", tr("manpage for linux")) +
|
||||
contr("profoX", tr("support for colored console output")) +
|
||||
contr("redxii", tr("icon for file associations")) +
|
||||
contr("LoRd_MuldeR", tr("patch for file associations")) +
|
||||
"</ul>"
|
||||
);
|
||||
|
||||
// Copy the background color ("window") of the tab widget to the "base" color of the qtextbrowsers
|
||||
// Problem, it doesn't work with some styles, so first we change the "window" color of the tab widgets.
|
||||
info_tab->setAutoFillBackground(true);
|
||||
contributions_tab->setAutoFillBackground(true);
|
||||
translations_tab->setAutoFillBackground(true);
|
||||
license_tab->setAutoFillBackground(true);
|
||||
|
||||
QPalette pal = info_tab->palette();
|
||||
pal.setColor(QPalette::Window, palette().color(QPalette::Window) );
|
||||
|
||||
info_tab->setPalette(pal);
|
||||
contributions_tab->setPalette(pal);
|
||||
translations_tab->setPalette(pal);
|
||||
license_tab->setPalette(pal);
|
||||
|
||||
QPalette p = info->palette();
|
||||
//p.setBrush(QPalette::Base, info_tab->palette().window());
|
||||
p.setColor(QPalette::Base, info_tab->palette().color(QPalette::Window));
|
||||
|
||||
info->setPalette(p);
|
||||
contributions->setPalette(p);
|
||||
translators->setPalette(p);
|
||||
//license->setPalette(p);
|
||||
}
|
||||
|
||||
About::~About() {
|
||||
}
|
||||
|
||||
QString About::getTranslators() {
|
||||
return QString(
|
||||
tr("The following people have contributed with translations:") +
|
||||
"<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"), QString::fromUtf8("Белый Владимир <wiselord1983@gmail.com>"))+
|
||||
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>") +
|
||||
trad(tr("Greek"), "my80s <wamy80s@gmail.com>") +
|
||||
trad(tr("Finnish"), "peeaivo <peeaivo@gmail.com>") +
|
||||
trad(tr("Korean"), "Heesu Yoon <imsu30@gmail.com>") +
|
||||
trad(tr("Macedonian"), "Marko Doda <mark0d0da@gmail.com>") +
|
||||
trad(tr("Basque"), "Piarres Beobide <pi@beobide.net>") +
|
||||
"</ul>");
|
||||
}
|
||||
|
||||
QString About::trad(const QString & lang, const QString & author) {
|
||||
return "<li>"+ tr("<b>%1</b>: %2").arg(lang).arg(author) + "</li>";
|
||||
}
|
||||
|
||||
QString About::link(const QString & url, QString name) {
|
||||
if (name.isEmpty()) name = url;
|
||||
return QString("<a href=\"" + url + "\">" + name +"</a>");
|
||||
}
|
||||
|
||||
QString About::contr(const QString & author, const QString & thing) {
|
||||
return "<li>"+ tr("<b>%1</b> (%2)").arg(author).arg(thing) +"</li>";
|
||||
}
|
||||
|
||||
#include "moc_about.cpp"
|
@ -1,75 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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,247 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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,70 +0,0 @@
|
||||
## prevent mplayer from messing up our shortcuts
|
||||
|
||||
RIGHT gui_about
|
||||
LEFT gui_about
|
||||
DOWN gui_about
|
||||
UP gui_about
|
||||
PGUP gui_about
|
||||
PGDWN gui_about
|
||||
- gui_about
|
||||
+ gui_about
|
||||
ESC gui_about
|
||||
ENTER gui_about
|
||||
SPACE pausing_keep invalid_command
|
||||
HOME gui_about
|
||||
END gui_about
|
||||
> gui_about
|
||||
< gui_about
|
||||
INS gui_about
|
||||
DEL gui_about
|
||||
[ gui_about
|
||||
] gui_about
|
||||
{ gui_about
|
||||
} gui_about
|
||||
BS gui_about
|
||||
TAB gui_about
|
||||
. gui_about
|
||||
# gui_about
|
||||
@ gui_about
|
||||
! gui_about
|
||||
9 gui_about
|
||||
/ gui_about
|
||||
0 gui_about
|
||||
* gui_about
|
||||
1 gui_about
|
||||
2 gui_about
|
||||
3 gui_about
|
||||
4 gui_about
|
||||
5 gui_about
|
||||
6 gui_about
|
||||
7 gui_about
|
||||
8 gui_about
|
||||
a gui_about
|
||||
b gui_about
|
||||
c gui_about
|
||||
d gui_about
|
||||
e gui_about
|
||||
F invalid_command
|
||||
f invalid_command
|
||||
g gui_about
|
||||
h gui_about
|
||||
i gui_about
|
||||
j gui_about
|
||||
k gui_about
|
||||
l gui_about
|
||||
m gui_about
|
||||
n gui_about
|
||||
o gui_about
|
||||
p gui_about
|
||||
q gui_about
|
||||
r gui_about
|
||||
s gui_about
|
||||
t gui_about
|
||||
T gui_about
|
||||
u gui_about
|
||||
v gui_about
|
||||
w gui_about
|
||||
x gui_about
|
||||
y gui_about
|
||||
z gui_about
|
||||
S gui_about
|
@ -1,162 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 <QApplication>
|
||||
#include <QFile>
|
||||
|
||||
#include "smplayer.h"
|
||||
#include "global.h"
|
||||
#include "helper.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define USE_LOCKS 1
|
||||
|
||||
using namespace Global;
|
||||
|
||||
void myMessageOutput( QtMsgType type, const char *msg ) {
|
||||
static QRegExp rx_log;
|
||||
|
||||
if (pref) {
|
||||
if (!pref->log_smplayer) return;
|
||||
rx_log.setPattern(pref->log_filter);
|
||||
} else {
|
||||
rx_log.setPattern(".*");
|
||||
}
|
||||
|
||||
QString line = QString::fromUtf8(msg);
|
||||
switch ( type ) {
|
||||
case QtDebugMsg:
|
||||
if (rx_log.indexIn(line) > -1) {
|
||||
#ifndef NO_DEBUG_ON_CONSOLE
|
||||
fprintf( stderr, "Debug: %s\n", line.toLocal8Bit().data() );
|
||||
#endif
|
||||
Helper::addLog( line );
|
||||
}
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
#ifndef NO_DEBUG_ON_CONSOLE
|
||||
fprintf( stderr, "Warning: %s\n", line.toLocal8Bit().data() );
|
||||
#endif
|
||||
Helper::addLog( "WARNING: " + line );
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
#ifndef NO_DEBUG_ON_CONSOLE
|
||||
fprintf( stderr, "Fatal: %s\n", line.toLocal8Bit().data() );
|
||||
#endif
|
||||
Helper::addLog( "FATAL: " + line );
|
||||
abort(); // deliberately core dump
|
||||
case QtCriticalMsg:
|
||||
#ifndef NO_DEBUG_ON_CONSOLE
|
||||
fprintf( stderr, "Critical: %s\n", line.toLocal8Bit().data() );
|
||||
#endif
|
||||
Helper::addLog( "CRITICAL: " + line );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if USE_LOCKS
|
||||
void remove_lock(QString lock_file) {
|
||||
if (QFile::exists(lock_file)) {
|
||||
qDebug("main: removing %s", lock_file.toUtf8().data());
|
||||
QFile::remove(lock_file);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
QApplication a( argc, argv );
|
||||
//a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
|
||||
|
||||
// Sets the ini_path
|
||||
QString ini_path;
|
||||
if (QFile::exists( a.applicationDirPath() + "/smplayer.ini" ) ) {
|
||||
ini_path = a.applicationDirPath();
|
||||
qDebug("main: using existing %s", QString(ini_path + "/smplayer.ini").toUtf8().data());
|
||||
}
|
||||
QStringList args = a.arguments();
|
||||
int pos = args.indexOf("-ini-path");
|
||||
if ( pos != -1) {
|
||||
if (pos+1 < args.count()) {
|
||||
pos++;
|
||||
ini_path = args[pos];
|
||||
// Delete from list
|
||||
args.removeAt(pos);
|
||||
args.removeAt(pos-1);
|
||||
} else {
|
||||
printf("Error: expected parameter for -ini-path\r\n");
|
||||
return SMPlayer::ErrorArgument;
|
||||
}
|
||||
}
|
||||
|
||||
qInstallMsgHandler( myMessageOutput );
|
||||
|
||||
#if USE_LOCKS
|
||||
//setIniPath will be set later in global_init, but we need it here
|
||||
Helper::setIniPath(ini_path);
|
||||
|
||||
QString lock_file = Helper::iniPath() + "/smplayer_init.lock";
|
||||
qDebug("main: lock_file: %s", lock_file.toUtf8().data());
|
||||
if (QFile::exists(lock_file)) {
|
||||
qDebug("main: %s exists, waiting...", lock_file.toUtf8().data());
|
||||
// Wait 10 secs max.
|
||||
int n = 100;
|
||||
while ( n > 0) {
|
||||
Helper::msleep(100); // wait 100 ms
|
||||
if (!QFile::exists(lock_file)) break;
|
||||
n--;
|
||||
if ((n % 10) == 0) qDebug("main: waiting %d...", n);
|
||||
}
|
||||
remove_lock(lock_file);
|
||||
} else {
|
||||
// Create lock file
|
||||
QFile f(lock_file);
|
||||
if (f.open(QIODevice::WriteOnly)) {
|
||||
f.write("smplayer lock file");
|
||||
f.close();
|
||||
} else {
|
||||
qWarning("main: can't open %s for writing", lock_file.toUtf8().data());
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
SMPlayer * smplayer = new SMPlayer(ini_path);
|
||||
SMPlayer::ExitCode c = smplayer->processArgs( args );
|
||||
if (c != SMPlayer::NoExit) {
|
||||
#if USE_LOCKS
|
||||
remove_lock(lock_file);
|
||||
#endif
|
||||
return c;
|
||||
}
|
||||
|
||||
a.connect(smplayer->gui(), SIGNAL(quitSolicited()), &a, SLOT(quit()));
|
||||
smplayer->start();
|
||||
|
||||
#if USE_LOCKS
|
||||
remove_lock(lock_file);
|
||||
#endif
|
||||
|
||||
int r = a.exec();
|
||||
|
||||
delete smplayer;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -1,161 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 <QApplication>
|
||||
#include <QFile>
|
||||
|
||||
#include "smplayer.h"
|
||||
#include "global.h"
|
||||
#include "helper.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define USE_LOCKS 1
|
||||
|
||||
using namespace Global;
|
||||
|
||||
void myMessageOutput( QtMsgType type, const char *msg ) {
|
||||
static QRegExp rx_log;
|
||||
|
||||
if (pref) {
|
||||
if (!pref->log_smplayer) return;
|
||||
rx_log.setPattern(pref->log_filter);
|
||||
} else {
|
||||
rx_log.setPattern(".*");
|
||||
}
|
||||
|
||||
QString line = QString::fromUtf8(msg);
|
||||
switch ( type ) {
|
||||
case QtDebugMsg:
|
||||
if (rx_log.indexIn(line) > -1) {
|
||||
#ifndef NO_DEBUG_ON_CONSOLE
|
||||
fprintf( stderr, "Debug: %s\n", line.toLocal8Bit().data() );
|
||||
#endif
|
||||
Helper::addLog( line );
|
||||
}
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
#ifndef NO_DEBUG_ON_CONSOLE
|
||||
fprintf( stderr, "Warning: %s\n", line.toLocal8Bit().data() );
|
||||
#endif
|
||||
Helper::addLog( "WARNING: " + line );
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
#ifndef NO_DEBUG_ON_CONSOLE
|
||||
fprintf( stderr, "Fatal: %s\n", line.toLocal8Bit().data() );
|
||||
#endif
|
||||
Helper::addLog( "FATAL: " + line );
|
||||
abort(); // deliberately core dump
|
||||
case QtCriticalMsg:
|
||||
#ifndef NO_DEBUG_ON_CONSOLE
|
||||
fprintf( stderr, "Critical: %s\n", line.toLocal8Bit().data() );
|
||||
#endif
|
||||
Helper::addLog( "CRITICAL: " + line );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if USE_LOCKS
|
||||
void remove_lock(QString lock_file) {
|
||||
if (QFile::exists(lock_file)) {
|
||||
qDebug("main: removing %s", lock_file.toUtf8().data());
|
||||
QFile::remove(lock_file);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int main( int argc, char ** argv )
|
||||
{
|
||||
QApplication a( argc, argv );
|
||||
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
|
||||
|
||||
// Sets the ini_path
|
||||
QString ini_path;
|
||||
if (QFile::exists( a.applicationDirPath() + "/smplayer.ini" ) ) {
|
||||
ini_path = a.applicationDirPath();
|
||||
qDebug("main: using existing %s", QString(ini_path + "/smplayer.ini").toUtf8().data());
|
||||
}
|
||||
QStringList args = a.arguments();
|
||||
int pos = args.indexOf("-ini-path");
|
||||
if ( pos != -1) {
|
||||
if (pos+1 < args.count()) {
|
||||
pos++;
|
||||
ini_path = args[pos];
|
||||
// Delete from list
|
||||
args.removeAt(pos);
|
||||
args.removeAt(pos-1);
|
||||
} else {
|
||||
printf("Error: expected parameter for -ini-path\r\n");
|
||||
return SMPlayer::ErrorArgument;
|
||||
}
|
||||
}
|
||||
|
||||
qInstallMsgHandler( myMessageOutput );
|
||||
|
||||
#if USE_LOCKS
|
||||
//setIniPath will be set later in global_init, but we need it here
|
||||
Helper::setIniPath(ini_path);
|
||||
|
||||
QString lock_file = Helper::iniPath() + "/smplayer_init.lock";
|
||||
qDebug("main: lock_file: %s", lock_file.toUtf8().data());
|
||||
if (QFile::exists(lock_file)) {
|
||||
qDebug("main: %s exists, waiting...", lock_file.toUtf8().data());
|
||||
// Wait 10 secs max.
|
||||
int n = 100;
|
||||
while ( n > 0) {
|
||||
Helper::msleep(100); // wait 100 ms
|
||||
if (!QFile::exists(lock_file)) break;
|
||||
n--;
|
||||
if ((n % 10) == 0) qDebug("main: waiting %d...", n);
|
||||
}
|
||||
remove_lock(lock_file);
|
||||
} else {
|
||||
// Create lock file
|
||||
QFile f(lock_file);
|
||||
if (f.open(QIODevice::WriteOnly)) {
|
||||
f.write("smplayer lock file");
|
||||
f.close();
|
||||
} else {
|
||||
qWarning("main: can't open %s for writing", lock_file.toUtf8().data());
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
SMPlayer * smplayer = new SMPlayer(ini_path);
|
||||
SMPlayer::ExitCode c = smplayer->processArgs( args );
|
||||
if (c != SMPlayer::NoExit) {
|
||||
#if USE_LOCKS
|
||||
remove_lock(lock_file);
|
||||
#endif
|
||||
return c;
|
||||
}
|
||||
|
||||
smplayer->start();
|
||||
|
||||
#if USE_LOCKS
|
||||
remove_lock(lock_file);
|
||||
#endif
|
||||
|
||||
int r = a.exec();
|
||||
|
||||
delete smplayer;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -1,363 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 "prefsubtitles.h"
|
||||
#include "images.h"
|
||||
#include "preferences.h"
|
||||
#include "encodings.h"
|
||||
#include "helper.h"
|
||||
#include "filedialog.h"
|
||||
|
||||
#include <QColorDialog>
|
||||
|
||||
PrefSubtitles::PrefSubtitles(QWidget * parent, Qt::WindowFlags f)
|
||||
: PrefWidget(parent, f )
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
encodings = new Encodings(this);
|
||||
font_encoding_combo->insertItems( 0, encodings->list() );
|
||||
|
||||
//languageChange();
|
||||
createHelp();
|
||||
}
|
||||
|
||||
PrefSubtitles::~PrefSubtitles()
|
||||
{
|
||||
}
|
||||
|
||||
QString PrefSubtitles::sectionName() {
|
||||
return tr("Subtitles");
|
||||
}
|
||||
|
||||
QPixmap PrefSubtitles::sectionIcon() {
|
||||
return Images::icon("pref_subtitles");
|
||||
}
|
||||
|
||||
|
||||
void PrefSubtitles::retranslateStrings() {
|
||||
int font_autoscale_item = font_autoscale_combo->currentIndex();
|
||||
int font_autoload_item = font_autoload_combo->currentIndex();
|
||||
|
||||
retranslateUi(this);
|
||||
|
||||
font_autoscale_combo->setCurrentIndex(font_autoscale_item);
|
||||
font_autoload_combo->setCurrentIndex(font_autoload_item);
|
||||
|
||||
// Encodings combo
|
||||
int font_encoding_item = font_encoding_combo->currentIndex();
|
||||
font_encoding_combo->clear();
|
||||
encodings->retranslate();
|
||||
font_encoding_combo->insertItems( 0, encodings->list() );
|
||||
font_encoding_combo->setCurrentIndex(font_encoding_item);
|
||||
|
||||
sub_pos_label->setNum( sub_pos_slider->value() );
|
||||
|
||||
createHelp();
|
||||
}
|
||||
|
||||
void PrefSubtitles::setData(Preferences * pref) {
|
||||
setFontName( pref->font_name );
|
||||
setFontFile( pref->font_file );
|
||||
setUseFontconfig( pref->use_fontconfig );
|
||||
setFontAutoscale( pref->font_autoscale );
|
||||
setFontTextscale( pref->initial_sub_scale );
|
||||
setAssFontScale( pref->initial_sub_scale_ass );
|
||||
setAutoloadSub( pref->autoload_sub );
|
||||
setFontFuzziness( pref->subfuzziness );
|
||||
setFontEncoding( pref->subcp );
|
||||
setUseFontASS( pref->use_ass_subtitles );
|
||||
setAssColor( pref->ass_color );
|
||||
setAssBorderColor( pref->ass_border_color );
|
||||
setAssStyles( pref->ass_styles );
|
||||
setSubPos( pref->initial_sub_pos );
|
||||
setSubtitlesOnScreenshots( pref->subtitles_on_screenshots );
|
||||
}
|
||||
|
||||
void PrefSubtitles::getData(Preferences * pref) {
|
||||
requires_restart = false;
|
||||
|
||||
TEST_AND_SET(pref->font_name, fontName());
|
||||
TEST_AND_SET(pref->font_file, fontFile());
|
||||
TEST_AND_SET(pref->use_fontconfig, useFontconfig());
|
||||
TEST_AND_SET(pref->font_autoscale, fontAutoscale());
|
||||
pref->initial_sub_scale = fontTextscale();
|
||||
pref->initial_sub_scale_ass = assFontScale();
|
||||
TEST_AND_SET(pref->autoload_sub, autoloadSub());
|
||||
TEST_AND_SET(pref->subfuzziness, fontFuzziness());
|
||||
TEST_AND_SET(pref->subcp, fontEncoding());
|
||||
TEST_AND_SET(pref->use_ass_subtitles, useFontASS());
|
||||
TEST_AND_SET(pref->ass_color, assColor());
|
||||
TEST_AND_SET(pref->ass_border_color, assBorderColor());
|
||||
TEST_AND_SET(pref->ass_styles, assStyles());
|
||||
pref->initial_sub_pos = subPos();
|
||||
TEST_AND_SET(pref->subtitles_on_screenshots, subtitlesOnScreenshots());
|
||||
}
|
||||
|
||||
void PrefSubtitles::setFontName(QString font_name) {
|
||||
fontCombo->setCurrentText(font_name);
|
||||
}
|
||||
|
||||
QString PrefSubtitles::fontName() {
|
||||
return fontCombo->currentText();
|
||||
}
|
||||
|
||||
void PrefSubtitles::setFontFile(QString font_file) {
|
||||
ttf_font_edit->setText( font_file );
|
||||
}
|
||||
|
||||
QString PrefSubtitles::fontFile() {
|
||||
return ttf_font_edit->text();
|
||||
}
|
||||
|
||||
|
||||
void PrefSubtitles::setUseFontconfig(bool b) {
|
||||
system_font_button->setChecked(b);
|
||||
ttf_font_button->setChecked(!b);
|
||||
}
|
||||
|
||||
bool PrefSubtitles::useFontconfig() {
|
||||
return system_font_button->isChecked();
|
||||
}
|
||||
|
||||
void PrefSubtitles::setFontAutoscale(int n) {
|
||||
font_autoscale_combo->setCurrentIndex(n);
|
||||
}
|
||||
|
||||
int PrefSubtitles::fontAutoscale() {
|
||||
return font_autoscale_combo->currentIndex();
|
||||
}
|
||||
|
||||
void PrefSubtitles::setFontTextscale(double n) {
|
||||
font_text_scale->setValue(n);
|
||||
}
|
||||
|
||||
double PrefSubtitles::fontTextscale() {
|
||||
return font_text_scale->value();
|
||||
}
|
||||
|
||||
void PrefSubtitles::setAssFontScale(double n) {
|
||||
ass_font_scale->setValue(n);
|
||||
}
|
||||
|
||||
double PrefSubtitles::assFontScale() {
|
||||
return ass_font_scale->value();
|
||||
}
|
||||
|
||||
void PrefSubtitles::setAutoloadSub(bool v) {
|
||||
font_autoload_check->setChecked(v);
|
||||
}
|
||||
|
||||
bool PrefSubtitles::autoloadSub() {
|
||||
return font_autoload_check->isChecked();
|
||||
}
|
||||
|
||||
void PrefSubtitles::setFontEncoding(QString s) {
|
||||
int n = encodings->findEncoding( s );
|
||||
if (n != -1)
|
||||
font_encoding_combo->setCurrentIndex(n);
|
||||
else
|
||||
font_encoding_combo->setCurrentText(s);
|
||||
}
|
||||
|
||||
QString PrefSubtitles::fontEncoding() {
|
||||
qDebug("PrefSubtitles::fontEncoding");
|
||||
QString res = encodings->parseEncoding( font_encoding_combo->currentText() );
|
||||
qDebug(" * res: '%s'", res.toUtf8().data() );
|
||||
return res;
|
||||
}
|
||||
|
||||
void PrefSubtitles::setSubPos(int pos) {
|
||||
sub_pos_slider->setValue(pos);
|
||||
}
|
||||
|
||||
int PrefSubtitles::subPos() {
|
||||
return sub_pos_slider->value();
|
||||
}
|
||||
|
||||
void PrefSubtitles::setUseFontASS(bool v) {
|
||||
font_ass_check->setChecked(v);
|
||||
//assButtonToggled(v);
|
||||
}
|
||||
|
||||
bool PrefSubtitles::useFontASS() {
|
||||
return font_ass_check->isChecked();
|
||||
}
|
||||
|
||||
void PrefSubtitles::setAssColor( unsigned int color ) {
|
||||
ass_color = color;
|
||||
#ifdef Q_OS_WIN
|
||||
colorButton->setStyleSheet( "border-width: 1px; border-style: solid; border-color: #000000; background: #" + Helper::colorToRRGGBB(ass_color) + ";");
|
||||
#else
|
||||
//colorButton->setAutoFillBackground(true);
|
||||
Helper::setBackgroundColor( colorButton, color );
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int PrefSubtitles::assColor() {
|
||||
return ass_color;
|
||||
}
|
||||
|
||||
void PrefSubtitles::setAssBorderColor( unsigned int color ) {
|
||||
ass_border_color = color;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
borderButton->setStyleSheet( "border-width: 1px; border-style: solid; border-color: #000000; background: #" + Helper::colorToRRGGBB(ass_border_color) + ";");
|
||||
#else
|
||||
//borderButton->setAutoFillBackground(true);
|
||||
Helper::setBackgroundColor( borderButton, color );
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned int PrefSubtitles::assBorderColor() {
|
||||
return ass_border_color;
|
||||
}
|
||||
|
||||
void PrefSubtitles::setAssStyles(QString styles) {
|
||||
ass_styles_edit->setText(styles);
|
||||
}
|
||||
|
||||
QString PrefSubtitles::assStyles() {
|
||||
return ass_styles_edit->text();
|
||||
}
|
||||
|
||||
void PrefSubtitles::setFontFuzziness(int n) {
|
||||
font_autoload_combo->setCurrentIndex(n);
|
||||
}
|
||||
|
||||
int PrefSubtitles::fontFuzziness() {
|
||||
return font_autoload_combo->currentIndex();
|
||||
}
|
||||
|
||||
void PrefSubtitles::setSubtitlesOnScreenshots(bool b) {
|
||||
subtitles_on_screeshots_check->setChecked(b);
|
||||
}
|
||||
|
||||
bool PrefSubtitles::subtitlesOnScreenshots() {
|
||||
return subtitles_on_screeshots_check->isChecked();
|
||||
}
|
||||
|
||||
|
||||
void PrefSubtitles::on_searchButton_clicked() {
|
||||
QString s = "";
|
||||
|
||||
QString f;
|
||||
|
||||
s = MyFileDialog::getOpenFileName(
|
||||
this, tr("Choose a ttf file"),
|
||||
ttf_font_edit->text(),
|
||||
tr("Truetype Fonts") + " (*.ttf)"
|
||||
#ifdef Q_OS_WIN
|
||||
, &f, QFileDialog::DontUseNativeDialog
|
||||
#endif
|
||||
);
|
||||
|
||||
if (!s.isEmpty()) {
|
||||
ttf_font_edit->setText(s);
|
||||
}
|
||||
}
|
||||
|
||||
void PrefSubtitles::on_colorButton_clicked() {
|
||||
QColor c = QColorDialog::getColor ( ass_color, this );
|
||||
if (c.isValid()) {
|
||||
setAssColor( c.rgb() );
|
||||
}
|
||||
}
|
||||
|
||||
void PrefSubtitles::on_borderButton_clicked() {
|
||||
QColor c = QColorDialog::getColor ( ass_border_color, this );
|
||||
if (c.isValid()) {
|
||||
setAssBorderColor( c.rgb() );
|
||||
}
|
||||
}
|
||||
|
||||
void PrefSubtitles::createHelp() {
|
||||
clearHelp();
|
||||
|
||||
addSectionTitle(tr("Subtitles"));
|
||||
|
||||
setWhatsThis(font_autoload_combo, tr("Autoload"),
|
||||
tr("Select the subtitle autoload method.") );
|
||||
|
||||
setWhatsThis(font_autoload_check, tr("Select first available subtitle"),
|
||||
tr("If there are one or more subtitle tracks available, one of them "
|
||||
"will be automatically selected, usually the first one, although if "
|
||||
"one of them matches the user's preferred language that one will "
|
||||
"be used instead.") );
|
||||
|
||||
setWhatsThis(font_encoding_combo, tr("Default subtitle encoding"),
|
||||
tr("Select the encoding which will be used for subtitle files.") );
|
||||
|
||||
setWhatsThis(sub_pos_slider, tr("Subtitle position"),
|
||||
tr("This option specifies the position of the subtitles over the "
|
||||
"video window. <i>100</i> means the bottom, while <i>0</i> means "
|
||||
"the top." ) );
|
||||
|
||||
setWhatsThis(subtitles_on_screeshots_check,
|
||||
tr("Include subtitles on screenshots"),
|
||||
tr("If this option is checked, the subtitles will appear in the "
|
||||
"screenshots. Note: it may cause some troubles sometimes." ) );
|
||||
|
||||
addSectionTitle(tr("Font"));
|
||||
|
||||
setWhatsThis(ttf_font_edit, tr("TTF font"),
|
||||
tr("Here you can select a ttf font to be used for the subtitles. "
|
||||
"Usually you'll find a lot of ttf fonts in <i>%1</i>.")
|
||||
#ifdef Q_OS_WIN
|
||||
.arg("C:\\Windows\\Fonts\\")
|
||||
#else
|
||||
.arg("/usr/X11R6/lib/X11/fonts/truetype/")
|
||||
#endif
|
||||
);
|
||||
|
||||
setWhatsThis(fontCombo, tr("System font"),
|
||||
tr("Here you can select a system font to be used for the subtitles "
|
||||
"and OSD. <b>Note:</b> requires a MPlayer with fontconfig support.") );
|
||||
|
||||
setWhatsThis(font_autoscale_combo, tr("Autoscale"),
|
||||
tr("Select the subtitle autoscaling method.") );
|
||||
|
||||
setWhatsThis(font_text_scale, tr("Default scale for normal subtitles"),
|
||||
tr("This option specifies the default font scale for normal (white) "
|
||||
"subtitles which will be used for new videos."));
|
||||
|
||||
setWhatsThis(ass_font_scale, tr("Default scale for SSA/ASS subtitles"),
|
||||
tr("This option specifies the default font scale for SSA/ASS "
|
||||
"subtitles which will be used for new videos."));
|
||||
|
||||
addSectionTitle(tr("SSA/ASS library"));
|
||||
|
||||
setWhatsThis(font_ass_check, tr("Use SSA/ASS library for subtitle rendering"),
|
||||
tr("Check this option to activate the SSA/ASS library. It provides "
|
||||
"nicer subtitles, so it's a good idea to do it.") );
|
||||
|
||||
setWhatsThis(colorButton, tr("Text color"),
|
||||
tr("Select the color for the text of the subtitles.") );
|
||||
|
||||
setWhatsThis(borderButton, tr("Border color"),
|
||||
tr("Select the color for the border of the subtitles.") );
|
||||
|
||||
setWhatsThis(ass_styles_edit, tr("SSA/ASS styles"),
|
||||
tr("Here you can override styles for SSA/ASS subtitles. "
|
||||
"It can be also used for fine-tuning the rendering of SRT and SUB "
|
||||
"subtitles by the SSA/ASS library. "
|
||||
"Example: <b>Bold=1,Outline=2,Shadow=4</b>"));
|
||||
}
|
||||
|
||||
#include "moc_prefsubtitles.cpp"
|
@ -1,977 +0,0 @@
|
||||
<ui version="4.0" >
|
||||
<class>PrefSubtitles</class>
|
||||
<widget class="QWidget" name="PrefSubtitles" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>556</width>
|
||||
<height>449</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string/>
|
||||
</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="QTabWidget" name="subtitles_tab" >
|
||||
<property name="currentIndex" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab" >
|
||||
<attribute name="title" >
|
||||
<string>&Subtitles</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>Autoload</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="textLabel5" >
|
||||
<property name="text" >
|
||||
<string>Au&toload subtitles files (*.srt, *.sub...):</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>font_autoload_combo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2" >
|
||||
<widget class="QCheckBox" name="font_autoload_check" >
|
||||
<property name="text" >
|
||||
<string>S&elect first available subtitle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QComboBox" name="font_autoload_combo" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Same name as movie</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>All subs containing movie name</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>All subs in directory</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>131</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel4" >
|
||||
<property name="text" >
|
||||
<string>&Default subtitle encoding:</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>font_encoding_combo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="MyComboBox" name="font_encoding_combo" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>161</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="title" >
|
||||
<string>Position</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel1_22" >
|
||||
<property name="text" >
|
||||
<string>Default &position of the subtitles on screen</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>sub_pos_slider</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSlider" name="sub_pos_slider" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimum" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="pageStep" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="sub_pos_label" >
|
||||
<property name="text" >
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</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_9" >
|
||||
<property name="text" >
|
||||
<string>Top</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>131</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel3_5" >
|
||||
<property name="text" >
|
||||
<string>Bottom</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="subtitles_on_screeshots_check" >
|
||||
<property name="text" >
|
||||
<string>&Include subtitles on screenshots</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="TabPage" >
|
||||
<attribute name="title" >
|
||||
<string>&Font</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_5" >
|
||||
<property name="title" >
|
||||
<string>Font</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QRadioButton" name="ttf_font_button" >
|
||||
<property name="text" >
|
||||
<string>&TTF font:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="ttf_font_edit" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="QPushButton" name="searchButton" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Sea&rch...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>121</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QRadioButton" name="system_font_button" >
|
||||
<property name="text" >
|
||||
<string>S&ystem font:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3" >
|
||||
<widget class="QLabel" name="textLabel1" >
|
||||
<property name="text" >
|
||||
<string>Select the font which will be used for subtitles (and OSD):</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="MyFontComboBox" name="fontCombo" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_6" >
|
||||
<property name="title" >
|
||||
<string>Size</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="3" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel2_2" >
|
||||
<property name="text" >
|
||||
<string>A&utoscale:</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>font_autoscale_combo</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="font_autoscale_combo" >
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>No autoscale</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Proportional to movie height</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Proportional to movie width</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Proportional to movie diagonal</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>71</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QDoubleSpinBox" name="font_text_scale" >
|
||||
<property name="decimals" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="singleStep" >
|
||||
<double>0.200000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QDoubleSpinBox" name="ass_font_scale" >
|
||||
<property name="maximum" >
|
||||
<double>100.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep" >
|
||||
<double>0.200000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Default sc&ale for SSA/ASS subtitles:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>ass_font_scale</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="scalelabel" >
|
||||
<property name="text" >
|
||||
<string>Default s&cale for normal subtitles:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>font_text_scale</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</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>
|
||||
<widget class="QWidget" name="tab_2" >
|
||||
<attribute name="title" >
|
||||
<string>SSA/ASS &library</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel1_14" >
|
||||
<property name="text" >
|
||||
<string>The new SSA/ASS library will provide nice styled subtitles for external SSA/ASS subtitles files and Matroska tracks. But it will be used too for rendering other formats like SUB and SRT files.</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="font_ass_check" >
|
||||
<property name="text" >
|
||||
<string>&Use SSA/ASS library for subtitle rendering</string>
|
||||
</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="asscolor_label" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Text color:</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>colorButton</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="colorButton" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>41</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="assbordercolor_label" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Border color:</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>borderButton</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="borderButton" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="ass_styles_line_2" >
|
||||
<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="styles_desc_label" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Here you can override styles for SSA/ASS subtitles. It can be also used for fine-tuning the rendering of SRT and SUB subtitles by the SSA/ASS library. Example: <b>Bold=1,Outline=2,Shadow=4</b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</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="ass_styles_label" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>St&yles:</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="buddy" >
|
||||
<cstring>ass_styles_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="ass_styles_edit" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>61</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>MyComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>mycombobox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>MyFontComboBox</class>
|
||||
<extends>QFontComboBox</extends>
|
||||
<header>mycombobox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>subtitles_tab</tabstop>
|
||||
<tabstop>font_autoload_combo</tabstop>
|
||||
<tabstop>font_autoload_check</tabstop>
|
||||
<tabstop>font_encoding_combo</tabstop>
|
||||
<tabstop>sub_pos_slider</tabstop>
|
||||
<tabstop>subtitles_on_screeshots_check</tabstop>
|
||||
<tabstop>ttf_font_button</tabstop>
|
||||
<tabstop>ttf_font_edit</tabstop>
|
||||
<tabstop>searchButton</tabstop>
|
||||
<tabstop>system_font_button</tabstop>
|
||||
<tabstop>fontCombo</tabstop>
|
||||
<tabstop>font_autoscale_combo</tabstop>
|
||||
<tabstop>font_text_scale</tabstop>
|
||||
<tabstop>ass_font_scale</tabstop>
|
||||
<tabstop>font_ass_check</tabstop>
|
||||
<tabstop>colorButton</tabstop>
|
||||
<tabstop>borderButton</tabstop>
|
||||
<tabstop>ass_styles_edit</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>ttf_font_button</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>ttf_font_edit</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>83</x>
|
||||
<y>114</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>273</x>
|
||||
<y>114</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>ttf_font_button</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>searchButton</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>83</x>
|
||||
<y>114</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>456</x>
|
||||
<y>114</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>font_ass_check</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>asscolor_label</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>258</x>
|
||||
<y>161</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>68</x>
|
||||
<y>196</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>font_ass_check</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>colorButton</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>258</x>
|
||||
<y>161</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>163</x>
|
||||
<y>196</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>font_ass_check</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>borderButton</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>258</x>
|
||||
<y>161</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>448</x>
|
||||
<y>196</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>font_ass_check</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>assbordercolor_label</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>258</x>
|
||||
<y>161</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>353</x>
|
||||
<y>196</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>font_ass_check</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>ass_styles_label</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>258</x>
|
||||
<y>161</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>44</x>
|
||||
<y>305</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>font_ass_check</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>ass_styles_edit</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>258</x>
|
||||
<y>161</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>282</x>
|
||||
<y>305</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>font_ass_check</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>styles_desc_label</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>258</x>
|
||||
<y>161</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>258</x>
|
||||
<y>256</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>sub_pos_slider</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>sub_pos_label</receiver>
|
||||
<slot>setNum(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>252</x>
|
||||
<y>298</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>492</x>
|
||||
<y>299</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>system_font_button</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>fontCombo</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>74</x>
|
||||
<y>138</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>264</x>
|
||||
<y>138</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -1,120 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 "recents.h"
|
||||
#include "global.h"
|
||||
#include <QSettings>
|
||||
|
||||
using namespace Global;
|
||||
|
||||
Recents::Recents(QObject* parent) : QObject(parent)
|
||||
{
|
||||
l.clear();
|
||||
max_items = 10;
|
||||
load();
|
||||
}
|
||||
|
||||
Recents::~Recents() {
|
||||
save();
|
||||
}
|
||||
|
||||
void Recents::clear() {
|
||||
l.clear();
|
||||
}
|
||||
|
||||
void Recents::add(QString s) {
|
||||
qDebug("Recents::add: '%s'", s.toUtf8().data());
|
||||
|
||||
/*
|
||||
QStringList::iterator it = l.find(s);
|
||||
if (it != l.end()) l.erase(it);
|
||||
l.prepend(s);
|
||||
|
||||
if (l.count() > max_items) l.erase(l.fromLast());
|
||||
*/
|
||||
|
||||
int pos = l.indexOf(s);
|
||||
if (pos != -1) l.removeAt(pos);
|
||||
l.prepend(s);
|
||||
|
||||
if (l.count() > max_items) l.removeLast();
|
||||
|
||||
//qDebug(" * current list:");
|
||||
//list();
|
||||
}
|
||||
|
||||
int Recents::count() {
|
||||
return l.count();
|
||||
}
|
||||
|
||||
QString Recents::item(int n) {
|
||||
return l[n];
|
||||
}
|
||||
|
||||
void Recents::list() {
|
||||
qDebug("Recents::list");
|
||||
|
||||
for (int n=0; n < count(); n++) {
|
||||
qDebug(" * item %d: '%s'", n, item(n).toUtf8().data() );
|
||||
}
|
||||
}
|
||||
|
||||
void Recents::save() {
|
||||
qDebug("Recents::save");
|
||||
|
||||
QSettings * set = settings;
|
||||
|
||||
/*
|
||||
set->beginGroup( "recent_files");
|
||||
|
||||
set->writeEntry( "items", count() );
|
||||
for (int n=0; n < count(); n++) {
|
||||
set->writeEntry("entry_" + QString::number(n), item(n) );
|
||||
}
|
||||
*/
|
||||
|
||||
set->beginGroup( "recent_files");
|
||||
set->setValue( "files", l );
|
||||
|
||||
set->endGroup();
|
||||
}
|
||||
|
||||
void Recents::load() {
|
||||
qDebug("Recents::load");
|
||||
|
||||
l.clear();
|
||||
|
||||
QSettings * set = settings;
|
||||
|
||||
/*
|
||||
set->beginGroup( "recent_files");
|
||||
|
||||
int num_entries = set->readNumEntry( "items", 0 );
|
||||
for (int n=0; n < num_entries; n++) {
|
||||
QString s = set->readEntry("entry_" + QString::number(n), "" );
|
||||
if (!s.isEmpty()) l.append( s );
|
||||
}
|
||||
*/
|
||||
|
||||
set->beginGroup( "recent_files");
|
||||
l = set->value( "files" ).toStringList();
|
||||
|
||||
set->endGroup();
|
||||
}
|
||||
|
||||
#include "moc_recents.cpp"
|
@ -1,209 +0,0 @@
|
||||
TEMPLATE = lib
|
||||
CONFIG += staticlib
|
||||
DESTDIR = lib
|
||||
#TEMPLATE = app
|
||||
LANGUAGE = C++
|
||||
|
||||
CONFIG += release
|
||||
#CONFIG += qt warn_on release
|
||||
|
||||
QT += network
|
||||
#QT += opengl
|
||||
|
||||
RESOURCES = icons.qrc
|
||||
|
||||
HEADERS += config.h \
|
||||
constants.h \
|
||||
svn_revision.h \
|
||||
version.h \
|
||||
global.h \
|
||||
helper.h \
|
||||
translator.h \
|
||||
subtracks.h \
|
||||
trackdata.h \
|
||||
tracks.h \
|
||||
extensions.h \
|
||||
desktopinfo.h \
|
||||
myprocess.h \
|
||||
mplayerversion.h \
|
||||
mplayerprocess.h \
|
||||
mplayerwindow.h \
|
||||
mediadata.h \
|
||||
mediasettings.h \
|
||||
preferences.h \
|
||||
images.h \
|
||||
inforeader.h \
|
||||
recents.h \
|
||||
core.h \
|
||||
logwindow.h \
|
||||
infofile.h \
|
||||
encodings.h \
|
||||
seekwidget.h \
|
||||
mytablewidget.h \
|
||||
shortcutgetter.h \
|
||||
actionseditor.h \
|
||||
preferencesdialog.h \
|
||||
mycombobox.h \
|
||||
tristatecombo.h \
|
||||
prefwidget.h \
|
||||
prefgeneral.h \
|
||||
prefdrives.h \
|
||||
prefinterface.h \
|
||||
prefperformance.h \
|
||||
prefinput.h \
|
||||
prefsubtitles.h \
|
||||
prefadvanced.h \
|
||||
filepropertiesdialog.h \
|
||||
playlist.h \
|
||||
playlistdock.h \
|
||||
verticaltext.h \
|
||||
eqslider.h \
|
||||
videoequalizer.h \
|
||||
timeslider.h \
|
||||
inputdvddirectory.h \
|
||||
inputurl.h \
|
||||
myaction.h \
|
||||
myactiongroup.h \
|
||||
myserver.h \
|
||||
myclient.h \
|
||||
filedialog.h \
|
||||
inputmplayerversion.h \
|
||||
about.h \
|
||||
errordialog.h \
|
||||
basegui.h \
|
||||
baseguiplus.h \
|
||||
floatingwidget.h \
|
||||
widgetactions.h \
|
||||
defaultgui.h \
|
||||
minigui.h \
|
||||
smplayer.h \
|
||||
clhelp.h
|
||||
|
||||
|
||||
SOURCES += version.cpp \
|
||||
global.cpp \
|
||||
helper.cpp \
|
||||
translator.cpp \
|
||||
subtracks.cpp \
|
||||
trackdata.cpp \
|
||||
tracks.cpp \
|
||||
extensions.cpp \
|
||||
desktopinfo.cpp \
|
||||
myprocess.cpp \
|
||||
mplayerversion.cpp \
|
||||
mplayerprocess.cpp \
|
||||
mplayerwindow.cpp \
|
||||
mediadata.cpp \
|
||||
mediasettings.cpp \
|
||||
preferences.cpp \
|
||||
images.cpp \
|
||||
inforeader.cpp \
|
||||
recents.cpp \
|
||||
core.cpp \
|
||||
logwindow.cpp \
|
||||
infofile.cpp \
|
||||
encodings.cpp \
|
||||
seekwidget.cpp \
|
||||
mytablewidget.cpp \
|
||||
shortcutgetter.cpp \
|
||||
actionseditor.cpp \
|
||||
preferencesdialog.cpp \
|
||||
mycombobox.cpp \
|
||||
tristatecombo.cpp \
|
||||
prefwidget.cpp \
|
||||
prefgeneral.cpp \
|
||||
prefdrives.cpp \
|
||||
prefinterface.cpp \
|
||||
prefperformance.cpp \
|
||||
prefinput.cpp \
|
||||
prefsubtitles.cpp \
|
||||
prefadvanced.cpp \
|
||||
filepropertiesdialog.cpp \
|
||||
playlist.cpp \
|
||||
playlistdock.cpp \
|
||||
verticaltext.cpp \
|
||||
eqslider.cpp \
|
||||
videoequalizer.cpp \
|
||||
timeslider.cpp \
|
||||
inputdvddirectory.cpp \
|
||||
inputurl.cpp \
|
||||
myaction.cpp \
|
||||
myactiongroup.cpp \
|
||||
myserver.cpp \
|
||||
myclient.cpp \
|
||||
filedialog.cpp \
|
||||
inputmplayerversion.cpp \
|
||||
about.cpp \
|
||||
errordialog.cpp \
|
||||
basegui.cpp \
|
||||
baseguiplus.cpp \
|
||||
floatingwidget.cpp \
|
||||
widgetactions.cpp \
|
||||
defaultgui.cpp \
|
||||
minigui.cpp \
|
||||
clhelp.cpp \
|
||||
smplayer.cpp \
|
||||
main.cpp
|
||||
|
||||
FORMS = inputdvddirectory.ui logwindowbase.ui filepropertiesdialog.ui \
|
||||
eqslider.ui seekwidget.ui inputurl.ui \
|
||||
preferencesdialog.ui prefgeneral.ui prefdrives.ui prefinterface.ui \
|
||||
prefperformance.ui prefinput.ui prefsubtitles.ui prefadvanced.ui \
|
||||
about.ui inputmplayerversion.ui errordialog.ui
|
||||
|
||||
TRANSLATIONS = translations/smplayer_es.ts translations/smplayer_de.ts \
|
||||
translations/smplayer_sk.ts translations/smplayer_it.ts \
|
||||
translations/smplayer_fr.ts translations/smplayer_zh_CN.ts \
|
||||
translations/smplayer_ru_RU.ts translations/smplayer_hu.ts \
|
||||
translations/smplayer_en_US.ts translations/smplayer_pl.ts \
|
||||
translations/smplayer_ja.ts translations/smplayer_nl.ts \
|
||||
translations/smplayer_uk_UA.ts translations/smplayer_pt_BR.ts \
|
||||
translations/smplayer_ka.ts translations/smplayer_cs.ts \
|
||||
translations/smplayer_bg.ts translations/smplayer_tr.ts \
|
||||
translations/smplayer_sv.ts translations/smplayer_sr.ts \
|
||||
translations/smplayer_zh_TW.ts translations/smplayer_ro_RO.ts \
|
||||
translations/smplayer_pt_PT.ts translations/smplayer_el_GR.ts \
|
||||
translations/smplayer_fi.ts translations/smplayer_ko.ts \
|
||||
translations/smplayer_mk.ts translations/smplayer_eu.ts
|
||||
|
||||
unix {
|
||||
UI_DIR = .ui
|
||||
MOC_DIR = .moc
|
||||
OBJECTS_DIR = .obj
|
||||
|
||||
DEFINES += DATA_PATH=$(DATA_PATH)
|
||||
DEFINES += DOC_PATH=$(DOC_PATH)
|
||||
DEFINES += TRANSLATION_PATH=$(TRANSLATION_PATH)
|
||||
DEFINES += CONF_PATH=$(CONF_PATH)
|
||||
DEFINES += THEMES_PATH=$(THEMES_PATH)
|
||||
DEFINES += SHORTCUTS_PATH=$(SHORTCUTS_PATH)
|
||||
#DEFINES += NO_DEBUG_ON_CONSOLE
|
||||
|
||||
#DEFINES += KDE_SUPPORT
|
||||
#INCLUDEPATH += /opt/kde3/include/
|
||||
#LIBS += -lkio -L/opt/kde3/lib/
|
||||
|
||||
#contains( DEFINES, KDE_SUPPORT) {
|
||||
# HEADERS += mysystemtrayicon.h
|
||||
# SOURCES += mysystemtrayicon.cpp
|
||||
#}
|
||||
|
||||
#HEADERS += prefassociations.h winfileassoc.h
|
||||
#SOURCES += prefassociations.cpp winfileassoc.cpp
|
||||
#FORMS += prefassociations.ui
|
||||
}
|
||||
|
||||
win32 {
|
||||
HEADERS += prefassociations.h winfileassoc.h screensaver.h
|
||||
SOURCES += prefassociations.cpp winfileassoc.cpp screensaver.cpp
|
||||
FORMS += prefassociations.ui
|
||||
|
||||
LIBS += libole32
|
||||
|
||||
RC_FILE = smplayer.rc
|
||||
DEFINES += NO_DEBUG_ON_CONSOLE
|
||||
# debug {
|
||||
# CONFIG += console
|
||||
# }
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
#define SVN_REVISION "SVN-rUNKNOWN"
|
@ -1,97 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 "trackdata.h"
|
||||
#include "helper.h"
|
||||
#include <QFileInfo>
|
||||
|
||||
TrackData::TrackData() {
|
||||
_lang = "";
|
||||
_name = "";
|
||||
_filename = "";
|
||||
_duration = 0;
|
||||
_ID = -1;
|
||||
_chapters = 0;
|
||||
_angles = 0;
|
||||
}
|
||||
|
||||
TrackData::~TrackData() {
|
||||
}
|
||||
|
||||
QString TrackData::displayName() const {
|
||||
//qDebug("TrackData::displayName");
|
||||
|
||||
QString dname="";
|
||||
|
||||
if (!_name.isEmpty()) {
|
||||
dname = _name;
|
||||
if (!_lang.isEmpty()) {
|
||||
dname += " ["+ _lang + "]";
|
||||
}
|
||||
}
|
||||
else
|
||||
if (!_lang.isEmpty()) {
|
||||
dname = _lang;
|
||||
}
|
||||
else
|
||||
if (!_filename.isEmpty()) {
|
||||
QFileInfo f(_filename);
|
||||
dname = f.fileName();
|
||||
}
|
||||
else
|
||||
dname = QString::number(_ID);
|
||||
|
||||
if (_duration > 0) {
|
||||
dname += " ("+ Helper::formatTime( (int) _duration ) +")";
|
||||
}
|
||||
|
||||
return dname;
|
||||
}
|
||||
|
||||
|
||||
void TrackData::save(QSettings & set) {
|
||||
//qDebug("TrackData::save");
|
||||
|
||||
set.setValue( "lang", _lang );
|
||||
set.setValue( "name", _name );
|
||||
set.setValue( "filename", _filename );
|
||||
set.setValue( "duration", _duration );
|
||||
set.setValue( "chapters", _chapters );
|
||||
set.setValue( "angles", _angles );
|
||||
set.setValue( "ID", _ID );
|
||||
}
|
||||
|
||||
void TrackData::load(QSettings & set) {
|
||||
//qDebug("TrackData::load");
|
||||
|
||||
_lang = set.value( "lang", _lang ).toString();
|
||||
_name = set.value( "name", _name ).toString();
|
||||
_filename = set.value( "filename", _filename ).toString();
|
||||
_duration = set.value( "duration", _duration).toDouble();
|
||||
_chapters = set.value( "chapters", _chapters ).toInt();
|
||||
_angles = set.value( "angles", _angles ).toInt();
|
||||
_ID = set.value( "ID", _ID ).toInt();
|
||||
}
|
||||
|
||||
void TrackData::list() {
|
||||
//qDebug("TrackData::list");
|
||||
|
||||
qDebug(" ID: '%d' lang: '%s' name: '%s'", _ID, _lang.toUtf8().data(), _name.toUtf8().data() );
|
||||
qDebug(" filename: '%s' duration: %f chapters: %d angles: %d",
|
||||
_filename.toUtf8().data(), _duration, _chapters, _angles );
|
||||
}
|
@ -1,163 +0,0 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 "tracks.h"
|
||||
#include <QRegExp>
|
||||
|
||||
TrackList::TrackList() {
|
||||
clear();
|
||||
}
|
||||
|
||||
TrackList::~TrackList() {
|
||||
}
|
||||
|
||||
void TrackList::clear() {
|
||||
tm.clear();
|
||||
}
|
||||
|
||||
void TrackList::addLang(int ID, QString lang) {
|
||||
tm[ID].setLang(lang);
|
||||
tm[ID].setID(ID);
|
||||
}
|
||||
|
||||
void TrackList::addName(int ID, QString name) {
|
||||
tm[ID].setName(name);
|
||||
tm[ID].setID(ID);
|
||||
}
|
||||
|
||||
void TrackList::addFilename(int ID, QString filename) {
|
||||
tm[ID].setFilename(filename);
|
||||
tm[ID].setID(ID);
|
||||
}
|
||||
|
||||
void TrackList::addDuration(int ID, double duration) {
|
||||
tm[ID].setDuration(duration);
|
||||
tm[ID].setID(ID);
|
||||
}
|
||||
|
||||
void TrackList::addChapters(int ID, int n) {
|
||||
tm[ID].setChapters(n);
|
||||
tm[ID].setID(ID);
|
||||
}
|
||||
|
||||
void TrackList::addAngles(int ID, int n) {
|
||||
tm[ID].setAngles(n);
|
||||
tm[ID].setID(ID);
|
||||
}
|
||||
|
||||
void TrackList::addID(int ID) {
|
||||
tm[ID].setID(ID);
|
||||
}
|
||||
|
||||
|
||||
int TrackList::numItems() {
|
||||
return tm.count();
|
||||
}
|
||||
|
||||
bool TrackList::existsItemAt(int n) {
|
||||
return ((n > 0) && (n < numItems()));
|
||||
}
|
||||
|
||||
TrackData TrackList::itemAt(int n) {
|
||||
return tm.values()[n];
|
||||
}
|
||||
|
||||
TrackData TrackList::item(int ID) {
|
||||
return tm[ID];
|
||||
}
|
||||
|
||||
int TrackList::find(int ID) {
|
||||
for (int n=0; n < numItems(); n++) {
|
||||
if (itemAt(n).ID() == ID) return n;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int TrackList::findLang(QString expr) {
|
||||
qDebug( "TrackList::findLang: '%s'", expr.toUtf8().data());
|
||||
QRegExp rx( expr );
|
||||
|
||||
int res_id = -1;
|
||||
|
||||
for (int n=0; n < numItems(); n++) {
|
||||
qDebug("TrackList::findLang: lang #%d '%s'", n, itemAt(n).lang().toUtf8().data());
|
||||
if (rx.indexIn( itemAt(n).lang() ) > -1) {
|
||||
qDebug("TrackList::findLang: found preferred lang!");
|
||||
res_id = itemAt(n).ID();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return res_id;
|
||||
}
|
||||
|
||||
void TrackList::list() {
|
||||
for (int n=0; n < numItems(); n++) {
|
||||
qDebug(" item # %d", n);
|
||||
itemAt(n).list();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int TrackList::lastID() {
|
||||
int key = -1;
|
||||
for (int n=0; n < numItems(); n++) {
|
||||
if (itemAt(n).ID() > key)
|
||||
key = itemAt(n).ID();
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
bool TrackList::existsFilename(QString name) {
|
||||
for (int n=0; n < numItems(); n++) {
|
||||
if (itemAt(n).filename() == name)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void TrackList::save(QSettings & set) {
|
||||
qDebug("TrackList::save");
|
||||
|
||||
set.setValue( "num_tracks", numItems() );
|
||||
for (int n=0; n < numItems(); n++) {
|
||||
set.beginGroup( "track_" + QString::number(n) );
|
||||
itemAt(n).save(set);
|
||||
set.endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void TrackList::load(QSettings & set) {
|
||||
qDebug("TrackList::load");
|
||||
|
||||
int num_tracks = set.value( "num_tracks", 0 ).toInt();
|
||||
|
||||
int ID;
|
||||
for (int n=0; n < num_tracks; n++) {
|
||||
set.beginGroup( "track_" + QString::number(n) );
|
||||
ID = set.value("ID", -1).toInt();
|
||||
if (ID!=-1) {
|
||||
tm[ID].setID(ID);
|
||||
tm[ID].load(set);
|
||||
}
|
||||
set.endGroup();
|
||||
}
|
||||
|
||||
//list();
|
||||
}
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,32 @@
|
||||
//#include <QApplication>
|
||||
//#include <QString>
|
||||
//#include <QPushButton>
|
||||
|
||||
#include "SMPlayerPlugin.h"
|
||||
#include "smplayer.h"
|
||||
|
||||
QString
|
||||
SMPlayerPlugin::pluginDescription() const
|
||||
{
|
||||
QString res;
|
||||
res = "A SMPlayer plugin" ;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
QString
|
||||
SMPlayerPlugin::pluginName() const
|
||||
{
|
||||
return "SMPlayer" ;
|
||||
}
|
||||
|
||||
QWidget*
|
||||
SMPlayerPlugin::pluginWidget(QWidget * parent )
|
||||
{
|
||||
SMPlayer *smplayer = new SMPlayer();
|
||||
smplayer->start();
|
||||
//return smplayer;
|
||||
}
|
||||
|
||||
|
||||
Q_EXPORT_PLUGIN2(smplayer_plugin, SMPlayerPlugin)
|
@ -0,0 +1,30 @@
|
||||
#ifndef _HWA_PLUGIN_H_
|
||||
#define _HWA_PLUGIN_H_
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
#include <PluginInterface.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
class SMPlayer;
|
||||
|
||||
|
||||
class SMPlayerPlugin: public QObject, public PluginInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(PluginInterface)
|
||||
|
||||
public slots:
|
||||
|
||||
virtual QString pluginDescription() const ;
|
||||
virtual QString pluginName() const ;
|
||||
|
||||
virtual QWidget* pluginWidget(QWidget * parent = 0) ;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
271
retroshare-gui/src/gui/plugins/smplayer_plugin/about.cpp
Normal file
271
retroshare-gui/src/gui/plugins/smplayer_plugin/about.cpp
Normal file
@ -0,0 +1,271 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 "about.h"
|
||||
#include "images.h"
|
||||
#include "version.h"
|
||||
#include "global.h"
|
||||
#include "preferences.h"
|
||||
#include "paths.h"
|
||||
#include "mplayerversion.h"
|
||||
|
||||
#include <QFile>
|
||||
|
||||
//#define TRANS_ORIG
|
||||
#define TRANS_LIST
|
||||
//#define TRANS_TABLE
|
||||
|
||||
using namespace Global;
|
||||
|
||||
About::About(QWidget * parent, Qt::WindowFlags f)
|
||||
: QDialog(parent, f)
|
||||
{
|
||||
setupUi(this);
|
||||
setWindowIcon( Images::icon("logo", 64) );
|
||||
|
||||
logo->setPixmap( Images::icon("logo", 64) );
|
||||
contrib_icon->setPixmap( Images::icon("contributors" ) );
|
||||
translators_icon->setPixmap( Images::icon("translators" ) );
|
||||
license_icon->setPixmap( Images::icon("license" ) );
|
||||
|
||||
QString mplayer_version;
|
||||
if (pref->mplayer_detected_version > 0) {
|
||||
mplayer_version = tr("Using MPlayer %1").arg(MplayerVersion::toString(pref->mplayer_detected_version)) + "<br><br>";
|
||||
}
|
||||
|
||||
info->setText(
|
||||
"<b>SMPlayer</b> © 2006-2008 Ricardo Villalba <rvm@escomposlinux.org><br><br>"
|
||||
"<b>" + tr("Version: %1").arg(smplayerVersion()) + "</b>" +
|
||||
#if PORTABLE_APP
|
||||
" (" + tr("Portable Edition") + ")" +
|
||||
#endif
|
||||
"<br>" +
|
||||
tr("Using Qt %1 (compiled with Qt %2)").arg(qVersion()).arg(QT_VERSION_STR) + "<br><br>" +
|
||||
mplayer_version +
|
||||
tr("Visit our web for updates:") +"<br>"+
|
||||
link("http://smplayer.berlios.de") + "<br>" +
|
||||
link("http://smplayer.sf.net") +
|
||||
"<br><br>" +
|
||||
tr("Get help in our forum:") +"<br>" + link("http://smplayer.berlios.de/forums") +
|
||||
"<br><br>" +
|
||||
tr("You can support SMPlayer by making a donation.") +" "+
|
||||
link("https://sourceforge.net/donate/index.php?group_id=185512", tr("More info"))
|
||||
//link("http://www.qt-apps.org/content/donate.php?content=61041", tr("More info"))
|
||||
);
|
||||
|
||||
|
||||
QString license_file = Paths::doc("gpl.html", pref->language);
|
||||
if (QFile::exists(license_file)) {
|
||||
QFont fixed_font;
|
||||
fixed_font.setStyleHint(QFont::TypeWriter);
|
||||
fixed_font.setFamily("Courier");
|
||||
license->setFont(fixed_font);
|
||||
|
||||
QFile f(license_file);
|
||||
if (f.open(QIODevice::ReadOnly)) {
|
||||
license->setText(QString::fromUtf8(f.readAll().constData()));
|
||||
}
|
||||
f.close();
|
||||
} else {
|
||||
license->setText(
|
||||
"<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>");
|
||||
}
|
||||
|
||||
translators->setHtml( getTranslators() );
|
||||
|
||||
contributions->setText(
|
||||
tr("SMPlayer logo by %1").arg("Charles Barcza <kbarcza@blackpanther.hu>") + "<br><br>" +
|
||||
tr("The following people have contributed with patches "
|
||||
"(see the changelog for details):") +
|
||||
"<pre>" +
|
||||
QString(
|
||||
"corentin1234 <corentin1234@hotmail.com>\n"
|
||||
"Florin Braghis <florin@libertv.ro>\n"
|
||||
"Francesco Cosoleto <cosoleto@users.sourceforge.net>\n"
|
||||
"Glaydus <glaydus@gmail.com>\n"
|
||||
"Kamil Dziobek <turbos11@gmail.com>\n"
|
||||
"LoRd_MuldeR (http://forum.doom9.org/member.php?u=78667)\n"
|
||||
"Matthias Petri <matt@endboss.org>\n"
|
||||
"profoX <wesley@ubuntu.com>\n"
|
||||
"redxii <redxii1234@gmail.com>\n"
|
||||
"Sikon <sikon@users.sourceforge.net>\n"
|
||||
"Simon <hackykid@users.sourceforge.net>\n"
|
||||
"Stanislav Maslovski <s_i_m@users.sourceforge.net>\n"
|
||||
"Tanguy Krotoff <tkrotoff@gmail.com>\n"
|
||||
).replace("<", "<").replace(">", ">") +
|
||||
"</pre>" +
|
||||
tr("If there's any omission, please report.")
|
||||
);
|
||||
|
||||
// Copy the background color ("window") of the tab widget to the "base" color of the qtextbrowsers
|
||||
// Problem, it doesn't work with some styles, so first we change the "window" color of the tab widgets.
|
||||
info_tab->setAutoFillBackground(true);
|
||||
contributions_tab->setAutoFillBackground(true);
|
||||
translations_tab->setAutoFillBackground(true);
|
||||
license_tab->setAutoFillBackground(true);
|
||||
|
||||
QPalette pal = info_tab->palette();
|
||||
pal.setColor(QPalette::Window, palette().color(QPalette::Window) );
|
||||
|
||||
info_tab->setPalette(pal);
|
||||
contributions_tab->setPalette(pal);
|
||||
translations_tab->setPalette(pal);
|
||||
license_tab->setPalette(pal);
|
||||
|
||||
QPalette p = info->palette();
|
||||
//p.setBrush(QPalette::Base, info_tab->palette().window());
|
||||
p.setColor(QPalette::Base, info_tab->palette().color(QPalette::Window));
|
||||
|
||||
info->setPalette(p);
|
||||
contributions->setPalette(p);
|
||||
translators->setPalette(p);
|
||||
//license->setPalette(p);
|
||||
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
About::~About() {
|
||||
}
|
||||
|
||||
QString About::getTranslators() {
|
||||
return QString(
|
||||
tr("The following people have contributed with translations:") +
|
||||
#ifndef TRANS_TABLE
|
||||
"<ul>" +
|
||||
#else
|
||||
"<table>" +
|
||||
#endif
|
||||
trad(tr("German"), "Henrikx <henrikx@users.sourceforge.net>") +
|
||||
trad(tr("Slovak"), "Sweto <peter.mendel@gmail.com>") +
|
||||
trad(tr("Italian"), "Giancarlo Scola <scola.giancarlo@libero.it>") +
|
||||
trad(tr("French"), QStringList()
|
||||
<< "Olivier g <1got@caramail.com>"
|
||||
<< "Temet <goondy@free.fr>"
|
||||
<< "Erwann MEST <kud.gray@gmail.com>") +
|
||||
trad(tr("Simplified-Chinese"), "Tim Green <iamtimgreen@gmail.com>") +
|
||||
trad(tr("Russian"), QString::fromUtf8("Белый Владимир <wiselord1983@gmail.com>"))+
|
||||
trad(tr("Hungarian"), QStringList()
|
||||
<< "Charles Barcza <kbarcza@blackpanther.hu>"
|
||||
<< "CyberDragon <cyberdragon777@gmail.com>") +
|
||||
trad(tr("Polish"), QStringList()
|
||||
<< "qla <qla0@vp.pl>"
|
||||
<< "Jarek <ajep9691@wp.pl>" ) +
|
||||
trad(tr("Japanese"), "Nardog <nardog@e2umail.com>") +
|
||||
trad(tr("Dutch"), QStringList()
|
||||
<< "profoX <wesley@ubuntu-nl.org>"
|
||||
<< "BalaamsMiracle"
|
||||
<< "Kristof Bal <kristof.bal@gmail.com>") +
|
||||
trad(tr("Ukrainian"), QStringList()
|
||||
<< "Motsyo Gennadi <drool@altlinux.ru>"
|
||||
<< "Oleksandr Kovalenko <alx.kovalenko@gmail.com>" ) +
|
||||
trad(tr("Portuguese - Brazil"), "Ventura <ventura.barbeiro@terra.com.br>") +
|
||||
trad(tr("Georgian"), "George Machitidze <giomac@gmail.com>") +
|
||||
trad(tr("Czech"), QStringList()
|
||||
<< QString::fromUtf8("Martin Dvořák <martin.dvorak@centrum.cz>")
|
||||
<< QString::fromUtf8("Jaromír Smrček <jaromir.smrcek@zoner.com>") ) +
|
||||
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@gmail.com>") +
|
||||
trad(tr("Portuguese - Portugal"), QStringList()
|
||||
<< "Waxman <waxman.pt@gmail.com>"
|
||||
<< QString::fromUtf8("Sérgio Marques <contatica@netcabo.pt>") ) +
|
||||
trad(tr("Greek"), "my80s <wamy80s@gmail.com>") +
|
||||
trad(tr("Finnish"), "peeaivo <peeaivo@gmail.com>") +
|
||||
trad(tr("Korean"), "Heesu Yoon <imsu30@gmail.com>") +
|
||||
trad(tr("Macedonian"), "Marko Doda <mark0d0da@gmail.com>") +
|
||||
trad(tr("Basque"), "Piarres Beobide <pi@beobide.net>") +
|
||||
trad(tr("Catalan"), QString::fromUtf8("Roger Calvó <rcalvoi@yahoo.com>")) +
|
||||
trad(tr("Slovenian"), "Janez Troha <janez.troha@gmail.com>") +
|
||||
trad(tr("Arabic"), "Muhammad Nour Hajj Omar <arabianheart@live.com>") +
|
||||
trad(tr("Kurdish"), "Si_murg56 <simurg56@gmail.com>") +
|
||||
trad(tr("Galician"), "Miguel Branco <mgl.branco@gmail.com>") +
|
||||
#ifndef TRANS_TABLE
|
||||
"</ul>");
|
||||
#else
|
||||
"</table>");
|
||||
#endif
|
||||
}
|
||||
|
||||
QString About::trad(const QString & lang, const QString & author) {
|
||||
return trad(lang, QStringList() << author);
|
||||
}
|
||||
|
||||
QString About::trad(const QString & lang, const QStringList & authors) {
|
||||
#ifdef TRANS_ORIG
|
||||
QString s;
|
||||
|
||||
switch (authors.count()) {
|
||||
case 2: s = tr("%1 and %2"); break;
|
||||
case 3: s = tr("%1, %2 and %3"); break;
|
||||
case 4: s = tr("%1, %2, %3 and %4"); break;
|
||||
case 5: s = tr("%1, %2, %3, %4 and %5"); break;
|
||||
default: s = "%1";
|
||||
}
|
||||
|
||||
for (int n = 0; n < authors.count(); n++) {
|
||||
QString author = authors[n];
|
||||
s = s.arg(author.replace("<", "<").replace(">", ">"));
|
||||
}
|
||||
|
||||
return "<li>"+ tr("<b>%1</b>: %2").arg(lang).arg(s) + "</li>";
|
||||
#endif
|
||||
|
||||
#ifdef TRANS_LIST
|
||||
QString s = "<ul>";;
|
||||
for (int n = 0; n < authors.count(); n++) {
|
||||
QString author = authors[n];
|
||||
s += "<li>"+ author.replace("<", "<").replace(">", ">") + "</li>";
|
||||
}
|
||||
s+= "</ul>";
|
||||
|
||||
return "<li>"+ tr("<b>%1</b>: %2").arg(lang).arg(s) + "</li>";
|
||||
#endif
|
||||
|
||||
#ifdef TRANS_TABLE
|
||||
QString s;
|
||||
for (int n = 0; n < authors.count(); n++) {
|
||||
QString author = authors[n];
|
||||
s += author.replace("<", "<").replace(">", ">");
|
||||
if (n < (authors.count()-1)) s += "<br>";
|
||||
}
|
||||
|
||||
return QString("<tr><td align=right><b>%1</b></td><td>%2</td></tr>").arg(lang).arg(s);
|
||||
#endif
|
||||
}
|
||||
|
||||
QString About::link(const QString & url, QString name) {
|
||||
if (name.isEmpty()) name = url;
|
||||
return QString("<a href=\"" + url + "\">" + name +"</a>");
|
||||
}
|
||||
|
||||
QString About::contr(const QString & author, const QString & thing) {
|
||||
return "<li>"+ tr("<b>%1</b> (%2)").arg(author).arg(thing) +"</li>";
|
||||
}
|
||||
|
||||
QSize About::sizeHint () const {
|
||||
return QSize(518, 326);
|
||||
}
|
||||
|
||||
#include "moc_about.cpp"
|
@ -37,12 +37,16 @@ public:
|
||||
About( QWidget * parent = 0, Qt::WindowFlags f = 0 );
|
||||
~About();
|
||||
|
||||
virtual QSize sizeHint () const;
|
||||
|
||||
protected:
|
||||
QString getTranslators();
|
||||
|
||||
//! Return a formatted string with the translator and language
|
||||
QString trad(const QString & lang, const QString & author);
|
||||
|
||||
QString trad(const QString & lang, const QStringList & authors);
|
||||
|
||||
QString link(const QString & url, QString name = "");
|
||||
|
||||
//! Return a formatted string with the contributor and what he did
|
@ -12,9 +12,6 @@
|
||||
<property name="windowTitle" >
|
||||
<string>About SMPlayer</string>
|
||||
</property>
|
||||
<property name="windowIcon" >
|
||||
<iconset/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
@ -268,6 +265,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
<tabstop>info</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
<tabstop>contributions</tabstop>
|
||||
<tabstop>translators</tabstop>
|
||||
<tabstop>license</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
@ -39,7 +39,7 @@
|
||||
|
||||
#include "images.h"
|
||||
#include "filedialog.h"
|
||||
#include "helper.h"
|
||||
#include "paths.h"
|
||||
|
||||
#include "shortcutgetter.h"
|
||||
|
||||
@ -112,7 +112,14 @@ QList <QKeySequence> ActionsEditor::stringToShortcuts(QString shortcuts) {
|
||||
|
||||
for (int n=0; n < l.count(); n++) {
|
||||
//qDebug("%s", l[n].toUtf8().data());
|
||||
#if QT_VERSION >= 0x040300
|
||||
// Qt 4.3 and 4.4 (at least on linux) seems to have a problem when using Traditional Chinese
|
||||
// QKeysequence deletes the arrow key names from the shortcut
|
||||
// so this is a work-around.
|
||||
QString s = l[n].simplified();
|
||||
#else
|
||||
QString s = QKeySequence( l[n].simplified() );
|
||||
#endif
|
||||
|
||||
//Work-around for Simplified-Chinese
|
||||
s.replace( QString::fromUtf8("左"), "Left");
|
||||
@ -137,7 +144,7 @@ QList <QKeySequence> ActionsEditor::stringToShortcuts(QString shortcuts) {
|
||||
ActionsEditor::ActionsEditor(QWidget * parent, Qt::WindowFlags f)
|
||||
: QWidget(parent, f)
|
||||
{
|
||||
latest_dir = Helper::shortcutsPath();
|
||||
latest_dir = Paths::shortcutsPath();
|
||||
|
||||
actionsTable = new QTableWidget(0, COL_NAME +1, this);
|
||||
actionsTable->setSelectionMode( QAbstractItemView::SingleSelection );
|
||||
@ -226,7 +233,7 @@ void ActionsEditor::addActions(QWidget *widget) {
|
||||
QList<QAction *> actions = widget->findChildren<QAction *>();
|
||||
for (int n=0; n < actions.count(); n++) {
|
||||
action = static_cast<QAction*> (actions[n]);
|
||||
if (!action->objectName().isEmpty())
|
||||
if (!action->objectName().isEmpty() && !action->inherits("QWidgetAction"))
|
||||
actionsList.append(action);
|
||||
}
|
||||
|
||||
@ -350,7 +357,7 @@ void ActionsEditor::validateAction(QTableWidgetItem * i) {
|
||||
void ActionsEditor::editShortcut() {
|
||||
QTableWidgetItem * i = actionsTable->item( actionsTable->currentRow(), COL_SHORTCUT );
|
||||
if (i) {
|
||||
ShortcutGetter d;
|
||||
ShortcutGetter d(this);
|
||||
QString result = d.exec( i->text() );
|
||||
|
||||
if (!result.isNull()) {
|
||||
@ -536,7 +543,7 @@ void ActionsEditor::saveToConfig(QObject *o, QSettings *set) {
|
||||
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 (!action->objectName().isEmpty() && !action->inherits("QWidgetAction")) {
|
||||
#if USE_MULTIPLE_SHORTCUTS
|
||||
QString accelText = shortcutsToString(action->shortcuts());
|
||||
#else
|
||||
@ -561,7 +568,7 @@ void ActionsEditor::loadFromConfig(QObject *o, QSettings *set) {
|
||||
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 (!action->objectName().isEmpty() && !action->inherits("QWidgetAction")) {
|
||||
#if USE_MULTIPLE_SHORTCUTS
|
||||
QString current = shortcutsToString(action->shortcuts());
|
||||
accelText = set->value(action->objectName(), current).toString();
|
@ -24,7 +24,7 @@
|
||||
#include <QWidget>
|
||||
#include <QList>
|
||||
#include <QStringList>
|
||||
#include "config.h"
|
||||
#include "guiconfig.h"
|
||||
|
||||
class QTableWidget;
|
||||
class QTableWidgetItem;
|
118
retroshare-gui/src/gui/plugins/smplayer_plugin/assstyles.cpp
Normal file
118
retroshare-gui/src/gui/plugins/smplayer_plugin/assstyles.cpp
Normal file
@ -0,0 +1,118 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 "assstyles.h"
|
||||
#include <QSettings>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include "colorutils.h"
|
||||
|
||||
AssStyles::AssStyles() {
|
||||
fontname = "Arial";
|
||||
fontsize = 20;
|
||||
primarycolor = 0xFFFFFF;
|
||||
backcolor = 0;
|
||||
bold = false;
|
||||
italic = false;
|
||||
halignment = 2; // Centered
|
||||
valignment = 0; // Bottom
|
||||
borderstyle = 1; // Outline
|
||||
outline = 1;
|
||||
shadow = 2;
|
||||
marginl = 20;
|
||||
marginr = 20;
|
||||
marginv = 8;
|
||||
}
|
||||
|
||||
void AssStyles::save(QSettings * set) {
|
||||
qDebug("AssStyles::save");
|
||||
|
||||
set->setValue("styles/fontname", fontname);
|
||||
set->setValue("styles/fontsize", fontsize);
|
||||
set->setValue("styles/primarycolor", primarycolor);
|
||||
set->setValue("styles/backcolor", backcolor);
|
||||
set->setValue("styles/bold", bold);
|
||||
set->setValue("styles/italic", italic);
|
||||
set->setValue("styles/halignment", halignment);
|
||||
set->setValue("styles/valignment", valignment);
|
||||
set->setValue("styles/borderstyle", borderstyle);
|
||||
set->setValue("styles/outline", outline);
|
||||
set->setValue("styles/shadow", shadow);
|
||||
set->setValue("styles/marginl", marginl);
|
||||
set->setValue("styles/marginr", marginr);
|
||||
set->setValue("styles/marginv", marginv);
|
||||
}
|
||||
|
||||
void AssStyles::load(QSettings * set) {
|
||||
qDebug("AssStyles::load");
|
||||
|
||||
fontname = set->value("styles/fontname", fontname).toString();
|
||||
fontsize = set->value("styles/fontsize", fontsize).toInt();
|
||||
primarycolor = set->value("styles/primarycolor", primarycolor).toInt();
|
||||
backcolor = set->value("styles/backcolor", backcolor).toInt();
|
||||
bold = set->value("styles/bold", bold).toBool();
|
||||
italic = set->value("styles/italic", italic).toBool();
|
||||
halignment = set->value("styles/halignment", halignment).toInt();
|
||||
valignment = set->value("styles/valignment", valignment).toInt();
|
||||
borderstyle = set->value("styles/borderstyle", borderstyle).toInt();
|
||||
outline = set->value("styles/outline", outline).toInt();
|
||||
shadow = set->value("styles/shadow", shadow).toInt();
|
||||
marginl = set->value("styles/marginl", marginl).toInt();
|
||||
marginr = set->value("styles/marginr", marginr).toInt();
|
||||
marginv = set->value("styles/marginv", marginv).toInt();
|
||||
}
|
||||
|
||||
bool AssStyles::exportStyles(const QString & filename) {
|
||||
qDebug("AssStyles::exportStyles: filename: %s", filename.toUtf8().constData());
|
||||
|
||||
QFile f(filename);
|
||||
if (f.open(QFile::WriteOnly)) {
|
||||
QTextStream out(&f);
|
||||
|
||||
int alignment = halignment;
|
||||
if (valignment == 1) alignment += 3; // Middle
|
||||
else
|
||||
if (valignment == 2) alignment += 6; // Top
|
||||
|
||||
out << "[Script Info]" << endl;
|
||||
out << "ScriptType: v4.00+" << endl;
|
||||
out << "Collisions: Normal" << endl;
|
||||
out << endl;
|
||||
out << "[V4+ Styles]" << endl;
|
||||
out << "Format: Name, Fontname, Fontsize, PrimaryColour, BackColour, Bold, Italic, Alignment, BorderStyle, Outline, Shadow, MarginL, MarginR, MarginV" << endl;
|
||||
out << "Style: Default,";
|
||||
out << fontname << "," ;
|
||||
out << fontsize << "," ;
|
||||
out << "&H" << ColorUtils::colorToAABBGGRR(primarycolor) << "," ;
|
||||
out << "&H" << ColorUtils::colorToAABBGGRR(backcolor) << "," ;
|
||||
out << (bold ? -1 : 0) << "," ;
|
||||
out << (italic ? -1 : 0) << "," ;
|
||||
out << alignment << "," ;
|
||||
out << borderstyle << "," ;
|
||||
out << outline << "," ;
|
||||
out << shadow << "," ;
|
||||
out << marginl << "," ;
|
||||
out << marginr << "," ;
|
||||
out << marginv;
|
||||
out << endl;
|
||||
|
||||
f.close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
52
retroshare-gui/src/gui/plugins/smplayer_plugin/assstyles.h
Normal file
52
retroshare-gui/src/gui/plugins/smplayer_plugin/assstyles.h
Normal file
@ -0,0 +1,52 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 _ASSSTYLES_H_
|
||||
#define _ASSSTYLES_H_
|
||||
|
||||
#include <QString>
|
||||
|
||||
class QSettings;
|
||||
|
||||
class AssStyles {
|
||||
|
||||
public:
|
||||
AssStyles();
|
||||
|
||||
QString fontname;
|
||||
int fontsize;
|
||||
unsigned int primarycolor;
|
||||
unsigned int backcolor;
|
||||
bool bold;
|
||||
bool italic;
|
||||
int halignment;
|
||||
int valignment;
|
||||
int borderstyle;
|
||||
int outline;
|
||||
int shadow;
|
||||
int marginl;
|
||||
int marginr;
|
||||
int marginv;
|
||||
|
||||
void save(QSettings * set);
|
||||
void load(QSettings * set);
|
||||
|
||||
bool exportStyles(const QString & filename);
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,140 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 "audioequalizer.h"
|
||||
#include "eqslider.h"
|
||||
#include "images.h"
|
||||
#include "preferences.h"
|
||||
#include "global.h"
|
||||
#include <QLayout>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
|
||||
using namespace Global;
|
||||
|
||||
AudioEqualizer::AudioEqualizer( QWidget* parent, Qt::WindowFlags f)
|
||||
: QWidget(parent, f)
|
||||
{
|
||||
QBoxLayout *bl = new QHBoxLayout; //(0, 4, 2);
|
||||
|
||||
for (int n = 0; n < 10; n++) {
|
||||
eq[n] = new EqSlider(this);
|
||||
eq[n]->setIcon( QPixmap() );
|
||||
eq[n]->sliderWidget()->setRange(-120, 120);
|
||||
bl->addWidget(eq[n]);
|
||||
}
|
||||
|
||||
reset_button = new QPushButton( "&Reset", this);
|
||||
connect( reset_button, SIGNAL(clicked()), this, SLOT(reset()) );
|
||||
|
||||
set_default_button = new QPushButton( "&Set as default values", this );
|
||||
connect( set_default_button, SIGNAL(clicked()), this, SLOT(setDefaults()) );
|
||||
|
||||
apply_button = new QPushButton( "&Apply", this );
|
||||
connect( apply_button, SIGNAL(clicked()), this, SLOT(applyButtonClicked()) );
|
||||
|
||||
QBoxLayout *button_layout = new QHBoxLayout; //(0, 4, 2);
|
||||
button_layout->addStretch();
|
||||
button_layout->addWidget(apply_button);
|
||||
button_layout->addWidget(reset_button);
|
||||
button_layout->addWidget(set_default_button);
|
||||
|
||||
QBoxLayout *layout = new QVBoxLayout(this); //, 4, 2);
|
||||
layout->addLayout(bl);
|
||||
layout->addLayout(button_layout);
|
||||
|
||||
retranslateStrings();
|
||||
|
||||
adjustSize();
|
||||
//setFixedSize( sizeHint() );
|
||||
}
|
||||
|
||||
AudioEqualizer::~AudioEqualizer() {
|
||||
}
|
||||
|
||||
void AudioEqualizer::retranslateStrings() {
|
||||
setWindowTitle( tr("Audio Equalizer") );
|
||||
setWindowIcon( Images::icon("logo") );
|
||||
|
||||
eq[0]->setLabel( tr("31.25 Hz") );
|
||||
eq[1]->setLabel( tr("62.50 Hz") );
|
||||
eq[2]->setLabel( tr("125.0 Hz") );
|
||||
eq[3]->setLabel( tr("250.0 Hz") );
|
||||
eq[4]->setLabel( tr("500.0 Hz") );
|
||||
eq[5]->setLabel( tr("1.000 kHz") );
|
||||
eq[6]->setLabel( tr("2.000 kHz") );
|
||||
eq[7]->setLabel( tr("4.000 kHz") );
|
||||
eq[8]->setLabel( tr("8.000 kHz") );
|
||||
eq[9]->setLabel( tr("16.00 kHz") );
|
||||
|
||||
apply_button->setText( tr("&Apply") );
|
||||
reset_button->setText( tr("&Reset") );
|
||||
set_default_button->setText( tr("&Set as default values") );
|
||||
|
||||
// What's this help:
|
||||
set_default_button->setWhatsThis(
|
||||
tr("Use the current values as default values for new videos.") );
|
||||
|
||||
reset_button->setWhatsThis( tr("Set all controls to zero.") );
|
||||
|
||||
}
|
||||
|
||||
void AudioEqualizer::reset() {
|
||||
for (int n = 0; n < 10; n++) {
|
||||
eq[n]->setValue(0);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioEqualizer::setDefaults() {
|
||||
AudioEqualizerList l;
|
||||
for (int n = 0; n < 10; n++) {
|
||||
l << eq[n]->value();
|
||||
}
|
||||
pref->initial_audio_equalizer = l;
|
||||
|
||||
QMessageBox::information(this, tr("Information"),
|
||||
tr("The current values have been stored to be "
|
||||
"used as default.") );
|
||||
}
|
||||
|
||||
void AudioEqualizer::applyButtonClicked() {
|
||||
AudioEqualizerList l;
|
||||
for (int n = 0; n < 10; n++) {
|
||||
l << eq[n]->value();
|
||||
}
|
||||
emit applyClicked( l );
|
||||
}
|
||||
|
||||
void AudioEqualizer::hideEvent( QHideEvent * ) {
|
||||
emit visibilityChanged();
|
||||
}
|
||||
|
||||
void AudioEqualizer::showEvent( QShowEvent * ) {
|
||||
emit visibilityChanged();
|
||||
}
|
||||
|
||||
// Language change stuff
|
||||
void AudioEqualizer::changeEvent(QEvent *e) {
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
retranslateStrings();
|
||||
} else {
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_audioequalizer.cpp"
|
@ -0,0 +1,67 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 _AUDIOOEQUALIZER_H_
|
||||
#define _AUDIOOEQUALIZER_H_
|
||||
|
||||
#include <QWidget>
|
||||
#include <QHideEvent>
|
||||
#include <QShowEvent>
|
||||
#include "audioequalizerlist.h"
|
||||
|
||||
class QPushButton;
|
||||
class EqSlider;
|
||||
|
||||
class AudioEqualizer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AudioEqualizer( QWidget* parent = 0, Qt::WindowFlags f = Qt::Dialog );
|
||||
~AudioEqualizer();
|
||||
|
||||
EqSlider * eq[10];
|
||||
|
||||
signals:
|
||||
void visibilityChanged();
|
||||
void applyClicked(AudioEqualizerList new_values);
|
||||
|
||||
public slots:
|
||||
void reset();
|
||||
void setDefaults();
|
||||
|
||||
protected slots:
|
||||
void applyButtonClicked();
|
||||
|
||||
protected:
|
||||
virtual void hideEvent( QHideEvent * );
|
||||
virtual void showEvent( QShowEvent * );
|
||||
|
||||
protected:
|
||||
virtual void retranslateStrings();
|
||||
virtual void changeEvent ( QEvent * event ) ;
|
||||
|
||||
protected:
|
||||
QPushButton * apply_button;
|
||||
QPushButton * reset_button;
|
||||
QPushButton * set_default_button;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,27 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 _AUDIOEQUALIZERLIST_H_
|
||||
#define _AUDIOEQUALIZERLIST_H_
|
||||
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
|
||||
typedef QList<QVariant> AudioEqualizerList;
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -20,11 +20,13 @@
|
||||
#define _BASEGUI_H_
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QNetworkProxy>
|
||||
#include "mediadata.h"
|
||||
#include "mediasettings.h"
|
||||
#include "preferences.h"
|
||||
#include "core.h"
|
||||
#include "config.h"
|
||||
#include "guiconfig.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
/* Disable screensaver by event */
|
||||
@ -39,9 +41,11 @@ class MplayerWindow;
|
||||
class QLabel;
|
||||
class FilePropertiesDialog;
|
||||
class VideoEqualizer;
|
||||
class AudioEqualizer;
|
||||
class FindSubtitlesWindow;
|
||||
class VideoPreview;
|
||||
class Playlist;
|
||||
|
||||
class Recents;
|
||||
class MyAction;
|
||||
class MyActionGroup;
|
||||
|
||||
@ -65,6 +69,12 @@ public:
|
||||
//! true or false.
|
||||
void runActions(QString actions);
|
||||
|
||||
//! Execute all the actions after the video has started to play
|
||||
void runActionsLater(QString actions) { pending_actions_to_run = actions; };
|
||||
|
||||
//! Saves the line from the smplayer output
|
||||
void recordSmplayerLog(QString line);
|
||||
|
||||
public slots:
|
||||
virtual void open(QString file); // Generic open, autodetect type.
|
||||
virtual void openFile();
|
||||
@ -82,21 +92,33 @@ public slots:
|
||||
|
||||
virtual void helpFAQ();
|
||||
virtual void helpCLOptions();
|
||||
virtual void helpTips();
|
||||
virtual void helpAbout();
|
||||
virtual void helpAboutQt();
|
||||
|
||||
virtual void loadSub();
|
||||
virtual void loadAudioFile(); // Load external audio file
|
||||
|
||||
void setInitialSubtitle(const QString & subtitle_file);
|
||||
|
||||
virtual void showFindSubtitlesDialog();
|
||||
virtual void openUploadSubtitlesPage(); //turbos
|
||||
|
||||
virtual void showVideoPreviewDialog();
|
||||
|
||||
virtual void showPlaylist();
|
||||
virtual void showPlaylist(bool b);
|
||||
virtual void showEqualizer();
|
||||
virtual void showEqualizer(bool b);
|
||||
virtual void showVideoEqualizer();
|
||||
virtual void showVideoEqualizer(bool b);
|
||||
virtual void showAudioEqualizer();
|
||||
virtual void showAudioEqualizer(bool b);
|
||||
virtual void showMplayerLog();
|
||||
virtual void showLog();
|
||||
virtual void showPreferencesDialog();
|
||||
virtual void showFilePropertiesDialog();
|
||||
|
||||
virtual void showGotoDialog();
|
||||
|
||||
virtual void exitFullscreen();
|
||||
virtual void toggleFullscreen();
|
||||
virtual void toggleFullscreen(bool);
|
||||
@ -104,8 +126,9 @@ public slots:
|
||||
virtual void toggleCompactMode();
|
||||
virtual void toggleCompactMode(bool);
|
||||
|
||||
virtual void toggleStayOnTop();
|
||||
virtual void toggleStayOnTop(bool);
|
||||
void setStayOnTop(bool b);
|
||||
virtual void changeStayOnTop(int);
|
||||
virtual void checkStayOnTop(Core::State);
|
||||
|
||||
virtual void toggleFrameCounter();
|
||||
virtual void toggleFrameCounter(bool);
|
||||
@ -131,13 +154,23 @@ protected slots:
|
||||
|
||||
virtual void initializeMenus();
|
||||
virtual void updateWidgets();
|
||||
virtual void updateEqualizer();
|
||||
virtual void updateVideoEqualizer();
|
||||
virtual void updateAudioEqualizer();
|
||||
|
||||
virtual void newMediaLoaded();
|
||||
virtual void updateMediaInfo();
|
||||
|
||||
void checkPendingActionsToRun();
|
||||
|
||||
#if REPORT_OLD_MPLAYER
|
||||
void checkMplayerVersion();
|
||||
void displayWarningAboutOldMplayer();
|
||||
#endif
|
||||
|
||||
#if AUTODISABLE_ACTIONS
|
||||
virtual void enableActionsOnPlaying();
|
||||
virtual void disableActionsOnStop();
|
||||
#endif
|
||||
|
||||
virtual void resizeWindow(int w, int h);
|
||||
virtual void hidePanel();
|
||||
@ -148,16 +181,19 @@ protected slots:
|
||||
//! You can call this slot to jump to the specified percentage in the video, while dragging the slider.
|
||||
virtual void goToPosOnDragging(int);
|
||||
|
||||
virtual void showPopupMenu();
|
||||
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 rightClickFunction();
|
||||
virtual void doubleClickFunction();
|
||||
virtual void middleClickFunction();
|
||||
virtual void xbutton1ClickFunction();
|
||||
virtual void xbutton2ClickFunction();
|
||||
virtual void processFunction(QString function);
|
||||
|
||||
virtual void dragEnterEvent( QDragEnterEvent * ) ;
|
||||
@ -195,18 +231,23 @@ protected slots:
|
||||
virtual void changeStyleSheet(QString style);
|
||||
#endif
|
||||
|
||||
#if NEW_RESIZE_CODE
|
||||
void calculateDiff(); //!< Updates diff_size
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
/* Disable screensaver by event */
|
||||
void clear_just_stopped();
|
||||
#endif
|
||||
|
||||
//! Clears the mplayer log
|
||||
void clearMplayerLog();
|
||||
|
||||
//! Saves the line from the mplayer output
|
||||
void recordMplayerLog(QString line);
|
||||
|
||||
//! Saves the mplayer log to a file every time a file is loaded
|
||||
void autosaveMplayerLog();
|
||||
|
||||
signals:
|
||||
void frameChanged(int);
|
||||
void timeChanged(double, int, QString);
|
||||
void timeChanged(QString time_ready_to_print);
|
||||
|
||||
void cursorNearTop(QPoint);
|
||||
void cursorNearBottom(QPoint);
|
||||
@ -242,6 +283,7 @@ protected:
|
||||
void createCore();
|
||||
void createMplayerWindow();
|
||||
void createVideoEqualizer();
|
||||
void createAudioEqualizer();
|
||||
void createPlaylist();
|
||||
void createPanel();
|
||||
void createPreferencesDialog();
|
||||
@ -249,12 +291,20 @@ protected:
|
||||
void setDataToFileProperties();
|
||||
void initializeGui();
|
||||
void createActions();
|
||||
#if AUTODISABLE_ACTIONS
|
||||
void setActionsEnabled(bool);
|
||||
#endif
|
||||
void createMenus();
|
||||
void updateRecents();
|
||||
void configureDiscDevices();
|
||||
/* virtual void closeEvent( QCloseEvent * e ); */
|
||||
|
||||
//! Returns a proxy created from the user's preferences
|
||||
QNetworkProxy userProxy();
|
||||
|
||||
protected:
|
||||
virtual void wheelEvent( QWheelEvent * e ) ;
|
||||
|
||||
protected:
|
||||
QWidget * panel;
|
||||
|
||||
@ -284,21 +334,27 @@ protected:
|
||||
MyAction * forward2Act;
|
||||
MyAction * forward3Act;
|
||||
MyAction * repeatAct;
|
||||
MyAction * gotoAct;
|
||||
|
||||
// Menu Speed
|
||||
MyAction * normalSpeedAct;
|
||||
MyAction * halveSpeedAct;
|
||||
MyAction * doubleSpeedAct;
|
||||
MyAction * decSpeedAct;
|
||||
MyAction * incSpeedAct;
|
||||
MyAction * decSpeed10Act;
|
||||
MyAction * incSpeed10Act;
|
||||
MyAction * decSpeed4Act;
|
||||
MyAction * incSpeed4Act;
|
||||
MyAction * decSpeed1Act;
|
||||
MyAction * incSpeed1Act;
|
||||
|
||||
// Menu Video
|
||||
MyAction * fullscreenAct;
|
||||
MyAction * compactAct;
|
||||
MyAction * equalizerAct;
|
||||
MyAction * videoEqualizerAct;
|
||||
MyAction * screenshotAct;
|
||||
MyAction * onTopAct;
|
||||
MyAction * videoPreviewAct;
|
||||
MyAction * flipAct;
|
||||
MyAction * mirrorAct;
|
||||
MyAction * postProcessingAct;
|
||||
MyAction * phaseAct;
|
||||
MyAction * deblockAct;
|
||||
@ -310,6 +366,7 @@ protected:
|
||||
MyAction * upscaleAct;
|
||||
|
||||
// Menu Audio
|
||||
MyAction * audioEqualizerAct;
|
||||
MyAction * muteAct;
|
||||
MyAction * decVolumeAct;
|
||||
MyAction * incVolumeAct;
|
||||
@ -335,6 +392,8 @@ protected:
|
||||
MyAction * useAssAct;
|
||||
MyAction * useClosedCaptionAct;
|
||||
MyAction * useForcedSubsOnlyAct;
|
||||
MyAction * showFindSubtitlesDialogAct;
|
||||
MyAction * openUploadSubtitlesPageAct;//turbos
|
||||
|
||||
// Menu Options
|
||||
MyAction * showPlaylistAct;
|
||||
@ -347,7 +406,8 @@ protected:
|
||||
|
||||
// Menu Help
|
||||
MyAction * showFAQAct;
|
||||
MyAction * showCLOptions; // Command line options
|
||||
MyAction * showCLOptionsAct; // Command line options
|
||||
MyAction * showTipsAct;
|
||||
MyAction * aboutQtAct;
|
||||
MyAction * aboutThisAct;
|
||||
|
||||
@ -372,12 +432,18 @@ protected:
|
||||
MyAction * incSaturationAct;
|
||||
MyAction * decGammaAct;
|
||||
MyAction * incGammaAct;
|
||||
MyAction * nextVideoAct;
|
||||
MyAction * nextAudioAct;
|
||||
MyAction * nextSubtitleAct;
|
||||
MyAction * nextChapterAct;
|
||||
MyAction * prevChapterAct;
|
||||
MyAction * doubleSizeAct;
|
||||
MyAction * resetVideoEqualizerAct;
|
||||
MyAction * resetAudioEqualizerAct;
|
||||
MyAction * showContextMenuAct;
|
||||
#if NEW_ASPECT_CODE
|
||||
MyAction * nextAspectAct;
|
||||
#endif
|
||||
|
||||
// Moving and zoom
|
||||
MyAction * moveUpAct;
|
||||
@ -387,6 +453,9 @@ protected:
|
||||
MyAction * incZoomAct;
|
||||
MyAction * decZoomAct;
|
||||
MyAction * resetZoomAct;
|
||||
MyAction * autoZoomAct;
|
||||
MyAction * autoZoom169Act;
|
||||
MyAction * autoZoom235Act;
|
||||
|
||||
// OSD Action Group
|
||||
MyActionGroup * osdGroup;
|
||||
@ -425,6 +494,10 @@ protected:
|
||||
// Aspect Action Group
|
||||
MyActionGroup * aspectGroup;
|
||||
MyAction * aspectDetectAct;
|
||||
#if NEW_ASPECT_CODE
|
||||
MyAction * aspectNoneAct;
|
||||
MyAction * aspect11Act; // 1:1
|
||||
#endif
|
||||
MyAction * aspect43Act;
|
||||
MyAction * aspect54Act;
|
||||
MyAction * aspect149Act;
|
||||
@ -446,6 +519,18 @@ protected:
|
||||
MyAction * rotateCounterclockwiseAct;
|
||||
MyAction * rotateCounterclockwiseFlipAct;
|
||||
|
||||
// Menu StayOnTop
|
||||
MyActionGroup * onTopActionGroup;
|
||||
MyAction * onTopAlwaysAct;
|
||||
MyAction * onTopNeverAct;
|
||||
MyAction * onTopWhilePlayingAct;
|
||||
|
||||
#if USE_ADAPTER
|
||||
// Screen Group
|
||||
MyActionGroup * screenGroup;
|
||||
MyAction * screenDefaultAct;
|
||||
#endif
|
||||
|
||||
// Audio Channels Action Group
|
||||
MyActionGroup * channelsGroup;
|
||||
/* MyAction * channelsDefaultAct; */
|
||||
@ -460,12 +545,23 @@ protected:
|
||||
MyAction * rightChannelAct;
|
||||
|
||||
// Other groups
|
||||
MyActionGroup * videoTrackGroup;
|
||||
MyActionGroup * audioTrackGroup;
|
||||
MyActionGroup * subtitleTrackGroup;
|
||||
MyActionGroup * titleGroup;
|
||||
MyActionGroup * angleGroup;
|
||||
MyActionGroup * chapterGroup;
|
||||
|
||||
#if DVDNAV_SUPPORT
|
||||
MyAction * dvdnavUpAct;
|
||||
MyAction * dvdnavDownAct;
|
||||
MyAction * dvdnavLeftAct;
|
||||
MyAction * dvdnavRightAct;
|
||||
MyAction * dvdnavMenuAct;
|
||||
MyAction * dvdnavSelectAct;
|
||||
MyAction * dvdnavPrevAct;
|
||||
MyAction * dvdnavMouseAct;
|
||||
#endif
|
||||
|
||||
// MENUS
|
||||
QMenu *openMenu;
|
||||
@ -478,6 +574,7 @@ protected:
|
||||
QMenu *helpMenu;
|
||||
|
||||
QMenu * subtitlestrack_menu;
|
||||
QMenu * videotrack_menu;
|
||||
QMenu * audiotrack_menu;
|
||||
QMenu * titles_menu;
|
||||
QMenu * chapters_menu;
|
||||
@ -496,6 +593,10 @@ protected:
|
||||
QMenu * logs_menu;
|
||||
QMenu * panscan_menu;
|
||||
QMenu * rotate_menu;
|
||||
QMenu * ontop_menu;
|
||||
#if USE_ADAPTER
|
||||
QMenu * screen_menu;
|
||||
#endif
|
||||
|
||||
QMenu * popup;
|
||||
QMenu * recentfiles_menu;
|
||||
@ -507,21 +608,23 @@ protected:
|
||||
PreferencesDialog *pref_dialog;
|
||||
FilePropertiesDialog *file_dialog;
|
||||
Playlist * playlist;
|
||||
VideoEqualizer * equalizer;
|
||||
VideoEqualizer * video_equalizer;
|
||||
AudioEqualizer * audio_equalizer;
|
||||
FindSubtitlesWindow * find_subs_dialog;
|
||||
VideoPreview * video_preview;
|
||||
|
||||
Core * core;
|
||||
MplayerWindow *mplayerwindow;
|
||||
|
||||
Recents * recents;
|
||||
|
||||
MyServer * server;
|
||||
|
||||
QStringList actions_list;
|
||||
|
||||
QString pending_actions_to_run;
|
||||
|
||||
private:
|
||||
QString default_style;
|
||||
|
||||
int last_second;
|
||||
bool near_top;
|
||||
bool near_bottom;
|
||||
|
||||
@ -531,14 +634,15 @@ private:
|
||||
QSize win_size;
|
||||
bool was_maximized;
|
||||
|
||||
#if NEW_RESIZE_CODE
|
||||
QSize diff_size; //!< Main window size - panel size
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
/* Disable screensaver by event */
|
||||
bool just_stopped;
|
||||
#endif
|
||||
|
||||
QString mplayer_log;
|
||||
QString smplayer_log;
|
||||
|
||||
bool ignore_show_hide_events;
|
||||
};
|
||||
|
||||
#endif
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "baseguiplus.h"
|
||||
#include "config.h"
|
||||
#include "myaction.h"
|
||||
#include "global.h"
|
||||
#include "images.h"
|
||||
@ -26,6 +27,8 @@
|
||||
|
||||
#include <QMenu>
|
||||
#include <QCloseEvent>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
#include <QDockWidget>
|
||||
@ -38,11 +41,21 @@
|
||||
using namespace Global;
|
||||
|
||||
BaseGuiPlus::BaseGuiPlus( QWidget * parent, Qt::WindowFlags flags )
|
||||
: BaseGui( parent, flags ),
|
||||
mainwindow_visible(true),
|
||||
//infowindow_visible(false),
|
||||
trayicon_playlist_was_visible(false)
|
||||
: BaseGui( parent, flags )
|
||||
{
|
||||
// Initialize variables
|
||||
mainwindow_visible = true;
|
||||
//infowindow_visible = false;
|
||||
trayicon_playlist_was_visible = false;
|
||||
widgets_size = 0;
|
||||
#if DOCK_PLAYLIST
|
||||
fullscreen_playlist_was_visible = false;
|
||||
fullscreen_playlist_was_floating = false;
|
||||
compact_playlist_was_visible = false;
|
||||
ignore_playlist_events = false;
|
||||
#endif
|
||||
|
||||
|
||||
mainwindow_pos = pos();
|
||||
|
||||
tray = new QSystemTrayIcon( Images::icon("logo", 22), this );
|
||||
@ -65,11 +78,13 @@ BaseGuiPlus::BaseGuiPlus( QWidget * parent, Qt::WindowFlags flags )
|
||||
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(openDirectoryAct);
|
||||
context_menu->addAction(openDVDAct);
|
||||
context_menu->addAction(openURLAct);
|
||||
context_menu->addSeparator();
|
||||
@ -89,8 +104,8 @@ BaseGuiPlus::BaseGuiPlus( QWidget * parent, Qt::WindowFlags flags )
|
||||
#if DOCK_PLAYLIST
|
||||
// Playlistdock
|
||||
playlistdock = new PlaylistDock(this);
|
||||
playlistdock->setObjectName("playlist");
|
||||
playlistdock->setFloating(true);
|
||||
playlistdock->setObjectName("playlistdock");
|
||||
playlistdock->setFloating(false); // To avoid that the playlist is visible for a moment
|
||||
playlistdock->setWidget(playlist);
|
||||
playlistdock->setAllowedAreas(Qt::TopDockWidgetArea |
|
||||
Qt::BottomDockWidgetArea
|
||||
@ -101,13 +116,19 @@ BaseGuiPlus::BaseGuiPlus( QWidget * parent, Qt::WindowFlags flags )
|
||||
);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, playlistdock);
|
||||
playlistdock->hide();
|
||||
playlistdock->setFloating(true); // Floating by default
|
||||
|
||||
connect( playlistdock, SIGNAL(closed()), this, SLOT(playlistClosed()) );
|
||||
connect( playlistdock, SIGNAL(docked()), this, SLOT(stretchWindow()) );
|
||||
connect( playlistdock, SIGNAL(undocked()), this, SLOT(shrinkWindow()) );
|
||||
#if USE_DOCK_TOPLEVEL_EVENT
|
||||
connect( playlistdock, SIGNAL(topLevelChanged(bool)),
|
||||
this, SLOT(dockTopLevelChanged(bool)) );
|
||||
#else
|
||||
connect( playlistdock, SIGNAL(visibilityChanged(bool)),
|
||||
this, SLOT(dockVisibilityChanged(bool)) );
|
||||
#endif // USE_DOCK_TOPLEVEL_EVENT
|
||||
|
||||
ignore_playlist_events = false;
|
||||
#endif
|
||||
#endif // DOCK_PLAYLIST
|
||||
|
||||
retranslateStrings();
|
||||
|
||||
@ -155,7 +176,6 @@ void BaseGuiPlus::closeWindow() {
|
||||
BaseGui::closeWindow();
|
||||
}
|
||||
//tray->hide();
|
||||
hide();
|
||||
|
||||
}
|
||||
|
||||
@ -194,6 +214,15 @@ void BaseGuiPlus::saveConfig() {
|
||||
set->setValue( "show_tray_icon", showTrayAct->isChecked() );
|
||||
set->setValue( "mainwindow_visible", isVisible() );
|
||||
|
||||
set->setValue( "trayicon_playlist_was_visible", trayicon_playlist_was_visible );
|
||||
set->setValue( "widgets_size", widgets_size );
|
||||
#if DOCK_PLAYLIST
|
||||
set->setValue( "fullscreen_playlist_was_visible", fullscreen_playlist_was_visible );
|
||||
set->setValue( "fullscreen_playlist_was_floating", fullscreen_playlist_was_floating );
|
||||
set->setValue( "compact_playlist_was_visible", compact_playlist_was_visible );
|
||||
set->setValue( "ignore_playlist_events", ignore_playlist_events );
|
||||
#endif
|
||||
|
||||
/*
|
||||
#if DOCK_PLAYLIST
|
||||
set->setValue( "playlist_and_toolbars_state", saveState() );
|
||||
@ -216,6 +245,15 @@ void BaseGuiPlus::loadConfig() {
|
||||
|
||||
mainwindow_visible = set->value("mainwindow_visible", true).toBool();
|
||||
|
||||
trayicon_playlist_was_visible = set->value( "trayicon_playlist_was_visible", trayicon_playlist_was_visible ).toBool();
|
||||
widgets_size = set->value( "widgets_size", widgets_size ).toInt();
|
||||
#if DOCK_PLAYLIST
|
||||
fullscreen_playlist_was_visible = set->value( "fullscreen_playlist_was_visible", fullscreen_playlist_was_visible ).toBool();
|
||||
fullscreen_playlist_was_floating = set->value( "fullscreen_playlist_was_floating", fullscreen_playlist_was_floating ).toBool();
|
||||
compact_playlist_was_visible = set->value( "compact_playlist_was_visible", compact_playlist_was_visible ).toBool();
|
||||
ignore_playlist_events = set->value( "ignore_playlist_events", ignore_playlist_events ).toBool();
|
||||
#endif
|
||||
|
||||
/*
|
||||
#if DOCK_PLAYLIST
|
||||
restoreState( set->value( "playlist_and_toolbars_state" ).toByteArray() );
|
||||
@ -331,14 +369,22 @@ void BaseGuiPlus::aboutToEnterFullscreen() {
|
||||
BaseGui::aboutToEnterFullscreen();
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
int playlist_screen = QApplication::desktop()->screenNumber(playlistdock);
|
||||
int mainwindow_screen = QApplication::desktop()->screenNumber(this);
|
||||
qDebug("BaseGuiPlus::aboutToEnterFullscreen: mainwindow screen: %d, playlist screen: %d", mainwindow_screen, playlist_screen);
|
||||
|
||||
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();
|
||||
|
||||
// Hide the playlist if it's in the same screen as the main window
|
||||
if ((playlist_screen == mainwindow_screen) /* ||
|
||||
(!fullscreen_playlist_was_floating) */ )
|
||||
{
|
||||
playlistdock->setFloating(true);
|
||||
playlistdock->hide();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -352,26 +398,35 @@ void BaseGuiPlus::aboutToExitFullscreen() {
|
||||
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
|
||||
|
||||
widgets_size = height() - panel->height();
|
||||
qDebug("BaseGuiPlus::aboutToEnterCompactMode: widgets_size: %d", widgets_size);
|
||||
|
||||
BaseGui::aboutToEnterCompactMode();
|
||||
|
||||
if (pref->resize_method == Preferences::Always) {
|
||||
resize( width(), height() - widgets_size );
|
||||
}
|
||||
}
|
||||
|
||||
void BaseGuiPlus::aboutToExitCompactMode() {
|
||||
BaseGui::aboutToExitCompactMode();
|
||||
|
||||
if (pref->resize_method == Preferences::Always) {
|
||||
resize( width(), height() + widgets_size );
|
||||
}
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
if (compact_playlist_was_visible)
|
||||
playlistdock->show();
|
||||
@ -380,19 +435,55 @@ void BaseGuiPlus::aboutToExitCompactMode() {
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
void BaseGuiPlus::showPlaylist(bool b) {
|
||||
qDebug("BaseGuiPlus::showPlaylist: %d", b);
|
||||
qDebug("BaseGuiPlus::showPlaylist (before): playlist visible: %d", playlistdock->isVisible());
|
||||
qDebug("BaseGuiPlus::showPlaylist (before): playlist position: %d, %d", playlistdock->pos().x(), playlistdock->pos().y());
|
||||
qDebug("BaseGuiPlus::showPlaylist (before): playlist size: %d x %d", playlistdock->size().width(), playlistdock->size().height());
|
||||
|
||||
if ( !b ) {
|
||||
playlistdock->hide();
|
||||
} else {
|
||||
exitFullscreenIfNeeded();
|
||||
playlistdock->show();
|
||||
|
||||
// Check if playlist is outside of the screen
|
||||
if (playlistdock->isFloating()) {
|
||||
if (!DesktopInfo::isInsideScreen(playlistdock)) {
|
||||
qWarning("BaseGuiPlus::showPlaylist: playlist is outside of the screen");
|
||||
playlistdock->move(0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
//updateWidgets();
|
||||
|
||||
qDebug("BaseGuiPlus::showPlaylist (after): playlist visible: %d", playlistdock->isVisible());
|
||||
qDebug("BaseGuiPlus::showPlaylist (after): playlist position: %d, %d", playlistdock->pos().x(), playlistdock->pos().y());
|
||||
qDebug("BaseGuiPlus::showPlaylist (after): playlist size: %d x %d", playlistdock->size().width(), playlistdock->size().height());
|
||||
|
||||
}
|
||||
|
||||
void BaseGuiPlus::playlistClosed() {
|
||||
showPlaylistAct->setChecked(false);
|
||||
}
|
||||
|
||||
#if !USE_DOCK_TOPLEVEL_EVENT
|
||||
void BaseGuiPlus::dockVisibilityChanged(bool visible) {
|
||||
qDebug("BaseGuiPlus::dockVisibilityChanged: %d", visible);
|
||||
|
||||
if (!playlistdock->isFloating()) {
|
||||
if (!visible) shrinkWindow(); else stretchWindow();
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void BaseGuiPlus::dockTopLevelChanged(bool floating) {
|
||||
qDebug("BaseGuiPlus::dockTopLevelChanged: %d", floating);
|
||||
|
||||
if (floating) shrinkWindow(); else stretchWindow();
|
||||
}
|
||||
#endif
|
||||
|
||||
void BaseGuiPlus::stretchWindow() {
|
||||
qDebug("BaseGuiPlus::stretchWindow");
|
||||
if ((ignore_playlist_events) || (pref->resize_method!=Preferences::Always)) return;
|
||||
@ -458,8 +549,19 @@ void BaseGuiPlus::shrinkWindow() {
|
||||
// Convenience functions intended for other GUI's
|
||||
TimeSliderAction * BaseGuiPlus::createTimeSliderAction(QWidget * parent) {
|
||||
TimeSliderAction * timeslider_action = new TimeSliderAction( parent );
|
||||
timeslider_action->setObjectName("timeslider_action");
|
||||
|
||||
#ifdef SEEKBAR_RESOLUTION
|
||||
connect( timeslider_action, SIGNAL( posChanged(int) ),
|
||||
core, SLOT(goToPosition(int)) );
|
||||
connect( core, SIGNAL(positionChanged(int)),
|
||||
timeslider_action, SLOT(setPos(int)) );
|
||||
#else
|
||||
connect( timeslider_action, SIGNAL( posChanged(int) ),
|
||||
core, SLOT(goToPos(int)) );
|
||||
connect( core, SIGNAL(posChanged(int)),
|
||||
timeslider_action, SLOT(setPos(int)) );
|
||||
#endif
|
||||
connect( timeslider_action, SIGNAL( draggingPos(int) ),
|
||||
this, SLOT(displayGotoTime(int)) );
|
||||
#if ENABLE_DELAYED_DRAGGING
|
||||
@ -476,6 +578,8 @@ TimeSliderAction * BaseGuiPlus::createTimeSliderAction(QWidget * parent) {
|
||||
|
||||
VolumeSliderAction * BaseGuiPlus::createVolumeSliderAction(QWidget * parent) {
|
||||
VolumeSliderAction * volumeslider_action = new VolumeSliderAction(parent);
|
||||
volumeslider_action->setObjectName("volumeslider_action");
|
||||
|
||||
connect( volumeslider_action, SIGNAL( valueChanged(int) ),
|
||||
core, SLOT( setVolume(int) ) );
|
||||
connect( core, SIGNAL(volumeChanged(int)),
|
@ -22,7 +22,7 @@
|
||||
#include "basegui.h"
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QPoint>
|
||||
#include "config.h"
|
||||
#include "guiconfig.h"
|
||||
|
||||
class QMenu;
|
||||
class PlaylistDock;
|
||||
@ -74,6 +74,12 @@ protected slots:
|
||||
virtual void showPlaylist(bool b);
|
||||
void playlistClosed();
|
||||
|
||||
#if !USE_DOCK_TOPLEVEL_EVENT
|
||||
void dockVisibilityChanged(bool visible);
|
||||
#else
|
||||
void dockTopLevelChanged(bool floating);
|
||||
#endif
|
||||
|
||||
void stretchWindow();
|
||||
void shrinkWindow();
|
||||
#endif
|
||||
@ -96,6 +102,8 @@ protected:
|
||||
//QPoint infowindow_pos;
|
||||
//bool infowindow_visible;
|
||||
|
||||
int widgets_size; // To be able to restore the original size after exiting from compact mode
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
PlaylistDock * playlistdock;
|
||||
bool fullscreen_playlist_was_visible;
|
@ -37,8 +37,8 @@ QString CLHelp::formatText(QString s, int col) {
|
||||
}
|
||||
|
||||
while ((pos < col) && (pos != -1)) {
|
||||
last = pos;
|
||||
pos = s.indexOf(" ", pos+1);
|
||||
last = pos;
|
||||
pos = s.indexOf(" ", pos+1);
|
||||
}
|
||||
|
||||
res = res + s.left(last) + "\n";
|
||||
@ -83,15 +83,17 @@ QString CLHelp::formatHelp(QString parameter, QString help, bool html) {
|
||||
QString CLHelp::help(bool html) {
|
||||
QString app_name = QFileInfo(qApp->applicationFilePath()).baseName();
|
||||
|
||||
QString options = QString("%1 [-mini] [-ini-path %2] "
|
||||
QString options = QString("%1 [-minigui] [-defaultgui] [-mpcgui] [-config-path %2] "
|
||||
"[-send-action %3] [-actions %4] "
|
||||
"[-close-at-end] [-no-close-at-end] [-fullscreen] [-no-fullscreen] "
|
||||
"[-sub %5] "
|
||||
"[-add-to-playlist] [-help|--help|-h|-?] "
|
||||
"[[-playlist] %5] [[-playlist] %5]...")
|
||||
"[[-playlist] %6] [[-playlist] %6]...")
|
||||
.arg(app_name)
|
||||
.arg(QObject::tr("directory"))
|
||||
.arg(QObject::tr("action_name"))
|
||||
.arg(QObject::tr("action_list"))
|
||||
.arg(QObject::tr("subtitle_file"))
|
||||
.arg(QObject::tr("media"));
|
||||
|
||||
QString s;
|
||||
@ -108,12 +110,18 @@ QString CLHelp::help(bool html) {
|
||||
s += formatHelp( "-uninstall", QObject::tr(
|
||||
"Restores the old associations and cleans up the registry."), html );
|
||||
#endif
|
||||
s += formatHelp( "-mini", QObject::tr(
|
||||
s += formatHelp( "-minigui", QObject::tr(
|
||||
"opens the mini gui instead of the default one."), html );
|
||||
|
||||
s += formatHelp( "-ini-path", QObject::tr(
|
||||
"specifies the directory for the configuration file "
|
||||
"(smplayer.ini)."), html );
|
||||
s += formatHelp( "-mpcgui", QObject::tr(
|
||||
"opens the mpc gui."), html );
|
||||
|
||||
s += formatHelp( "-defaultgui", QObject::tr(
|
||||
"opens the default gui."), html );
|
||||
|
||||
s += formatHelp( "-config-path", QObject::tr(
|
||||
"specifies the directory where smplayer will store its configuration "
|
||||
"files (smplayer.ini, smplayer_files.ini...)"), html );
|
||||
|
||||
s += formatHelp( "-send-action", QObject::tr(
|
||||
"tries to make a connection to another running instance "
|
||||
@ -142,6 +150,9 @@ QString CLHelp::help(bool html) {
|
||||
s += formatHelp( "-no-fullscreen", QObject::tr(
|
||||
"the video will be played in window mode."), html );
|
||||
|
||||
s += formatHelp( "-sub", QObject::tr(
|
||||
"specifies the subtitle file to be loaded for the first video."), html );
|
||||
|
||||
s += formatHelp( "-help", QObject::tr(
|
||||
"will show this message and then will exit."), html );
|
||||
|
@ -0,0 +1,73 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 "colorutils.h"
|
||||
#include <QWidget>
|
||||
|
||||
QString ColorUtils::colorToRRGGBBAA(unsigned int color) {
|
||||
QColor c;
|
||||
c.setRgb( color );
|
||||
|
||||
QString s;
|
||||
return s.sprintf("%02x%02x%02x00", c.red(), c.green(), c.blue() );
|
||||
}
|
||||
|
||||
QString ColorUtils::colorToRRGGBB(unsigned int color) {
|
||||
QColor c;
|
||||
c.setRgb( color );
|
||||
|
||||
QString s;
|
||||
return s.sprintf("%02x%02x%02x", c.red(), c.green(), c.blue() );
|
||||
}
|
||||
|
||||
QString ColorUtils::colorToRGB(unsigned int color) {
|
||||
QColor c;
|
||||
c.setRgb( color );
|
||||
|
||||
QString s;
|
||||
return s.sprintf("0x%02x%02x%02x", c.blue(), c.green(), c.red() );
|
||||
}
|
||||
|
||||
QString ColorUtils::colorToAABBGGRR(unsigned int color) {
|
||||
QColor c;
|
||||
c.setRgb( color );
|
||||
|
||||
QString s;
|
||||
return s.sprintf("00%02x%02x%02x", c.blue(), c.green(), c.red() );
|
||||
}
|
||||
|
||||
void ColorUtils::setForegroundColor(QWidget * w, const QColor & color) {
|
||||
QPalette p = w->palette();
|
||||
p.setColor(w->foregroundRole(), color);
|
||||
w->setPalette(p);
|
||||
}
|
||||
|
||||
void ColorUtils::setBackgroundColor(QWidget * w, const QColor & color) {
|
||||
QPalette p = w->palette();
|
||||
p.setColor(w->backgroundRole(), color);
|
||||
w->setPalette(p);
|
||||
}
|
||||
|
||||
#if COLOR_OUTPUT_SUPPORT
|
||||
QString ColorUtils::stripColorsTags(QString s) {
|
||||
QRegExp rx_console_colors("\033\\[\\d\\d?;\\d\\d?m");
|
||||
int removePos = rx_console_colors.lastIndexIn(s);
|
||||
removePos += rx_console_colors.matchedLength();
|
||||
return s.remove(0, removePos);
|
||||
}
|
||||
#endif
|
@ -16,16 +16,10 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _HELPER_H_
|
||||
#define _HELPER_H_
|
||||
#ifndef _COLORUTILS_H_
|
||||
#define _COLORUTILS_H_
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
#define COLOR_OUTPUT_SUPPORT 1
|
||||
@ -34,56 +28,10 @@
|
||||
class QWidget;
|
||||
class QColor;
|
||||
|
||||
class Helper
|
||||
{
|
||||
class ColorUtils {
|
||||
|
||||
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();
|
||||
static QString doc(QString file, QString locale = QString::null);
|
||||
|
||||
//! Return the user's home
|
||||
static QString appHomePath();
|
||||
|
||||
static void setIniPath(QString path);
|
||||
static QString iniPath();
|
||||
|
||||
|
||||
// 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();
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
static QString shortPathName(QString long_path);
|
||||
|
||||
//! Enable or disables the screensaver
|
||||
/* static void setScreensaverEnabled(bool b); */
|
||||
#endif
|
||||
|
||||
static void msleep(int ms);
|
||||
|
||||
//! Returns a string suitable to be used for -ass-color
|
||||
static QString colorToRRGGBBAA(unsigned int color);
|
||||
static QString colorToRRGGBB(unsigned int color);
|
||||
@ -91,20 +39,14 @@ public:
|
||||
//! Returns a string suitable to be used for -colorkey
|
||||
static QString colorToRGB(unsigned int color);
|
||||
|
||||
static QString colorToAABBGGRR(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);
|
||||
|
||||
/**
|
||||
** \brief Strip colors and tags from MPlayer output lines
|
||||
**
|
||||
@ -119,10 +61,6 @@ public:
|
||||
static QString stripColorsTags(QString s);
|
||||
#endif
|
||||
|
||||
private:
|
||||
static QString logs;
|
||||
static QString app_path;
|
||||
static QString ini_path;
|
||||
};
|
||||
|
||||
#endif
|
139
retroshare-gui/src/gui/plugins/smplayer_plugin/config.h
Normal file
139
retroshare-gui/src/gui/plugins/smplayer_plugin/config.h
Normal file
@ -0,0 +1,139 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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_
|
||||
|
||||
#include <Qt>
|
||||
|
||||
|
||||
// Activate the new code for aspect ratio
|
||||
|
||||
#define NEW_ASPECT_CODE 1
|
||||
|
||||
|
||||
// STYLE_SWITCHING
|
||||
// if 1, the preferences dialog will have an option to switch
|
||||
// the Qt style
|
||||
|
||||
#define STYLE_SWITCHING 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
|
||||
|
||||
|
||||
// ENABLE_DELAYED_DRAGGING
|
||||
// if 1, sends the dragging position of the time slider
|
||||
// some ms later
|
||||
|
||||
#define ENABLE_DELAYED_DRAGGING 1
|
||||
|
||||
|
||||
// SEEKBAR_RESOLUTION
|
||||
// if SEEKBAR_RESOLUTION is defined, it specified the
|
||||
// maximum value of the time slider
|
||||
|
||||
#define SEEKBAR_RESOLUTION 1000
|
||||
|
||||
|
||||
// SMART_DVD_CHAPTERS
|
||||
// if set to 1, the slave command "chapter" will use if not using a cache,
|
||||
// otherwise mplayer will be restarted and -chapter will be used.
|
||||
|
||||
#define SMART_DVD_CHAPTERS 1
|
||||
|
||||
|
||||
// ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES
|
||||
// if 1, the video window may be hidden when playing audio files
|
||||
// depending on the hide_video_window_on_audio_files option in
|
||||
// the config file
|
||||
|
||||
#define ALLOW_TO_HIDE_VIDEO_WINDOW_ON_AUDIO_FILES 1
|
||||
|
||||
|
||||
// DELAYED_AUDIO_SETUP_ON_STARTUP
|
||||
// if 1, the audio track will be initialized later once the file
|
||||
// has begun to play
|
||||
|
||||
#define DELAYED_AUDIO_SETUP_ON_STARTUP 0
|
||||
|
||||
|
||||
// CHECK_VIDEO_CODEC_FOR_NO_VIDEO
|
||||
// if 1, the video codec will be checked to decide if the file
|
||||
// has video or not. If it's empty it has no video.
|
||||
// If 0, it will check for the line "Video: no video"
|
||||
|
||||
#define CHECK_VIDEO_CODEC_FOR_NO_VIDEO 1
|
||||
|
||||
|
||||
// Just for testing, possibility to disable the use of the colorkey
|
||||
|
||||
#define USE_COLORKEY 1
|
||||
|
||||
|
||||
// USE_MINIMUMSIZE
|
||||
// if 1, the main window will not be smaller than the control widget
|
||||
// size hint or pref->gui_minimum_width.
|
||||
|
||||
#define USE_MINIMUMSIZE 1
|
||||
|
||||
|
||||
// GENERIC_CHAPTER_SUPPORT
|
||||
// if 1, it will use a generic code for chapters which can be used
|
||||
// for all kind of videos, not only DVDs and mkv files.
|
||||
|
||||
#define GENERIC_CHAPTER_SUPPORT 1
|
||||
|
||||
|
||||
// DVDNAV_SUPPORT
|
||||
// if 1, smplayer will be compiled with support for mplayer's dvdnav
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
#define DVDNAV_SUPPORT 1
|
||||
#endif
|
||||
|
||||
|
||||
// Adds or not the "Repaint the background of the video window" option.
|
||||
//#ifndef Q_OS_WIN
|
||||
#define REPAINT_BACKGROUND_OPTION 1
|
||||
//#endif
|
||||
|
||||
|
||||
// Enables/disables the use of -adapter
|
||||
#ifdef Q_OS_WIN
|
||||
#define USE_ADAPTER 1
|
||||
#define OVERLAY_VO "directx"
|
||||
//#define OVERLAY_VO "xv"
|
||||
#endif
|
||||
|
||||
|
||||
// If 1, smplayer will check if mplayer is old
|
||||
// and in that case it will report to the user
|
||||
#ifndef Q_OS_WIN
|
||||
#define REPORT_OLD_MPLAYER 1
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -23,8 +23,16 @@
|
||||
#include <QProcess> // For QProcess::ProcessError
|
||||
#include "mediadata.h"
|
||||
#include "mediasettings.h"
|
||||
#include "mplayerprocess.h"
|
||||
#include "config.h"
|
||||
|
||||
#define NEW_SETTINGS_MANAGEMENT 1
|
||||
|
||||
#ifndef NO_USE_INI_FILES
|
||||
#if NEW_SETTINGS_MANAGEMENT
|
||||
class FileSettingsBase;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class MplayerProcess;
|
||||
class MplayerWindow;
|
||||
@ -47,8 +55,6 @@ public:
|
||||
MediaData mdat;
|
||||
MediaSettings mset;
|
||||
|
||||
QString mplayer_log;
|
||||
|
||||
//! Return the current state
|
||||
State state() { return _state; };
|
||||
|
||||
@ -78,6 +84,10 @@ public slots:
|
||||
void loadSub(const QString & sub);
|
||||
void unloadSub();
|
||||
|
||||
//! Forces to use the specified subtitle file. It's not loaded immediately but stored
|
||||
//! and will be used for the next video. After that the variable is cleared.
|
||||
void setInitialSubtitle(const QString & subtitle_file) { initial_subtitle = subtitle_file; };
|
||||
|
||||
void loadAudioFile(const QString & audiofile);
|
||||
void unloadAudioFile();
|
||||
|
||||
@ -92,8 +102,15 @@ public slots:
|
||||
//! Public restart, for the GUI.
|
||||
void restart();
|
||||
|
||||
//! Reopens the file (no restart)
|
||||
void reload();
|
||||
|
||||
#ifdef SEEKBAR_RESOLUTION
|
||||
void goToPosition( int value );
|
||||
#else
|
||||
void goToPos( int perc );
|
||||
/*void goToSec( double sec );*/
|
||||
#endif
|
||||
void goToSec( double sec );
|
||||
|
||||
void toggleRepeat();
|
||||
void toggleRepeat(bool b);
|
||||
@ -101,6 +118,9 @@ public slots:
|
||||
void toggleFlip();
|
||||
void toggleFlip(bool b);
|
||||
|
||||
void toggleMirror();
|
||||
void toggleMirror(bool b);
|
||||
|
||||
// Audio filters
|
||||
void toggleKaraoke();
|
||||
void toggleKaraoke(bool b);
|
||||
@ -142,8 +162,12 @@ public slots:
|
||||
void wheelDown();
|
||||
|
||||
void setSpeed( double value );
|
||||
void incSpeed();
|
||||
void decSpeed();
|
||||
void incSpeed10(); //!< Inc speed 10%
|
||||
void decSpeed10(); //!< Dec speed 10%
|
||||
void incSpeed4(); //!< Inc speed 4%
|
||||
void decSpeed4(); //!< Dec speed 4%
|
||||
void incSpeed1(); //!< Inc speed 1%
|
||||
void decSpeed1(); //!< Dec speed 1%
|
||||
void doubleSpeed();
|
||||
void halveSpeed();
|
||||
void normalSpeed();
|
||||
@ -189,17 +213,38 @@ public slots:
|
||||
//! Select previous line in subtitle file
|
||||
void decSubStep();
|
||||
|
||||
//! Audio equalizer
|
||||
void setAudioEqualizer(AudioEqualizerList values, bool restart = false);
|
||||
void setAudioAudioEqualizerRestart(AudioEqualizerList values) { setAudioEqualizer(values, true); };
|
||||
void updateAudioEqualizer();
|
||||
|
||||
void setAudioEq0(int value);
|
||||
void setAudioEq1(int value);
|
||||
void setAudioEq2(int value);
|
||||
void setAudioEq3(int value);
|
||||
void setAudioEq4(int value);
|
||||
void setAudioEq5(int value);
|
||||
void setAudioEq6(int value);
|
||||
void setAudioEq7(int value);
|
||||
void setAudioEq8(int value);
|
||||
void setAudioEq9(int value);
|
||||
|
||||
void changeDeinterlace(int);
|
||||
void changeSubtitle(int);
|
||||
void nextSubtitle();
|
||||
void changeAudio(int);
|
||||
void changeAudio(int ID, bool allow_restart = true);
|
||||
void nextAudio();
|
||||
void changeVideo(int ID, bool allow_restart = true);
|
||||
void nextVideo();
|
||||
void changeTitle(int);
|
||||
void changeChapter(int);
|
||||
void prevChapter();
|
||||
void nextChapter();
|
||||
void changeAngle(int);
|
||||
void changeAspectRatio(int);
|
||||
#if NEW_ASPECT_CODE
|
||||
void nextAspectRatio();
|
||||
#endif
|
||||
void changeOSD(int);
|
||||
void nextOSD();
|
||||
|
||||
@ -209,9 +254,17 @@ public slots:
|
||||
|
||||
void changeRotate(int r);
|
||||
|
||||
#if USE_ADAPTER
|
||||
void changeAdapter(int n);
|
||||
#endif
|
||||
|
||||
void incPanscan();
|
||||
void decPanscan();
|
||||
void resetPanscan();
|
||||
void autoPanscan();
|
||||
void autoPanscanFromLetterbox(double video_aspect);
|
||||
void autoPanscanFor169();
|
||||
void autoPanscanFor235();
|
||||
|
||||
void changeUseAss(bool);
|
||||
void toggleClosedCaption(bool);
|
||||
@ -219,13 +272,36 @@ public slots:
|
||||
|
||||
void visualizeMotionVectors(bool);
|
||||
|
||||
#if DVDNAV_SUPPORT
|
||||
// dvdnav buttons
|
||||
void dvdnavUp();
|
||||
void dvdnavDown();
|
||||
void dvdnavLeft();
|
||||
void dvdnavRight();
|
||||
void dvdnavMenu();
|
||||
void dvdnavSelect();
|
||||
void dvdnavPrev();
|
||||
void dvdnavMouse();
|
||||
#endif
|
||||
|
||||
// Pass a command to mplayer by stdin:
|
||||
void tellmp(const QString & command);
|
||||
|
||||
public:
|
||||
//! Returns the number of the first chapter in mkv
|
||||
//! Returns the number of the first chapter in
|
||||
//! files. In some versions of mplayer is 0, in others 1
|
||||
static int mkv_first_chapter();
|
||||
static int firstChapter();
|
||||
#if !GENERIC_CHAPTER_SUPPORT
|
||||
static int dvdFirstChapter();
|
||||
#endif
|
||||
|
||||
#ifndef NO_USE_INI_FILES
|
||||
void changeFileSettingsMethod(QString method);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
//! Returns the prefix to keep pausing on slave commands
|
||||
QString pausing_prefix();
|
||||
|
||||
protected slots:
|
||||
void changeCurrentSec(double sec);
|
||||
@ -240,13 +316,11 @@ protected slots:
|
||||
void processFinished();
|
||||
void fileReachedEnd();
|
||||
|
||||
void updateLog(QString line);
|
||||
|
||||
void displayMessage(QString text);
|
||||
void displayScreenshotName(QString filename);
|
||||
void displayUpdatingFontCache();
|
||||
|
||||
void streamTitleAndUrlChanged(QString,QString);
|
||||
void autosaveMplayerLog();
|
||||
|
||||
void watchState(Core::State state);
|
||||
|
||||
@ -255,6 +329,17 @@ protected slots:
|
||||
//! the resolution is HD
|
||||
void checkIfVideoIsHD();
|
||||
|
||||
#if DELAYED_AUDIO_SETUP_ON_STARTUP
|
||||
void initAudioTrack();
|
||||
#endif
|
||||
#if NOTIFY_AUDIO_CHANGES
|
||||
void initAudioTrack(const Tracks &);
|
||||
#endif
|
||||
#if NOTIFY_SUB_CHANGES
|
||||
void initSubtitleTrack(const SubTracks &);
|
||||
void setSubtitleTrackAgain(const SubTracks &);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void playNewFile(QString file, int seek=-1);
|
||||
void restartPlay();
|
||||
@ -264,17 +349,19 @@ protected:
|
||||
void startMplayer(QString file, double seek = -1 );
|
||||
void stopMplayer();
|
||||
|
||||
#ifndef NO_USE_INI_FILES
|
||||
#if !NEW_SETTINGS_MANAGEMENT
|
||||
bool checkHaveSettingsSaved(QString filename);
|
||||
void saveMediaInfo();
|
||||
void loadMediaInfo(QString filename);
|
||||
#endif
|
||||
void saveMediaInfo();
|
||||
#endif
|
||||
|
||||
void initializeMenus();
|
||||
void updateWidgets();
|
||||
|
||||
#if SCALE_ASS_SUBS
|
||||
//! Returns true if changing the subscale requires to restart mplayer
|
||||
bool subscale_need_restart();
|
||||
#endif
|
||||
|
||||
signals:
|
||||
void aboutToStartPlaying(); // Signal emited just before to start mplayer
|
||||
@ -287,12 +374,21 @@ signals:
|
||||
void showMessage(QString text);
|
||||
void menusNeedInitialize();
|
||||
void widgetsNeedUpdate();
|
||||
void equalizerNeedsUpdate();
|
||||
void videoEqualizerNeedsUpdate();
|
||||
void audioEqualizerNeedsUpdate();
|
||||
void showTime(double sec);
|
||||
#ifdef SEEKBAR_RESOLUTION
|
||||
void positionChanged(int); // To connect a slider
|
||||
#else
|
||||
void posChanged(int); // To connect a slider
|
||||
#endif
|
||||
void showFrame(int frame);
|
||||
void needResize(int w, int h);
|
||||
void noVideo();
|
||||
void volumeChanged(int);
|
||||
#if NOTIFY_SUB_CHANGES
|
||||
void audioTracksChanged();
|
||||
#endif
|
||||
|
||||
//! MPlayer started but finished with exit code != 0
|
||||
void mplayerFinishedWithError(int exitCode);
|
||||
@ -303,10 +399,21 @@ signals:
|
||||
// Resend signal from mplayerprocess:
|
||||
void failedToParseMplayerVersion(QString line_with_mplayer_version);
|
||||
|
||||
//! A new line from the mplayer output is available
|
||||
void logLineAvailable(QString);
|
||||
|
||||
protected:
|
||||
MplayerProcess * proc;
|
||||
MplayerWindow * mplayerwindow;
|
||||
|
||||
#ifndef NO_USE_INI_FILES
|
||||
#if NEW_SETTINGS_MANAGEMENT
|
||||
FileSettingsBase * file_settings;
|
||||
#else
|
||||
QSettings * file_settings;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
WinScreenSaver * win_screensaver;
|
||||
#endif
|
||||
@ -319,6 +426,8 @@ private:
|
||||
bool just_unloaded_external_subs;
|
||||
State _state;
|
||||
bool change_volume_after_unpause;
|
||||
|
||||
QString initial_subtitle;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,57 @@
|
||||
TEMPLATE = lib
|
||||
LANGUAGE = c++
|
||||
CONFIG += qt warn_on release staticlib
|
||||
|
||||
INCLUDEPATH = ..
|
||||
DEPENDOATH = ..
|
||||
|
||||
DEFINES += MINILIB NO_USE_INI_FILES
|
||||
|
||||
HEADERS += ../config.h \
|
||||
../constants.h \
|
||||
../global.h \
|
||||
../helper.h \
|
||||
../subtracks.h \
|
||||
../audiotracks.h \
|
||||
../titletracks.h \
|
||||
../mediadata.h \
|
||||
../mediasettings.h \
|
||||
../preferences.h \
|
||||
../myprocess.h \
|
||||
../mplayerversion.h \
|
||||
../mplayerprocess.h \
|
||||
../infoprovider.h \
|
||||
../desktopinfo.h \
|
||||
../mplayerwindow.h \
|
||||
../core.h \
|
||||
smplayercorelib.h
|
||||
|
||||
|
||||
SOURCES += ../global.cpp \
|
||||
../helper.cpp \
|
||||
../subtracks.cpp \
|
||||
../audiotracks.cpp \
|
||||
../titletracks.cpp \
|
||||
../mediadata.cpp \
|
||||
../mediasettings.cpp \
|
||||
../preferences.cpp \
|
||||
../myprocess.cpp \
|
||||
../mplayerversion.cpp \
|
||||
../mplayerprocess.cpp \
|
||||
../infoprovider.cpp \
|
||||
../desktopinfo.cpp \
|
||||
../mplayerwindow.cpp \
|
||||
../core.cpp \
|
||||
smplayercorelib.cpp
|
||||
|
||||
|
||||
unix {
|
||||
UI_DIR = .ui
|
||||
MOC_DIR = .moc
|
||||
OBJECTS_DIR = .obj
|
||||
}
|
||||
|
||||
win32 {
|
||||
HEADERS += ../screensaver.h
|
||||
SOURCES += ../screensaver.cpp
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 "smplayercorelib.h"
|
||||
#include "global.h"
|
||||
#include "preferences.h"
|
||||
#include "helper.h"
|
||||
#include <QApplication>
|
||||
|
||||
SmplayerCoreLib::SmplayerCoreLib( QWidget * parent )
|
||||
: QObject(parent)
|
||||
{
|
||||
if (Global::pref == 0) {
|
||||
qWarning("Global::global_init() hasn't been called. Crash comming.");
|
||||
}
|
||||
|
||||
_mpw = new MplayerWindow(parent);
|
||||
_core = new Core(_mpw, parent);
|
||||
|
||||
_mpw->setColorKey( Global::pref->color_key );
|
||||
|
||||
Global::pref->fast_audio_change = Preferences::Enabled;
|
||||
}
|
||||
|
||||
SmplayerCoreLib::~SmplayerCoreLib() {
|
||||
};
|
||||
|
||||
#include "moc_smplayercorelib.cpp"
|
@ -0,0 +1,43 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 _SMPLAYERCORELIB_H_
|
||||
#define _SMPLAYERCORELIB_H_
|
||||
|
||||
#include <QWidget>
|
||||
#include "core.h"
|
||||
#include "mplayerwindow.h"
|
||||
|
||||
class SmplayerCoreLib : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SmplayerCoreLib( QWidget * parent = 0 );
|
||||
~SmplayerCoreLib();
|
||||
|
||||
Core * core() { return _core; };
|
||||
MplayerWindow * mplayerWindow() { return _mpw; };
|
||||
|
||||
private:
|
||||
Core * _core;
|
||||
MplayerWindow * _mpw;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "defaultgui.h"
|
||||
#include "helper.h"
|
||||
#include "colorutils.h"
|
||||
#include "core.h"
|
||||
#include "global.h"
|
||||
#include "widgetactions.h"
|
||||
@ -26,6 +27,12 @@
|
||||
#include "myaction.h"
|
||||
#include "images.h"
|
||||
#include "floatingwidget.h"
|
||||
#include "toolbareditor.h"
|
||||
#include "desktopinfo.h"
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
#include "playlistdock.h"
|
||||
#endif
|
||||
|
||||
#include <QMenu>
|
||||
#include <QToolBar>
|
||||
@ -36,21 +43,15 @@
|
||||
#include <QToolButton>
|
||||
#include <QMenuBar>
|
||||
|
||||
#if !NEW_CONTROLWIDGET
|
||||
#include <QLCDNumber>
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
||||
DefaultGui::DefaultGui( QWidget * parent, Qt::WindowFlags flags )
|
||||
: BaseGuiPlus( parent, flags ),
|
||||
floating_control_width(100), //%
|
||||
floating_control_animated(true)
|
||||
: BaseGuiPlus( parent, flags )
|
||||
{
|
||||
createStatusBar();
|
||||
|
||||
connect( this, SIGNAL(timeChanged(double, int, QString)),
|
||||
this, SLOT(displayTime(double, int, QString)) );
|
||||
connect( this, SIGNAL(timeChanged(QString)),
|
||||
this, SLOT(displayTime(QString)) );
|
||||
connect( this, SIGNAL(frameChanged(int)),
|
||||
this, SLOT(displayFrame(int)) );
|
||||
|
||||
@ -85,15 +86,14 @@ DefaultGui::~DefaultGui() {
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
void DefaultGui::closeEvent( QCloseEvent * ) {
|
||||
/*qDebug("DefaultGui::closeEvent");
|
||||
qDebug("DefaultGui::closeEvent");
|
||||
|
||||
//BaseGuiPlus::closeEvent(e);
|
||||
qDebug("w: %d h: %d", width(), height() );*/
|
||||
hide();
|
||||
qDebug("w: %d h: %d", width(), height() );
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
void DefaultGui::createActions() {
|
||||
qDebug("DefaultGui::createActions");
|
||||
@ -103,8 +103,25 @@ void DefaultGui::createActions() {
|
||||
|
||||
volumeslider_action = createVolumeSliderAction(this);
|
||||
volumeslider_action->disable();
|
||||
|
||||
// Create the time label
|
||||
time_label_action = new TimeLabelAction(this);
|
||||
time_label_action->setObjectName("timelabel_action");
|
||||
|
||||
#if MINI_ARROW_BUTTONS
|
||||
QList<QAction*> rewind_actions;
|
||||
rewind_actions << rewind1Act << rewind2Act << rewind3Act;
|
||||
rewindbutton_action = new SeekingButton(rewind_actions, this);
|
||||
rewindbutton_action->setObjectName("rewindbutton_action");
|
||||
|
||||
QList<QAction*> forward_actions;
|
||||
forward_actions << forward1Act << forward2Act << forward3Act;
|
||||
forwardbutton_action = new SeekingButton(forward_actions, this);
|
||||
forwardbutton_action->setObjectName("forwardbutton_action");
|
||||
#endif
|
||||
}
|
||||
|
||||
#if AUTODISABLE_ACTIONS
|
||||
void DefaultGui::enableActionsOnPlaying() {
|
||||
qDebug("DefaultGui::enableActionsOnPlaying");
|
||||
BaseGuiPlus::enableActionsOnPlaying();
|
||||
@ -120,6 +137,7 @@ void DefaultGui::disableActionsOnStop() {
|
||||
timeslider_action->disable();
|
||||
volumeslider_action->disable();
|
||||
}
|
||||
#endif // AUTODISABLE_ACTIONS
|
||||
|
||||
void DefaultGui::createMenus() {
|
||||
toolbar_menu = new QMenu(this);
|
||||
@ -141,7 +159,7 @@ void DefaultGui::createMainToolBars() {
|
||||
toolbar1->setObjectName("toolbar1");
|
||||
//toolbar1->setMovable(false);
|
||||
addToolBar(Qt::TopToolBarArea, toolbar1);
|
||||
|
||||
#if !USE_CONFIGURABLE_TOOLBARS
|
||||
toolbar1->addAction(openFileAct);
|
||||
toolbar1->addAction(openDVDAct);
|
||||
toolbar1->addAction(openURLAct);
|
||||
@ -161,6 +179,7 @@ void DefaultGui::createMainToolBars() {
|
||||
//toolbar1->addSeparator();
|
||||
//toolbar1->addAction(timeslider_action);
|
||||
//toolbar1->addAction(volumeslider_action);
|
||||
#endif
|
||||
|
||||
toolbar2 = new QToolBar( this );
|
||||
toolbar2->setObjectName("toolbar2");
|
||||
@ -202,6 +221,7 @@ void DefaultGui::createControlWidgetMini() {
|
||||
//addDockWindow(controlwidget_mini, Qt::DockBottom );
|
||||
addToolBar(Qt::BottomToolBarArea, controlwidget_mini);
|
||||
|
||||
#if !USE_CONFIGURABLE_TOOLBARS
|
||||
controlwidget_mini->addAction(playOrPauseAct);
|
||||
controlwidget_mini->addAction(stopAct);
|
||||
controlwidget_mini->addSeparator();
|
||||
@ -217,6 +237,7 @@ void DefaultGui::createControlWidgetMini() {
|
||||
controlwidget_mini->addAction(muteAct );
|
||||
|
||||
controlwidget_mini->addAction(volumeslider_action);
|
||||
#endif // USE_CONFIGURABLE_TOOLBARS
|
||||
|
||||
controlwidget_mini->hide();
|
||||
}
|
||||
@ -231,21 +252,30 @@ void DefaultGui::createControlWidget() {
|
||||
//addDockWindow(controlwidget, Qt::DockBottom );
|
||||
addToolBar(Qt::BottomToolBarArea, controlwidget);
|
||||
|
||||
#if !USE_CONFIGURABLE_TOOLBARS
|
||||
controlwidget->addAction(playAct);
|
||||
controlwidget->addAction(pauseAndStepAct);
|
||||
controlwidget->addAction(stopAct);
|
||||
|
||||
controlwidget->addSeparator();
|
||||
|
||||
#if MINI_ARROW_BUTTONS
|
||||
controlwidget->addAction( rewindbutton_action );
|
||||
#else
|
||||
controlwidget->addAction(rewind3Act);
|
||||
controlwidget->addAction(rewind2Act);
|
||||
controlwidget->addAction(rewind1Act);
|
||||
#endif
|
||||
|
||||
controlwidget->addAction(timeslider_action);
|
||||
|
||||
#if MINI_ARROW_BUTTONS
|
||||
controlwidget->addAction( forwardbutton_action );
|
||||
#else
|
||||
controlwidget->addAction(forward1Act);
|
||||
controlwidget->addAction(forward2Act);
|
||||
controlwidget->addAction(forward3Act);
|
||||
#endif
|
||||
|
||||
controlwidget->addSeparator();
|
||||
|
||||
@ -253,6 +283,7 @@ void DefaultGui::createControlWidget() {
|
||||
controlwidget->addAction(muteAct);
|
||||
|
||||
controlwidget->addAction(volumeslider_action);
|
||||
#endif // USE_CONFIGURABLE_TOOLBARS
|
||||
|
||||
/*
|
||||
controlwidget->show();
|
||||
@ -260,34 +291,33 @@ void DefaultGui::createControlWidget() {
|
||||
}
|
||||
|
||||
void DefaultGui::createFloatingControl() {
|
||||
// Create the time label
|
||||
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 / 00:00:00" );
|
||||
time_label->setFrameShape( QFrame::Panel );
|
||||
time_label->setFrameShadow( QFrame::Sunken );
|
||||
|
||||
QWidgetAction * time_label_action = new QWidgetAction(this);
|
||||
time_label_action->setDefaultWidget(time_label);
|
||||
|
||||
// Floating control
|
||||
floating_control = new FloatingWidget(this);
|
||||
|
||||
#if !USE_CONFIGURABLE_TOOLBARS
|
||||
floating_control->toolbar()->addAction(playAct);
|
||||
floating_control->toolbar()->addAction(pauseAct);
|
||||
floating_control->toolbar()->addAction(stopAct);
|
||||
floating_control->toolbar()->addSeparator();
|
||||
|
||||
#if MINI_ARROW_BUTTONS
|
||||
floating_control->toolbar()->addAction( rewindbutton_action );
|
||||
#else
|
||||
floating_control->toolbar()->addAction(rewind3Act);
|
||||
floating_control->toolbar()->addAction(rewind2Act);
|
||||
floating_control->toolbar()->addAction(rewind1Act);
|
||||
#endif
|
||||
|
||||
floating_control->toolbar()->addAction(timeslider_action);
|
||||
|
||||
#if MINI_ARROW_BUTTONS
|
||||
floating_control->toolbar()->addAction( forwardbutton_action );
|
||||
#else
|
||||
floating_control->toolbar()->addAction(forward1Act);
|
||||
floating_control->toolbar()->addAction(forward2Act);
|
||||
floating_control->toolbar()->addAction(forward3Act);
|
||||
#endif
|
||||
|
||||
floating_control->toolbar()->addSeparator();
|
||||
floating_control->toolbar()->addAction(fullscreenAct);
|
||||
floating_control->toolbar()->addAction(muteAct);
|
||||
@ -295,7 +325,17 @@ void DefaultGui::createFloatingControl() {
|
||||
floating_control->toolbar()->addSeparator();
|
||||
floating_control->toolbar()->addAction(time_label_action);
|
||||
|
||||
#endif // USE_CONFIGURABLE_TOOLBARS
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
// To make work the ESC key (exit fullscreen) and Ctrl-X (close) in Windows
|
||||
floating_control->addAction(exitFullscreenAct);
|
||||
floating_control->addAction(exitAct);
|
||||
#endif
|
||||
|
||||
#if !USE_CONFIGURABLE_TOOLBARS
|
||||
floating_control->adjustSize();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DefaultGui::createStatusBar() {
|
||||
@ -315,12 +355,12 @@ void DefaultGui::createStatusBar() {
|
||||
|
||||
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) );
|
||||
ColorUtils::setBackgroundColor( statusBar(), QColor(0,0,0) );
|
||||
ColorUtils::setForegroundColor( statusBar(), QColor(255,255,255) );
|
||||
ColorUtils::setBackgroundColor( time_display, QColor(0,0,0) );
|
||||
ColorUtils::setForegroundColor( time_display, QColor(255,255,255) );
|
||||
ColorUtils::setBackgroundColor( frame_display, QColor(0,0,0) );
|
||||
ColorUtils::setForegroundColor( frame_display, QColor(255,255,255) );
|
||||
statusBar()->setSizeGripEnabled(FALSE);
|
||||
|
||||
statusBar()->showMessage( tr("Welcome to SMPlayer") );
|
||||
@ -351,11 +391,9 @@ void DefaultGui::retranslateStrings() {
|
||||
}
|
||||
|
||||
|
||||
void DefaultGui::displayTime(double sec, int perc, QString text) {
|
||||
void DefaultGui::displayTime(QString text) {
|
||||
time_display->setText( text );
|
||||
timeslider_action->setPos(perc);
|
||||
|
||||
time_label->setText(text);
|
||||
time_label_action->setText(text);
|
||||
}
|
||||
|
||||
void DefaultGui::displayFrame(int frame) {
|
||||
@ -412,6 +450,7 @@ void DefaultGui::aboutToExitFullscreen() {
|
||||
}
|
||||
|
||||
void DefaultGui::aboutToEnterCompactMode() {
|
||||
|
||||
BaseGuiPlus::aboutToEnterCompactMode();
|
||||
|
||||
// Save visibility of toolbars
|
||||
@ -424,12 +463,6 @@ void DefaultGui::aboutToEnterCompactMode() {
|
||||
controlwidget_mini->hide();
|
||||
toolbar1->hide();
|
||||
toolbar2->hide();
|
||||
|
||||
/*
|
||||
if (pref->resize_method == Preferences::Always) {
|
||||
resizeWindow(core->mset.win_width, core->mset.win_height);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void DefaultGui::aboutToExitCompactMode() {
|
||||
@ -450,8 +483,12 @@ void DefaultGui::showFloatingControl(QPoint /*p*/) {
|
||||
qDebug("DefaultGui::showFloatingControl");
|
||||
|
||||
#if CONTROLWIDGET_OVER_VIDEO
|
||||
floating_control->setAnimated( floating_control_animated );
|
||||
floating_control->showOver(panel, floating_control_width);
|
||||
floating_control->setAnimated( pref->floating_control_animated );
|
||||
floating_control->setMargin(pref->floating_control_margin);
|
||||
#ifndef Q_OS_WIN
|
||||
floating_control->setBypassWindowManager(pref->bypass_window_manager);
|
||||
#endif
|
||||
floating_control->showOver(panel, pref->floating_control_width);
|
||||
#else
|
||||
if (!controlwidget->isVisible()) {
|
||||
controlwidget->show();
|
||||
@ -506,6 +543,13 @@ void DefaultGui::resizeEvent( QResizeEvent * ) {
|
||||
}
|
||||
}
|
||||
|
||||
#if USE_MINIMUMSIZE
|
||||
QSize DefaultGui::minimumSizeHint() const {
|
||||
return QSize(controlwidget_mini->sizeHint().width(), 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void DefaultGui::saveConfig() {
|
||||
qDebug("DefaultGui::saveConfig");
|
||||
|
||||
@ -513,9 +557,6 @@ void DefaultGui::saveConfig() {
|
||||
|
||||
set->beginGroup( "default_gui");
|
||||
|
||||
set->setValue("floating_control_width", floating_control_width );
|
||||
set->setValue("floating_control_animated", floating_control_animated);
|
||||
|
||||
set->setValue("fullscreen_toolbar1_was_visible", fullscreen_toolbar1_was_visible);
|
||||
set->setValue("fullscreen_toolbar2_was_visible", fullscreen_toolbar2_was_visible);
|
||||
set->setValue("compact_toolbar1_was_visible", compact_toolbar1_was_visible);
|
||||
@ -523,13 +564,20 @@ void DefaultGui::saveConfig() {
|
||||
|
||||
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( "pos", pos() );
|
||||
set->setValue( "size", size() );
|
||||
}
|
||||
|
||||
set->setValue( "toolbars_state", saveState() );
|
||||
set->setValue( "toolbars_state", saveState(Helper::qtVersion()) );
|
||||
|
||||
#if USE_CONFIGURABLE_TOOLBARS
|
||||
set->beginGroup( "actions" );
|
||||
set->setValue("toolbar1", ToolbarEditor::save(toolbar1) );
|
||||
set->setValue("controlwidget", ToolbarEditor::save(controlwidget) );
|
||||
set->setValue("controlwidget_mini", ToolbarEditor::save(controlwidget_mini) );
|
||||
set->setValue("floating_control", ToolbarEditor::save(floating_control->toolbar()) );
|
||||
set->endGroup();
|
||||
#endif
|
||||
|
||||
set->endGroup();
|
||||
}
|
||||
@ -541,33 +589,96 @@ void DefaultGui::loadConfig() {
|
||||
|
||||
set->beginGroup( "default_gui");
|
||||
|
||||
floating_control_width = set->value( "floating_control_width", floating_control_width ).toInt();
|
||||
floating_control_animated = set->value("floating_control_animated", floating_control_animated).toBool();
|
||||
|
||||
fullscreen_toolbar1_was_visible = set->value("fullscreen_toolbar1_was_visible", fullscreen_toolbar1_was_visible).toBool();
|
||||
fullscreen_toolbar2_was_visible = set->value("fullscreen_toolbar2_was_visible", fullscreen_toolbar2_was_visible).toBool();
|
||||
compact_toolbar1_was_visible = set->value("compact_toolbar1_was_visible", compact_toolbar1_was_visible).toBool();
|
||||
compact_toolbar2_was_visible = set->value("compact_toolbar2_was_visible", compact_toolbar2_was_visible).toBool();
|
||||
|
||||
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();
|
||||
QPoint p = set->value("pos", pos()).toPoint();
|
||||
QSize s = set->value("size", size()).toSize();
|
||||
|
||||
if (height < 200) {
|
||||
width = 580;
|
||||
height = 440;
|
||||
if ( (s.height() < 200) && (!pref->use_mplayer_window) ) {
|
||||
s = pref->default_size;
|
||||
}
|
||||
|
||||
move(x,y);
|
||||
resize(width,height);
|
||||
move(p);
|
||||
resize(s);
|
||||
|
||||
if (!DesktopInfo::isInsideScreen(this)) {
|
||||
move(0,0);
|
||||
qWarning("DefaultGui::loadConfig: window is outside of the screen, moved to 0x0");
|
||||
}
|
||||
}
|
||||
|
||||
restoreState( set->value( "toolbars_state" ).toByteArray() );
|
||||
#if USE_CONFIGURABLE_TOOLBARS
|
||||
QList<QAction *> actions_list = findChildren<QAction *>();
|
||||
QStringList toolbar1_actions;
|
||||
toolbar1_actions << "open_file" << "open_dvd" << "open_url" << "separator" << "compact" << "fullscreen"
|
||||
<< "separator" << "screenshot" << "separator" << "show_file_properties" << "show_playlist"
|
||||
<< "show_preferences" << "separator" << "play_prev" << "play_next";
|
||||
|
||||
QStringList controlwidget_actions;
|
||||
controlwidget_actions << "play" << "pause_and_frame_step" << "stop" << "separator";
|
||||
|
||||
#if MINI_ARROW_BUTTONS
|
||||
controlwidget_actions << "rewindbutton_action";
|
||||
#else
|
||||
controlwidget_actions << "rewind3" << "rewind2" << "rewind1";
|
||||
#endif
|
||||
|
||||
controlwidget_actions << "timeslider_action";
|
||||
|
||||
#if MINI_ARROW_BUTTONS
|
||||
controlwidget_actions << "forwardbutton_action";
|
||||
#else
|
||||
controlwidget_actions << "forward1" << "forward2" << "forward3";
|
||||
#endif
|
||||
|
||||
controlwidget_actions << "separator" << "fullscreen" << "mute" << "volumeslider_action";
|
||||
|
||||
QStringList controlwidget_mini_actions;
|
||||
controlwidget_mini_actions << "play_or_pause" << "stop" << "separator" << "rewind1" << "timeslider_action"
|
||||
<< "forward1" << "separator" << "mute" << "volumeslider_action";
|
||||
|
||||
QStringList floatingcontrol_actions;
|
||||
floatingcontrol_actions << "play" << "pause" << "stop" << "separator";
|
||||
|
||||
#if MINI_ARROW_BUTTONS
|
||||
floatingcontrol_actions << "rewindbutton_action";
|
||||
#else
|
||||
floatingcontrol_actions << "rewind3" << "rewind2" << "rewind1";
|
||||
#endif
|
||||
|
||||
floatingcontrol_actions << "timeslider_action";
|
||||
|
||||
#if MINI_ARROW_BUTTONS
|
||||
floatingcontrol_actions << "forwardbutton_action";
|
||||
#else
|
||||
floatingcontrol_actions << "forward1" << "forward2" << "forward3";
|
||||
#endif
|
||||
|
||||
floatingcontrol_actions << "separator" << "fullscreen" << "mute" << "volumeslider_action" << "separator" << "timelabel_action";
|
||||
|
||||
set->beginGroup( "actions" );
|
||||
ToolbarEditor::load(toolbar1, set->value("toolbar1", toolbar1_actions).toStringList(), actions_list );
|
||||
ToolbarEditor::load(controlwidget, set->value("controlwidget", controlwidget_actions).toStringList(), actions_list );
|
||||
ToolbarEditor::load(controlwidget_mini, set->value("controlwidget_mini", controlwidget_mini_actions).toStringList(), actions_list );
|
||||
ToolbarEditor::load(floating_control->toolbar(), set->value("floating_control", floatingcontrol_actions).toStringList(), actions_list );
|
||||
floating_control->adjustSize();
|
||||
set->endGroup();
|
||||
#endif
|
||||
|
||||
restoreState( set->value( "toolbars_state" ).toByteArray(), Helper::qtVersion() );
|
||||
|
||||
#if DOCK_PLAYLIST
|
||||
qDebug("DefaultGui::loadConfig: playlist visible: %d", playlistdock->isVisible());
|
||||
qDebug("DefaultGui::loadConfig: playlist position: %d, %d", playlistdock->pos().x(), playlistdock->pos().y());
|
||||
qDebug("DefaultGui::loadConfig: playlist size: %d x %d", playlistdock->size().width(), playlistdock->size().height());
|
||||
#endif
|
||||
|
||||
set->endGroup();
|
||||
|
||||
|
||||
updateWidgets();
|
||||
}
|
||||
|
@ -19,11 +19,10 @@
|
||||
#ifndef _DEFAULTGUI_H_
|
||||
#define _DEFAULTGUI_H_
|
||||
|
||||
#include "config.h"
|
||||
#include "guiconfig.h"
|
||||
#include "baseguiplus.h"
|
||||
#include <QPoint>
|
||||
|
||||
class QLabel;
|
||||
class QToolBar;
|
||||
class QPushButton;
|
||||
class QResizeEvent;
|
||||
@ -32,8 +31,11 @@ class QMenu;
|
||||
class TimeSliderAction;
|
||||
class VolumeSliderAction;
|
||||
class FloatingWidget;
|
||||
class QLabel;
|
||||
class TimeLabelAction;
|
||||
|
||||
#if MINI_ARROW_BUTTONS
|
||||
class SeekingButton;
|
||||
#endif
|
||||
|
||||
class DefaultGui : public BaseGuiPlus
|
||||
{
|
||||
@ -43,6 +45,10 @@ public:
|
||||
DefaultGui( QWidget* parent = 0, Qt::WindowFlags flags = 0 );
|
||||
~DefaultGui();
|
||||
|
||||
#if USE_MINIMUMSIZE
|
||||
virtual QSize minimumSizeHint () const;
|
||||
#endif
|
||||
|
||||
public slots:
|
||||
//virtual void showPlaylist(bool b);
|
||||
|
||||
@ -67,11 +73,11 @@ protected:
|
||||
virtual void aboutToExitCompactMode();
|
||||
|
||||
virtual void resizeEvent( QResizeEvent * );
|
||||
virtual void closeEvent( QCloseEvent * );
|
||||
/* virtual void closeEvent( QCloseEvent * ); */
|
||||
|
||||
protected slots:
|
||||
virtual void updateWidgets();
|
||||
virtual void displayTime(double sec, int perc, QString text);
|
||||
virtual void displayTime(QString text);
|
||||
virtual void displayFrame(int frame);
|
||||
|
||||
virtual void showFloatingControl(QPoint p);
|
||||
@ -79,8 +85,10 @@ protected slots:
|
||||
virtual void hideFloatingControls();
|
||||
|
||||
// Reimplemented:
|
||||
#if AUTODISABLE_ACTIONS
|
||||
virtual void enableActionsOnPlaying();
|
||||
virtual void disableActionsOnStop();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
QLabel * time_display;
|
||||
@ -98,8 +106,13 @@ protected:
|
||||
TimeSliderAction * timeslider_action;
|
||||
VolumeSliderAction * volumeslider_action;
|
||||
|
||||
#if MINI_ARROW_BUTTONS
|
||||
SeekingButton * rewindbutton_action;
|
||||
SeekingButton * forwardbutton_action;
|
||||
#endif
|
||||
|
||||
FloatingWidget * floating_control;
|
||||
QLabel * time_label;
|
||||
TimeLabelAction * time_label_action;
|
||||
|
||||
QMenu * toolbar_menu;
|
||||
|
||||
@ -109,10 +122,6 @@ protected:
|
||||
bool fullscreen_toolbar2_was_visible;
|
||||
bool compact_toolbar1_was_visible;
|
||||
bool compact_toolbar2_was_visible;
|
||||
|
||||
// Properties to save
|
||||
int floating_control_width; // Percentage of screen
|
||||
bool floating_control_animated;
|
||||
};
|
||||
|
||||
#endif
|
@ -40,3 +40,10 @@ double DesktopInfo::desktop_aspectRatio(QWidget *w) {
|
||||
return (double) s.width() / s.height() ;
|
||||
}
|
||||
|
||||
bool DesktopInfo::isInsideScreen(QWidget *w) {
|
||||
QDesktopWidget * dw = QApplication::desktop();
|
||||
QRect r = dw->screenGeometry(w);
|
||||
|
||||
qDebug("DesktopInfo::isInsideScreen: geometry of screen: x:%d y:%d w:%d h:%d", r.x(), r.y(), r.width(), r.height() );
|
||||
return r.contains(w->pos());
|
||||
}
|
@ -29,6 +29,9 @@ class DesktopInfo
|
||||
public:
|
||||
static QSize desktop_size(QWidget *w);
|
||||
static double desktop_aspectRatio(QWidget *w);
|
||||
|
||||
//! Returns true if the widget is inside the current screen
|
||||
static bool isInsideScreen(QWidget *w);
|
||||
};
|
||||
|
||||
#endif
|
128
retroshare-gui/src/gui/plugins/smplayer_plugin/deviceinfo.cpp
Normal file
128
retroshare-gui/src/gui/plugins/smplayer_plugin/deviceinfo.cpp
Normal file
@ -0,0 +1,128 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 "deviceinfo.h"
|
||||
#include <QProcess>
|
||||
#include <QFile>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
DeviceList DeviceInfo::retrieveDevices(DeviceType type) {
|
||||
qDebug("DeviceInfo::retrieveDevices: %d", type);
|
||||
|
||||
DeviceList l;
|
||||
QRegExp rx_device("^(\\d+): (.*)");
|
||||
|
||||
if (QFile::exists("dxlist.exe")) {
|
||||
QProcess p;
|
||||
p.setProcessChannelMode( QProcess::MergedChannels );
|
||||
QStringList arg;
|
||||
if (type == Sound) arg << "-s"; else arg << "-d";
|
||||
p.start("dxlist", arg);
|
||||
|
||||
if (p.waitForFinished()) {
|
||||
QByteArray line;
|
||||
while (p.canReadLine()) {
|
||||
line = p.readLine().trimmed();
|
||||
qDebug("DeviceInfo::retrieveDevices: '%s'", line.constData());
|
||||
if ( rx_device.indexIn(line) > -1 ) {
|
||||
int id = rx_device.cap(1).toInt();
|
||||
QString desc = rx_device.cap(2);
|
||||
qDebug("DeviceInfo::retrieveDevices: found device: '%d' '%s'", id, desc.toUtf8().constData());
|
||||
l.append( DeviceData(id, desc) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
DeviceList DeviceInfo::dsoundDevices() {
|
||||
return retrieveDevices(Sound);
|
||||
}
|
||||
|
||||
DeviceList DeviceInfo::displayDevices() {
|
||||
return retrieveDevices(Display);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
DeviceList DeviceInfo::alsaDevices() {
|
||||
qDebug("DeviceInfo::alsaDevices");
|
||||
|
||||
DeviceList l;
|
||||
QRegExp rx_device("^card\\s([0-9]+).*\\[(.*)\\],\\sdevice\\s([0-9]+):");
|
||||
|
||||
QProcess p;
|
||||
p.setProcessChannelMode( QProcess::MergedChannels );
|
||||
p.setEnvironment( QStringList() << "LC_ALL=C" );
|
||||
p.start("aplay", QStringList() << "-l");
|
||||
|
||||
if (p.waitForFinished()) {
|
||||
QByteArray line;
|
||||
while (p.canReadLine()) {
|
||||
line = p.readLine();
|
||||
qDebug("DeviceInfo::alsaDevices: '%s'", line.constData());
|
||||
if ( rx_device.indexIn(line) > -1 ) {
|
||||
QString id = rx_device.cap(1);
|
||||
id.append(".");
|
||||
id.append(rx_device.cap(3));
|
||||
QString desc = rx_device.cap(2);
|
||||
qDebug("DeviceInfo::alsaDevices: found device: '%s' '%s'", id.toUtf8().constData(), desc.toUtf8().constData());
|
||||
l.append( DeviceData(id, desc) );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qDebug("DeviceInfo::alsaDevices: could not start aplay, error %d", p.error());
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
DeviceList DeviceInfo::xvAdaptors() {
|
||||
qDebug("DeviceInfo::xvAdaptors");
|
||||
|
||||
DeviceList l;
|
||||
QRegExp rx_device("^.*Adaptor #([0-9]+): \"(.*)\"");
|
||||
|
||||
QProcess p;
|
||||
p.setProcessChannelMode( QProcess::MergedChannels );
|
||||
p.setEnvironment( QProcess::systemEnvironment() << "LC_ALL=C" );
|
||||
p.start("xvinfo");
|
||||
|
||||
if (p.waitForFinished()) {
|
||||
QByteArray line;
|
||||
while (p.canReadLine()) {
|
||||
line = p.readLine();
|
||||
qDebug("DeviceInfo::xvAdaptors: '%s'", line.constData());
|
||||
if ( rx_device.indexIn(line) > -1 ) {
|
||||
QString id = rx_device.cap(1);
|
||||
QString desc = rx_device.cap(2);
|
||||
qDebug("DeviceInfo::xvAdaptors: found adaptor: '%s' '%s'", id.toUtf8().constData(), desc.toUtf8().constData());
|
||||
l.append( DeviceData(id, desc) );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qDebug("DeviceInfo::xvAdaptors: could not start xvinfo, error %d", p.error());
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
#endif
|
@ -16,52 +16,53 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _TRACKS_H_
|
||||
#define _TRACKS_H_
|
||||
#ifndef _DEVICEINFO_H_
|
||||
#define _DEVICEINFO_H_
|
||||
|
||||
#include "trackdata.h"
|
||||
#include <QMap>
|
||||
#include <QSettings>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <QList>
|
||||
|
||||
class TrackList {
|
||||
class DeviceData {
|
||||
|
||||
public:
|
||||
DeviceData() {};
|
||||
DeviceData(QVariant ID, QString desc) { _id = ID; _desc = desc; };
|
||||
~DeviceData() {};
|
||||
|
||||
TrackList();
|
||||
~TrackList();
|
||||
void setID(QVariant ID) { _id = ID; };
|
||||
void setDesc(QString desc) { _desc = desc; };
|
||||
|
||||
void clear();
|
||||
void list();
|
||||
QVariant ID() { return _id; };
|
||||
QString desc() { return _desc; };
|
||||
|
||||
void addLang(int ID, QString lang);
|
||||
void addName(int ID, QString name);
|
||||
void addFilename(int ID, QString filename);
|
||||
void addDuration(int ID, double duration);
|
||||
void addChapters(int ID, int n);
|
||||
void addAngles(int ID, int n);
|
||||
void addID(int ID);
|
||||
|
||||
int numItems();
|
||||
bool existsItemAt(int n);
|
||||
|
||||
TrackData itemAt(int n);
|
||||
TrackData item(int ID);
|
||||
int find(int ID);
|
||||
|
||||
int findLang(QString expr);
|
||||
|
||||
// A mess for getting sub files...
|
||||
int lastID();
|
||||
bool existsFilename(QString name);
|
||||
|
||||
void save(QSettings & set);
|
||||
void load(QSettings & set);
|
||||
|
||||
|
||||
protected:
|
||||
typedef QMap <int, TrackData> TrackMap;
|
||||
TrackMap tm;
|
||||
private:
|
||||
QVariant _id;
|
||||
QString _desc;
|
||||
};
|
||||
|
||||
|
||||
typedef QList<DeviceData> DeviceList;
|
||||
|
||||
|
||||
class DeviceInfo {
|
||||
|
||||
public:
|
||||
#ifdef Q_OS_WIN
|
||||
static DeviceList dsoundDevices();
|
||||
static DeviceList displayDevices();
|
||||
#else
|
||||
static DeviceList alsaDevices();
|
||||
static DeviceList xvAdaptors();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef Q_OS_WIN
|
||||
enum DeviceType { Sound = 0, Display = 1 };
|
||||
|
||||
static DeviceList retrieveDevices(DeviceType type);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -65,6 +65,7 @@ QString EqSlider::label() const {
|
||||
|
||||
void EqSlider::setValue(int value) {
|
||||
_slider->setValue(value);
|
||||
value_label->setNum(value);
|
||||
}
|
||||
|
||||
int EqSlider::value() const {
|
@ -44,6 +44,10 @@ public:
|
||||
const QPixmap * icon() const;
|
||||
QString label() const;
|
||||
|
||||
QSlider * sliderWidget() { return _slider; };
|
||||
VerticalText * labelWidget() { return _label; };
|
||||
QLabel * iconWidget() { return _icon; };
|
||||
|
||||
signals:
|
||||
void valueChanged(int);
|
||||
|
@ -5,13 +5,10 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>124</width>
|
||||
<height>205</height>
|
||||
<width>68</width>
|
||||
<height>289</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowIcon" >
|
||||
<iconset/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
@ -38,7 +35,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="VerticalText" native="1" name="_label" >
|
||||
@ -67,6 +64,30 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="value_label" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>5</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="0" margin="0" />
|
||||
@ -81,5 +102,22 @@
|
||||
<include location="local" >verticaltext.h</include>
|
||||
</includes>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>_slider</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>value_label</receiver>
|
||||
<slot>setNum(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>64</x>
|
||||
<y>156</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>36</x>
|
||||
<y>305</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -12,9 +12,6 @@
|
||||
<property name="windowTitle" >
|
||||
<string>MPlayer Error</string>
|
||||
</property>
|
||||
<property name="windowIcon" >
|
||||
<iconset/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
@ -50,7 +50,8 @@ Extensions::Extensions()
|
||||
<< "asf" << "wmv"
|
||||
<< "bin" << "iso" << "vob"
|
||||
<< "mkv" << "nsv" << "ram" << "flv"
|
||||
<< "ts" << "rmvb" << "dvr-ms";
|
||||
<< "rm" << "swf"
|
||||
<< "ts" << "rmvb" << "dvr-ms" << "m2t" << "m2ts" << "rec";
|
||||
|
||||
_audio << "mp3" << "ogg" << "wav" << "wma" << "ac3" << "ra" << "ape" << "flac";
|
||||
|
||||
@ -63,6 +64,8 @@ Extensions::Extensions()
|
||||
for (int n = 0; n < _audio.count(); n++) {
|
||||
if (!_multimedia.contains(_audio[n])) _multimedia << _audio[n];
|
||||
}
|
||||
|
||||
_all_playable << _multimedia << _playlist;
|
||||
}
|
||||
|
||||
Extensions::~Extensions() {
|
@ -41,10 +41,12 @@ public:
|
||||
ExtensionList playlist() { return _playlist; };
|
||||
ExtensionList subtitles() { return _subtitles; };
|
||||
ExtensionList multimedia() { return _multimedia; };
|
||||
ExtensionList allPlayable() { return _all_playable; };
|
||||
|
||||
protected:
|
||||
ExtensionList _video, _audio, _playlist, _subtitles;
|
||||
ExtensionList _multimedia; // video and audio
|
||||
ExtensionList _multimedia; //!< video and audio
|
||||
ExtensionList _all_playable; //!< video, audio and playlist
|
||||
};
|
||||
|
||||
#endif
|
102
retroshare-gui/src/gui/plugins/smplayer_plugin/filechooser.cpp
Normal file
102
retroshare-gui/src/gui/plugins/smplayer_plugin/filechooser.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 "filechooser.h"
|
||||
|
||||
//#define NO_SMPLAYER_SUPPORT
|
||||
|
||||
#ifndef NO_SMPLAYER_SUPPORT
|
||||
#include "filedialog.h"
|
||||
#include "images.h"
|
||||
#else
|
||||
#include <QFileDialog>
|
||||
#endif
|
||||
|
||||
FileChooser::FileChooser(QWidget * parent) : QWidget(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
#ifndef NO_SMPLAYER_SUPPORT
|
||||
button->setIcon(Images::icon("find"));
|
||||
#else
|
||||
button->setIcon(QIcon(":/find"));
|
||||
#endif
|
||||
|
||||
setDialogType(GetFileName);
|
||||
setOptions(0);
|
||||
}
|
||||
|
||||
FileChooser::~FileChooser() {
|
||||
}
|
||||
|
||||
QLineEdit * FileChooser::lineEdit() {
|
||||
return line_edit;
|
||||
}
|
||||
|
||||
QToolButton * FileChooser::toolButton() {
|
||||
return button;
|
||||
}
|
||||
|
||||
QString FileChooser::text() const {
|
||||
return line_edit->text();
|
||||
}
|
||||
|
||||
void FileChooser::setText(const QString & text) {
|
||||
line_edit->setText(text);
|
||||
}
|
||||
|
||||
void FileChooser::on_button_clicked() {
|
||||
QString result;
|
||||
QString f;
|
||||
|
||||
if (dialogType() == GetFileName) {
|
||||
QFileDialog::Options opts = options();
|
||||
if (opts == 0) opts = QFileDialog::DontResolveSymlinks;
|
||||
|
||||
#ifndef NO_SMPLAYER_SUPPORT
|
||||
result = MyFileDialog::getOpenFileName(
|
||||
#else
|
||||
result = QFileDialog::getOpenFileName(
|
||||
#endif
|
||||
this, caption(),
|
||||
line_edit->text(),
|
||||
filter(), &f, opts );
|
||||
}
|
||||
else
|
||||
if (dialogType() == GetDirectory) {
|
||||
QFileDialog::Options opts = options();
|
||||
if (opts == 0) opts = QFileDialog::ShowDirsOnly;
|
||||
|
||||
#ifndef NO_SMPLAYER_SUPPORT
|
||||
result = MyFileDialog::getExistingDirectory(
|
||||
#else
|
||||
result = QFileDialog::getExistingDirectory(
|
||||
#endif
|
||||
this, caption(),
|
||||
line_edit->text(), opts );
|
||||
}
|
||||
|
||||
if (!result.isEmpty()) {
|
||||
QString old_file = line_edit->text();
|
||||
line_edit->setText(result);
|
||||
if (old_file != result) emit fileChanged(result);
|
||||
}
|
||||
}
|
||||
|
||||
#include "moc_filechooser.cpp"
|
||||
|
69
retroshare-gui/src/gui/plugins/smplayer_plugin/filechooser.h
Normal file
69
retroshare-gui/src/gui/plugins/smplayer_plugin/filechooser.h
Normal file
@ -0,0 +1,69 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 _FILECHOOSER_H_
|
||||
#define _FILECHOOSER_H_
|
||||
|
||||
#include "ui_filechooser.h"
|
||||
#include <QFileDialog>
|
||||
|
||||
class FileChooser : public QWidget, public Ui::FileChooser
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString text READ text WRITE setText)
|
||||
Q_PROPERTY(QString caption READ caption WRITE setCaption)
|
||||
Q_PROPERTY(QString filter READ filter WRITE setFilter)
|
||||
Q_PROPERTY(DialogType dialogType READ dialogType WRITE setDialogType)
|
||||
Q_PROPERTY(QFileDialog::Options options READ options WRITE setOptions)
|
||||
|
||||
public:
|
||||
enum DialogType { GetFileName = 0, GetDirectory = 1 };
|
||||
|
||||
FileChooser( QWidget* parent = 0 );
|
||||
~FileChooser();
|
||||
|
||||
QLineEdit * lineEdit();
|
||||
QToolButton * toolButton();
|
||||
|
||||
QString text() const;
|
||||
QString caption() const { return _caption; };
|
||||
QString filter() const { return _filter; };
|
||||
DialogType dialogType() const { return _type; };
|
||||
QFileDialog::Options options() const { return _options; };
|
||||
|
||||
public slots:
|
||||
void setText(const QString & text);
|
||||
void setCaption(const QString & caption) { _caption = caption; };
|
||||
void setFilter(const QString & filter) { _filter = filter; };
|
||||
void setDialogType( DialogType type) { _type = type; };
|
||||
void setOptions( QFileDialog::Options options) { _options = options; };
|
||||
|
||||
signals:
|
||||
void fileChanged(QString file);
|
||||
|
||||
protected slots:
|
||||
virtual void on_button_clicked();
|
||||
|
||||
protected:
|
||||
QString _caption;
|
||||
QString _filter;
|
||||
DialogType _type;
|
||||
QFileDialog::Options _options;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,29 @@
|
||||
<ui version="4.0" >
|
||||
<class>FileChooser</class>
|
||||
<widget class="QWidget" name="FileChooser" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>407</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="line_edit" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="button" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -218,7 +218,7 @@ void FilePropertiesDialog::changeEvent(QEvent *e) {
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
retranslateStrings();
|
||||
} else {
|
||||
QWidget::changeEvent(e);
|
||||
QDialog::changeEvent(e);
|
||||
}
|
||||
}
|
||||
|
@ -13,9 +13,6 @@
|
||||
<property name="windowTitle" >
|
||||
<string>SMPlayer - File properties</string>
|
||||
</property>
|
||||
<property name="windowIcon" >
|
||||
<iconset/>
|
||||
</property>
|
||||
<property name="sizeGripEnabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -457,12 +454,19 @@ Example: resample=44100:0:0,volnorm</string>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11" />
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
<tabstop>info_edit</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
<tabstop>demuxer_listbox</tabstop>
|
||||
<tabstop>resetDemuxerButton</tabstop>
|
||||
<tabstop>vc_listbox</tabstop>
|
||||
<tabstop>resetVCButton</tabstop>
|
||||
<tabstop>ac_listbox</tabstop>
|
||||
<tabstop>resetACButton</tabstop>
|
||||
<tabstop>mplayer_args_edit</tabstop>
|
||||
<tabstop>mplayer_vfilters_edit</tabstop>
|
||||
<tabstop>mplayer_afilters_edit</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
@ -0,0 +1,88 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 "filesettings.h"
|
||||
#include "mediasettings.h"
|
||||
#include <QSettings>
|
||||
#include <QFileInfo>
|
||||
|
||||
FileSettings::FileSettings(QString directory) : FileSettingsBase(directory)
|
||||
{
|
||||
my_settings = new QSettings(directory + "/smplayer_files.ini", QSettings::IniFormat);
|
||||
}
|
||||
|
||||
FileSettings::~FileSettings() {
|
||||
delete my_settings;
|
||||
}
|
||||
|
||||
QString FileSettings::filenameToGroupname(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;
|
||||
}
|
||||
|
||||
bool FileSettings::existSettingsFor(QString filename) {
|
||||
qDebug("FileSettings::existSettingsFor: '%s'", filename.toUtf8().constData());
|
||||
|
||||
QString group_name = filenameToGroupname(filename);
|
||||
|
||||
qDebug("FileSettings::existSettingsFor: group_name: '%s'", group_name.toUtf8().constData());
|
||||
|
||||
my_settings->beginGroup( group_name );
|
||||
bool saved = my_settings->value("saved", false).toBool();
|
||||
my_settings->endGroup();
|
||||
|
||||
return saved;
|
||||
}
|
||||
|
||||
void FileSettings::loadSettingsFor(QString filename, MediaSettings & mset) {
|
||||
qDebug("FileSettings::loadSettingsFor: '%s'", filename.toUtf8().constData());
|
||||
|
||||
QString group_name = filenameToGroupname(filename);
|
||||
|
||||
qDebug("FileSettings::loadSettingsFor: group_name: '%s'", group_name.toUtf8().constData());
|
||||
|
||||
mset.reset();
|
||||
my_settings->beginGroup( group_name );
|
||||
mset.load(my_settings);
|
||||
my_settings->endGroup();
|
||||
}
|
||||
|
||||
void FileSettings::saveSettingsFor(QString filename, MediaSettings & mset) {
|
||||
qDebug("FileSettings::saveSettingsFor: '%s'", filename.toUtf8().constData());
|
||||
|
||||
QString group_name = filenameToGroupname(filename);
|
||||
|
||||
qDebug("FileSettings::saveSettingsFor: group_name: '%s'", group_name.toUtf8().constData());
|
||||
|
||||
my_settings->beginGroup( group_name );
|
||||
my_settings->setValue("saved", true);
|
||||
mset.save(my_settings);
|
||||
my_settings->endGroup();
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 _FILESETTINGS_H_
|
||||
#define _FILESETTINGS_H_
|
||||
|
||||
#include "filesettingsbase.h"
|
||||
|
||||
class QSettings;
|
||||
|
||||
class FileSettings : public FileSettingsBase
|
||||
{
|
||||
public:
|
||||
FileSettings(QString directory);
|
||||
virtual ~FileSettings();
|
||||
|
||||
virtual bool existSettingsFor(QString filename);
|
||||
|
||||
virtual void loadSettingsFor(QString filename, MediaSettings & mset);
|
||||
|
||||
virtual void saveSettingsFor(QString filename, MediaSettings & mset);
|
||||
|
||||
static QString filenameToGroupname(const QString & filename);
|
||||
|
||||
private:
|
||||
QSettings * my_settings;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,20 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 "filesettingsbase.h"
|
||||
|
@ -0,0 +1,43 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 _FILESETTINGS_BASE_H_
|
||||
#define _FILESETTINGS_BASE_H_
|
||||
|
||||
#include <QString>
|
||||
|
||||
class MediaSettings;
|
||||
|
||||
class FileSettingsBase
|
||||
{
|
||||
public:
|
||||
FileSettingsBase(QString directory) { output_directory = directory; };
|
||||
virtual ~FileSettingsBase() {};
|
||||
|
||||
virtual bool existSettingsFor(QString filename) = 0;
|
||||
|
||||
virtual void loadSettingsFor(QString filename, MediaSettings & mset) = 0;
|
||||
|
||||
virtual void saveSettingsFor(QString filename, MediaSettings & mset) = 0;
|
||||
|
||||
protected:
|
||||
QString output_directory;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,102 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 "filesettingshash.h"
|
||||
#include "mediasettings.h"
|
||||
#include "osparser.h" // hash function
|
||||
#include <QSettings>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
|
||||
FileSettingsHash::FileSettingsHash(QString directory) : FileSettingsBase(directory)
|
||||
{
|
||||
base_dir = directory + "/file_settings";
|
||||
}
|
||||
|
||||
FileSettingsHash::~FileSettingsHash() {
|
||||
}
|
||||
|
||||
|
||||
QString FileSettingsHash::configFile(const QString & filename, QString * output_dir) {
|
||||
QString res;
|
||||
|
||||
QString hash = OSParser::calculateHash(filename);
|
||||
if (!hash.isEmpty()) {
|
||||
if (output_dir != 0) (*output_dir) = hash[0];
|
||||
res = base_dir +"/"+ hash[0] +"/"+ hash + ".ini";
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
bool FileSettingsHash::existSettingsFor(QString filename) {
|
||||
qDebug("FileSettingsHash::existSettingsFor: '%s'", filename.toUtf8().constData());
|
||||
|
||||
QString config_file = configFile(filename);
|
||||
|
||||
qDebug("FileSettingsHash::existSettingsFor: config_file: '%s'", config_file.toUtf8().constData());
|
||||
|
||||
return QFile::exists(config_file);
|
||||
}
|
||||
|
||||
void FileSettingsHash::loadSettingsFor(QString filename, MediaSettings & mset) {
|
||||
qDebug("FileSettings::loadSettingsFor: '%s'", filename.toUtf8().constData());
|
||||
|
||||
QString config_file = configFile(filename);
|
||||
|
||||
qDebug("FileSettingsHash::loadSettingsFor: config_file: '%s'", config_file.toUtf8().constData());
|
||||
|
||||
mset.reset();
|
||||
|
||||
if ((!config_file.isEmpty()) && (QFile::exists(config_file))) {
|
||||
QSettings settings(config_file, QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup("file_settings");
|
||||
mset.load(&settings);
|
||||
settings.endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void FileSettingsHash::saveSettingsFor(QString filename, MediaSettings & mset) {
|
||||
qDebug("FileSettingsHash::saveSettingsFor: '%s'", filename.toUtf8().constData());
|
||||
|
||||
QString output_dir;
|
||||
QString config_file = configFile(filename, &output_dir);
|
||||
|
||||
qDebug("FileSettingsHash::saveSettingsFor: config_file: '%s'", config_file.toUtf8().constData());
|
||||
qDebug("FileSettingsHash::saveSettingsFor: output_dir: '%s'", output_dir.toUtf8().constData());
|
||||
|
||||
if (!config_file.isEmpty()) {
|
||||
QDir d(base_dir);
|
||||
if (!d.exists(output_dir)) {
|
||||
if (!d.mkpath(output_dir)) {
|
||||
qWarning("FileSettingsHash::saveSettingsFor: can't create directory '%s'", QString(base_dir + "/" + output_dir).toUtf8().constData());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QSettings settings(config_file, QSettings::IniFormat);
|
||||
|
||||
/* settings.setValue("filename", filename); */
|
||||
|
||||
settings.beginGroup("file_settings");
|
||||
mset.save(&settings);
|
||||
settings.endGroup();
|
||||
settings.sync();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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 _FILESETTINGS_HASH_H_
|
||||
#define _FILESETTINGS_HASH_H_
|
||||
|
||||
#include "filesettingsbase.h"
|
||||
|
||||
class FileSettingsHash : public FileSettingsBase
|
||||
{
|
||||
public:
|
||||
FileSettingsHash(QString directory);
|
||||
virtual ~FileSettingsHash();
|
||||
|
||||
virtual bool existSettingsFor(QString filename);
|
||||
|
||||
virtual void loadSettingsFor(QString filename, MediaSettings & mset);
|
||||
|
||||
virtual void saveSettingsFor(QString filename, MediaSettings & mset);
|
||||
|
||||
private:
|
||||
QString configFile(const QString & filename, QString * output_dir = 0);
|
||||
QString base_dir;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,110 @@
|
||||
/* smplayer, GUI front-end for mplayer.
|
||||
Copyright (C) 2006-2008 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
|
||||
*/
|
||||
|
||||
/* Based on the Qt network/http example */
|
||||
|
||||
#include "filedownloader.h"
|
||||
#include <QHttp>
|
||||
#include <QTimer>
|
||||
|
||||
FileDownloader::FileDownloader(QWidget *parent) : QProgressDialog(parent)
|
||||
{
|
||||
setMinimumDuration(0);
|
||||
|
||||
http = new QHttp(this);
|
||||
|
||||
connect(http, SIGNAL(requestFinished(int, bool)),
|
||||
this, SLOT(httpRequestFinished(int, bool)));
|
||||
connect(http, SIGNAL(dataReadProgress(int, int)),
|
||||
this, SLOT(updateDataReadProgress(int, int)));
|
||||
connect(http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)),
|
||||
this, SLOT(readResponseHeader(const QHttpResponseHeader &)));
|
||||
connect(this, SIGNAL(canceled()), this, SLOT(cancelDownload()));
|
||||
|
||||
setWindowTitle(tr("Downloading..."));
|
||||
}
|
||||
|
||||
FileDownloader::~FileDownloader() {
|
||||
//qDebug("FileDownloader::~FileDownloader");
|
||||
delete http;
|
||||
}
|
||||
|
||||
void FileDownloader::setProxy(QNetworkProxy proxy) {
|
||||
http->abort();
|
||||
http->setProxy(proxy);
|
||||
|
||||
qDebug("FileDownloader::setProxy: host: '%s' port: %d type: %d",
|
||||
proxy.hostName().toUtf8().constData(), proxy.port(), proxy.type());
|
||||
}
|
||||
|
||||
void FileDownloader::download(QUrl url) {
|
||||
QHttp::ConnectionMode mode = url.scheme().toLower() == "https" ? QHttp::ConnectionModeHttps : QHttp::ConnectionModeHttp;
|
||||
http->setHost(url.host(), mode, url.port() == -1 ? 0 : url.port());
|
||||
|
||||
if (!url.userName().isEmpty())
|
||||
http->setUser(url.userName(), url.password());
|
||||
|
||||
http_request_aborted = false;
|
||||
http_get_id = http->get(url.path(), &buffer);
|
||||
|
||||
setLabelText(tr("Downloading %1").arg(url.toString()));
|
||||
}
|
||||
|
||||
void FileDownloader::cancelDownload() {
|
||||
http_request_aborted = true;
|
||||
http->abort();
|
||||
}
|
||||
|
||||
void FileDownloader::httpRequestFinished(int request_id, bool error) {
|
||||
qDebug("FileDownloader::httpRequestFinished: request_id %d, error %d", request_id, error);
|
||||
|
||||
if (request_id != http_get_id) return;
|
||||
|
||||
if (http_request_aborted) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
hide();
|
||||
|
||||
if (error) {
|
||||
emit downloadFailed(http->errorString());
|
||||
} else {
|
||||
emit downloadFinished(buffer.data());
|
||||
}
|
||||
}
|
||||
|
||||
void FileDownloader::readResponseHeader(const QHttpResponseHeader &responseHeader) {
|
||||
if (responseHeader.statusCode() != 200) {
|
||||
emit downloadFailed(responseHeader.reasonPhrase());
|
||||
http_request_aborted = true;
|
||||
hide();
|
||||
http->abort();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void FileDownloader::updateDataReadProgress(int bytes_read, int total_bytes) {
|
||||
if (http_request_aborted) return;
|
||||
|
||||
setMaximum(total_bytes);
|
||||
setValue(bytes_read);
|
||||
}
|
||||
|
||||
#include "moc_filedownloader.cpp"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user