added latest smplayer sources with fixes for compile as lib.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@365 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-02-29 18:49:42 +00:00
parent fae3182079
commit acff1f81a0
296 changed files with 163927 additions and 0 deletions

View File

@ -0,0 +1,139 @@
#############################################################################
# Makefile for building: libsmplayer
# Generated by qmake (2.01a) (Qt 4.3.2) on: Fr 29. Feb 19:16:29 2008
# Project: smplayer.pro
# Template: lib
# Command: d:\Qt\4.3.2\bin\qmake.exe -win32 -o Makefile smplayer.pro
#############################################################################
first: release
install: release-install
uninstall: release-uninstall
MAKEFILE = Makefile
QMAKE = d:\Qt\4.3.2\bin\qmake.exe
DEL_FILE = del
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
COPY = copy /y
COPY_FILE = $(COPY)
COPY_DIR = xcopy /s /q /y /i
INSTALL_FILE = $(COPY_FILE)
INSTALL_PROGRAM = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
DEL_FILE = del
SYMLINK =
DEL_DIR = rmdir
MOVE = move
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
SUBTARGETS = \
release \
debug
release: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release
release-make_default: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release
release-make_first: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release first
release-all: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release all
release-clean: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release clean
release-distclean: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release distclean
release-install: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release install
release-uninstall: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release uninstall
debug: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug
debug-make_default: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug
debug-make_first: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug first
debug-all: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug all
debug-clean: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug clean
debug-distclean: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug distclean
debug-install: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug install
debug-uninstall: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug uninstall
Makefile: smplayer.pro d:\Qt\4.3.2\mkspecs\win32-g++\qmake.conf d:\Qt\4.3.2\mkspecs\qconfig.pri \
d:\Qt\4.3.2\mkspecs\features\qt_functions.prf \
d:\Qt\4.3.2\mkspecs\features\qt_config.prf \
d:\Qt\4.3.2\mkspecs\features\exclusive_builds.prf \
d:\Qt\4.3.2\mkspecs\features\default_pre.prf \
d:\Qt\4.3.2\mkspecs\features\win32\default_pre.prf \
d:\Qt\4.3.2\mkspecs\features\release.prf \
d:\Qt\4.3.2\mkspecs\features\debug_and_release.prf \
d:\Qt\4.3.2\mkspecs\features\default_post.prf \
d:\Qt\4.3.2\mkspecs\features\staticlib.prf \
d:\Qt\4.3.2\mkspecs\features\static.prf \
d:\Qt\4.3.2\mkspecs\features\win32\rtti.prf \
d:\Qt\4.3.2\mkspecs\features\win32\exceptions.prf \
d:\Qt\4.3.2\mkspecs\features\win32\stl.prf \
d:\Qt\4.3.2\mkspecs\features\warn_on.prf \
d:\Qt\4.3.2\mkspecs\features\qt.prf \
d:\Qt\4.3.2\mkspecs\features\win32\thread.prf \
d:\Qt\4.3.2\mkspecs\features\moc.prf \
d:\Qt\4.3.2\mkspecs\features\win32\windows.prf \
d:\Qt\4.3.2\mkspecs\features\resources.prf \
d:\Qt\4.3.2\mkspecs\features\uic.prf \
d:\Qt\4.3.2\mkspecs\features\yacc.prf \
d:\Qt\4.3.2\mkspecs\features\lex.prf
$(QMAKE) -win32 -o Makefile smplayer.pro
d:\Qt\4.3.2\mkspecs\qconfig.pri:
d:\Qt\4.3.2\mkspecs\features\qt_functions.prf:
d:\Qt\4.3.2\mkspecs\features\qt_config.prf:
d:\Qt\4.3.2\mkspecs\features\exclusive_builds.prf:
d:\Qt\4.3.2\mkspecs\features\default_pre.prf:
d:\Qt\4.3.2\mkspecs\features\win32\default_pre.prf:
d:\Qt\4.3.2\mkspecs\features\release.prf:
d:\Qt\4.3.2\mkspecs\features\debug_and_release.prf:
d:\Qt\4.3.2\mkspecs\features\default_post.prf:
d:\Qt\4.3.2\mkspecs\features\staticlib.prf:
d:\Qt\4.3.2\mkspecs\features\static.prf:
d:\Qt\4.3.2\mkspecs\features\win32\rtti.prf:
d:\Qt\4.3.2\mkspecs\features\win32\exceptions.prf:
d:\Qt\4.3.2\mkspecs\features\win32\stl.prf:
d:\Qt\4.3.2\mkspecs\features\warn_on.prf:
d:\Qt\4.3.2\mkspecs\features\qt.prf:
d:\Qt\4.3.2\mkspecs\features\win32\thread.prf:
d:\Qt\4.3.2\mkspecs\features\moc.prf:
d:\Qt\4.3.2\mkspecs\features\win32\windows.prf:
d:\Qt\4.3.2\mkspecs\features\resources.prf:
d:\Qt\4.3.2\mkspecs\features\uic.prf:
d:\Qt\4.3.2\mkspecs\features\yacc.prf:
d:\Qt\4.3.2\mkspecs\features\lex.prf:
qmake: qmake_all FORCE
@$(QMAKE) -win32 -o Makefile smplayer.pro
qmake_all: FORCE
make_default: release-make_default debug-make_default FORCE
make_first: release-make_first debug-make_first FORCE
all: release-all debug-all FORCE
clean: release-clean debug-clean FORCE
distclean: release-distclean debug-distclean FORCE
-$(DEL_FILE) Makefile
release-mocclean: $(MAKEFILE).Release
$(MAKE) -f $(MAKEFILE).Release mocclean
debug-mocclean: $(MAKEFILE).Debug
$(MAKE) -f $(MAKEFILE).Debug mocclean
mocclean: release-mocclean debug-mocclean
release-mocables: $(MAKEFILE).Release
$(MAKE) -f $(MAKEFILE).Release mocables
debug-mocables: $(MAKEFILE).Debug
$(MAKE) -f $(MAKEFILE).Debug mocables
mocables: release-mocables debug-mocables
FORCE:
$(MAKEFILE).Release: Makefile
$(MAKEFILE).Debug: Makefile

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,175 @@
/* 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> &copy; 2006-2008 Ricardo Villalba &lt;rvm@escomposlinux.org&gt;<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 &lt;kbarcza@blackpanther.hu&gt;", tr("SMPlayer logo")) +
contr("Florin Braghis &lt;florin@libertv.ro&gt;", tr("file associations for Windows")) +
contr("Matvey Kozhev &lt;sikon@lucidfox.org&gt;", 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 &lt;peter.mendel@gmail.com&gt;") +
trad(tr("Italian"), "Giancarlo Scola &lt;giancarlo@codexcoop.it&gt;") +
trad(tr("French"), tr("%1, %2 and %3")
.arg("Olivier g &lt;1got@caramail.com&gt;")
.arg("Temet &lt;goondy@free.fr&gt;")
.arg("Kud Gray &lt;kud.gray@gmail.com&gt;") ) +
trad(tr("Simplified-Chinese"), "Tim Green &lt;iamtimgreen@gmail.com&gt;") +
trad(tr("Russian"), QString::fromUtf8("Белый Владимир &lt;wiselord1983@gmail.com&gt;"))+
trad(tr("Hungarian"), "Charles Barcza &lt;kbarcza@blackpanther.hu&gt;") +
trad(tr("Polish"), tr("%1 and %2")
.arg("qla &lt;qla0@vp.pl&gt;")
.arg("Jarek &lt;ajep9691@wp.pl&gt;") ) +
trad(tr("Japanese"), "Nardog &lt;nardog@e2umail.com&gt;") +
trad(tr("Dutch"), "Wesley S. &lt;wesley@ubuntu-nl.org&gt;") +
trad(tr("Ukrainian"), "Motsyo Gennadi &lt;drool@altlinux.ru&gt;") +
trad(tr("Portuguese - Brazil"), "Ventura &lt;ventura.barbeiro@terra.com.br&gt;") +
trad(tr("Georgian"), "George Machitidze &lt;giomac@gmail.com&gt;") +
trad(tr("Czech"), QString::fromUtf8("Martin Dvořák &lt;martin.dvorak@centrum.cz&gt;")) +
trad(tr("Bulgarian"), "&lt;marzeliv@mail.bg&gt;") +
trad(tr("Turkish"), "alper er &lt;alperer@gmail.com&gt;") +
trad(tr("Swedish"), "Leif Larsson &lt;leif.larsson@gmail.com&gt;") +
trad(tr("Serbian"), "Kunalagon Umuhanik &lt;kunalagon@gmail.com&gt;") +
trad(tr("Traditional Chinese"), "Hoopoe &lt;dai715.tw@yahoo.com.tw&gt;") +
trad(tr("Romanian"), "DoruH &lt;doruhushhush@hotmail.com&gt;") +
trad(tr("Portuguese - Portugal"), "Waxman &lt;waxman.pt@gmail.com&gt;") +
trad(tr("Greek"), "my80s &lt;wamy80s@gmail.com&gt;") +
trad(tr("Finnish"), "peeaivo &lt;peeaivo@gmail.com&gt;") +
trad(tr("Korean"), "Heesu Yoon &lt;imsu30@gmail.com&gt;") +
"</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"

View 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 _ABOUT_H_
#define _ABOUT_H_
#include "ui_about.h"
#include <QDialog>
//! Shows the about smplayer dialog
/*!
Displays copyright info, license, translators...
*/
class About : public QDialog, public Ui::About
{
Q_OBJECT
public:
About( QWidget * parent = 0, Qt::WindowFlags f = 0 );
~About();
protected:
QString getTranslators();
//! Return a formatted string with the translator and language
QString trad(const QString & lang, const QString & author);
QString link(const QString & url, QString name = "");
//! Return a formatted string with the contributor and what he did
QString contr(const QString & author, const QString & thing);
};
#endif

View File

@ -0,0 +1,290 @@
<ui version="4.0" >
<class>About</class>
<widget class="QDialog" name="About" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>518</width>
<height>326</height>
</rect>
</property>
<property name="windowTitle" >
<string>About SMPlayer</string>
</property>
<property name="windowIcon" >
<iconset/>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QTabWidget" name="tabWidget" >
<property name="tabShape" >
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex" >
<number>0</number>
</property>
<widget class="QWidget" name="info_tab" >
<attribute name="title" >
<string>&amp;Info</string>
</attribute>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="logo" >
<property name="text" >
<string>icon</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>111</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTextBrowser" name="info" >
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Plain</enum>
</property>
<property name="openExternalLinks" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="contributions_tab" >
<attribute name="title" >
<string>&amp;Contributions</string>
</attribute>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="contrib_icon" >
<property name="text" >
<string>icon</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>111</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTextBrowser" name="contributions" >
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Plain</enum>
</property>
<property name="openExternalLinks" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="translations_tab" >
<attribute name="title" >
<string>&amp;Translators</string>
</attribute>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="translators_icon" >
<property name="text" >
<string>icon</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>111</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTextBrowser" name="translators" >
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Plain</enum>
</property>
<property name="openExternalLinks" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="license_tab" >
<attribute name="title" >
<string>&amp;License</string>
</attribute>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="license_icon" >
<property name="text" >
<string>icon</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>111</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QTextBrowser" name="license" >
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Plain</enum>
</property>
<property name="openExternalLinks" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>About</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,160 @@
/* 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 "aboutdialog.h"
#include <QLabel>
#include <QTextEdit>
#include <QPushButton>
#include <QLayout>
#include <QDialogButtonBox>
#include "images.h"
#include "version.h"
AboutDialog::AboutDialog(QWidget * parent, Qt::WindowFlags f)
: QDialog(parent, f)
{
setWindowTitle( tr("About SMPlayer") );
logo = new QLabel(this);
logo->setPixmap( Images::icon("logo", 64) );
intro = new QLabel(this);
intro->setWordWrap(true);
foot = new QLabel(this);
foot->setOpenExternalLinks(true);
credits = new QTextEdit(this);
credits->setReadOnly(true);
credits->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
ok_button = new QDialogButtonBox( QDialogButtonBox::Ok );
connect( ok_button, SIGNAL(accepted()), this, SLOT(accept()) );
QVBoxLayout * lright = new QVBoxLayout;
lright->addWidget( intro );
lright->addWidget( credits );
lright->addWidget( foot );
QVBoxLayout * lleft = new QVBoxLayout;
lleft->addWidget( logo );
lleft->addStretch(1);
QHBoxLayout * lmain = new QHBoxLayout;
lmain->addLayout( lleft );
lmain->addLayout( lright );
QHBoxLayout * lbutton = new QHBoxLayout;
lbutton->addStretch(1);
lbutton->addWidget( ok_button );
lbutton->addStretch(1);
QVBoxLayout * lwidget = new QVBoxLayout(this);
lwidget->addLayout( lmain );
//lwidget->addWidget( foot );
lwidget->addLayout( lbutton );
intro->setText(
"<b>SMPlayer</b> &copy; 2006-2008 RVM &lt;rvm@escomposlinux.org&gt;<br><br>"
"<b>" + tr("Version: %1").arg(smplayerVersion()) + "</b><br>" +
/*
#if KDE_SUPPORT
tr("Compiled with KDE support") + "<br>" +
#endif
*/
"<br>" +
tr("Compiled with Qt %1").arg(QT_VERSION_STR) + "<br><br>"
"<i>" +
tr("This program is free software; you can redistribute it and/or modify "
"it under the terms of the GNU General Public License as published by "
"the Free Software Foundation; either version 2 of the License, or "
"(at your option) any later version.") + "</i>");
credits->setText(
tr("Translators:") +
"<ul>" +
trad(tr("German"), "Henrikx") +
trad(tr("Slovak"), "Sweto &lt;peter.mendel@gmail.com&gt;") +
trad(tr("Italian"), "Giancarlo Scola &lt;giancarlo@codexcoop.it&gt;") +
trad(tr("French"), tr("%1, %2 and %3")
.arg("Olivier g &lt;1got@caramail.com&gt;")
.arg("Temet &lt;goondy@free.fr&gt;")
.arg("Kud Gray &lt;kud.gray@gmail.com&gt;") ) +
trad(tr("Simplified-Chinese"), "Tim Green &lt;iamtimgreen@gmail.com&gt;") +
trad(tr("Russian"), tr("%1 and %2")
.arg("Yurkovsky Andrey &lt;anyr@tut.by&gt;")
.arg(QString::fromUtf8("Белый Владимир &lt;wiselord1983@gmail.com&gt;")))+
trad(tr("Hungarian"), "Charles Barcza &lt;kbarcza@blackpanther.hu&gt;") +
trad(tr("Polish"), tr("%1 and %2")
.arg("qla &lt;qla0@vp.pl&gt;")
.arg("Jarek &lt;ajep9691@wp.pl&gt;") ) +
trad(tr("Japanese"), "Nardog &lt;nardog@e2umail.com&gt;") +
trad(tr("Dutch"), "Wesley S. &lt;wesley@ubuntu-nl.org&gt;") +
trad(tr("Ukrainian"), "Motsyo Gennadi &lt;drool@altlinux.ru&gt;") +
trad(tr("Portuguese - Brazil"), "Ventura &lt;ventura.barbeiro@terra.com.br&gt;") +
trad(tr("Georgian"), "George Machitidze &lt;giomac@gmail.com&gt;") +
trad(tr("Czech"), QString::fromUtf8("Martin Dvořák &lt;martin.dvorak@centrum.cz&gt;")) +
trad(tr("Bulgarian"), "&lt;marzeliv@mail.bg&gt;") +
trad(tr("Turkish"), "alper er &lt;alperer@gmail.com&gt;") +
trad(tr("Swedish"), "Leif Larsson &lt;leif.larsson@gmail.com&gt;") +
trad(tr("Serbian"), "Kunalagon Umuhanik &lt;kunalagon@gmail.com&gt;") +
trad(tr("Traditional Chinese"), "Hoopoe &lt;dai715.tw@yahoo.com.tw&gt;") +
trad(tr("Romanian"), "DoruH &lt;doruhushhush@hotmail.com&gt;") +
trad(tr("Portuguese - Portugal"), "Waxman &lt;waxman.pt@gmail.com&gt;") +
trad(tr("Greek"), "my80s &lt;wamy80s@gmail.com&gt;") +
trad(tr("Finnish"), "peeaivo &lt;peeaivo@gmail.com&gt;") +
"</ul>" +
tr("Logo designed by %1").arg("Charles Barcza &lt;kbarcza@blackpanther.hu&gt;") +
"<br>"
);
QString url;
/*
#ifdef Q_OS_WIN
url = tr("http://smplayer.sourceforge.net/en/windows/download.php",
"If the web page is translated into your language you can "
"change the URL so it points to the download page in the translation."
"Otherwise leave as is.");
#else
url = tr("http://smplayer.sourceforge.net/en/linux/download.php",
"If the web page is translated into your language you can "
"change the URL so it points to the download page in the translation."
"Otherwise leave as is.");
#endif
*/
url = "http://smplayer.sourceforge.net";
foot->setText(
tr("Get updates at: %1")
.arg("<br><a href=\"" + url + "\">" + url +"</a>") );
/*
adjustSize();
setFixedSize( sizeHint() );
*/
}
AboutDialog::~AboutDialog() {
}
QString AboutDialog::trad(const QString & lang, const QString & author) {
return "<li>"+ tr("<b>%1</b>: %2").arg(lang).arg(author) + "</li>";
}
#include "moc_aboutdialog.cpp"

View File

@ -0,0 +1,54 @@
/* 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 _ABOUTDIALOG_H_
#define _ABOUTDIALOG_H_
#include <QDialog>
class QLabel;
class QTextEdit;
class QDialogButtonBox;
//! Shows the about smplayer dialog
/*!
Displays copyright info, license, translators...
*/
class AboutDialog : public QDialog
{
Q_OBJECT
public:
AboutDialog( QWidget * parent = 0, Qt::WindowFlags f = 0 );
~AboutDialog();
protected:
//! Return a formated string with the translator and language
QString trad(const QString & lang, const QString & author);
QLabel * logo;
QLabel * intro;
QLabel * foot;
QTextEdit * credits;
QDialogButtonBox * ok_button;
};
#endif

View File

@ -0,0 +1,618 @@
/* 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
*/
/* This is based on qq14-actioneditor-code.zip from Qt */
#include "actionseditor.h"
#include <QTableWidget>
#include <QHeaderView>
#include <QLayout>
#include <QObject>
#include <QPushButton>
#include <QString>
#include <QSettings>
#include <QFile>
#include <QTextStream>
#include <QMessageBox>
#include <QFileInfo>
#include <QRegExp>
#include <QApplication>
#include <QAction>
#include "images.h"
#include "filedialog.h"
#include "helper.h"
#include "shortcutgetter.h"
/*
#include <QLineEdit>
#include <QItemDelegate>
class MyDelegate : public QItemDelegate
{
public:
MyDelegate(QObject *parent = 0);
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const;
virtual void setModelData(QWidget * editor, QAbstractItemModel * model,
const QModelIndex & index ) const;
};
MyDelegate::MyDelegate(QObject *parent) : QItemDelegate(parent)
{
}
static QString old_accel_text;
QWidget * MyDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem & option,
const QModelIndex & index) const
{
qDebug("MyDelegate::createEditor");
old_accel_text = index.model()->data(index, Qt::DisplayRole).toString();
//qDebug( "text: %s", old_accel_text.toUtf8().data());
return QItemDelegate::createEditor(parent, option, index);
}
void MyDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
QLineEdit *line_edit = static_cast<QLineEdit*>(editor);
QString accelText = QKeySequence(line_edit->text()).toString();
if (accelText.isEmpty() && !line_edit->text().isEmpty()) {
model->setData(index, old_accel_text);
}
else {
model->setData(index, accelText);
}
}
*/
#if USE_MULTIPLE_SHORTCUTS
QString ActionsEditor::shortcutsToString(QList <QKeySequence> shortcuts_list) {
QString accelText = "";
for (int n=0; n < shortcuts_list.count(); n++) {
accelText += shortcuts_list[n].toString(QKeySequence::PortableText);
if (n < (shortcuts_list.count()-1)) accelText += ", ";
}
return accelText;
}
QList <QKeySequence> ActionsEditor::stringToShortcuts(QString shortcuts) {
QList <QKeySequence> shortcuts_list;
QStringList l = shortcuts.split(',');
for (int n=0; n < l.count(); n++) {
//qDebug("%s", l[n].toUtf8().data());
QString s = QKeySequence( l[n].simplified() );
//Work-around for Simplified-Chinese
s.replace( QString::fromUtf8(""), "Left");
s.replace( QString::fromUtf8(""), "Down");
s.replace( QString::fromUtf8(""), "Right");
s.replace( QString::fromUtf8(""), "Up");
shortcuts_list.append( s );
//qDebug("ActionsEditor::stringToShortcuts: shortcut %d: '%s'", n, s.toUtf8().data());
}
return shortcuts_list;
}
#endif
#define COL_CONFLICTS 0
#define COL_SHORTCUT 1
#define COL_DESC 2
#define COL_NAME 3
ActionsEditor::ActionsEditor(QWidget * parent, Qt::WindowFlags f)
: QWidget(parent, f)
{
latest_dir = Helper::shortcutsPath();
actionsTable = new QTableWidget(0, COL_NAME +1, this);
actionsTable->setSelectionMode( QAbstractItemView::SingleSelection );
actionsTable->verticalHeader()->hide();
actionsTable->horizontalHeader()->setResizeMode(COL_DESC, QHeaderView::Stretch);
actionsTable->horizontalHeader()->setResizeMode(COL_NAME, QHeaderView::Stretch);
actionsTable->setAlternatingRowColors(true);
#if USE_SHORTCUTGETTER
actionsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
actionsTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
#endif
//actionsTable->setItemDelegateForColumn( COL_SHORTCUT, new MyDelegate(actionsTable) );
#if !USE_SHORTCUTGETTER
connect(actionsTable, SIGNAL(currentItemChanged(QTableWidgetItem *,QTableWidgetItem *)),
this, SLOT(recordAction(QTableWidgetItem *)) );
connect(actionsTable, SIGNAL(itemChanged(QTableWidgetItem *)),
this, SLOT(validateAction(QTableWidgetItem *)) );
#else
connect(actionsTable, SIGNAL(itemActivated(QTableWidgetItem *)),
this, SLOT(editShortcut()) );
#endif
saveButton = new QPushButton(this);
loadButton = new QPushButton(this);
connect(saveButton, SIGNAL(clicked()), this, SLOT(saveActionsTable()));
connect(loadButton, SIGNAL(clicked()), this, SLOT(loadActionsTable()));
#if USE_SHORTCUTGETTER
editButton = new QPushButton(this);
connect( editButton, SIGNAL(clicked()), this, SLOT(editShortcut()) );
#endif
QHBoxLayout *buttonLayout = new QHBoxLayout;
buttonLayout->setSpacing(8);
#if USE_SHORTCUTGETTER
buttonLayout->addWidget(editButton);
#endif
buttonLayout->addStretch(1);
buttonLayout->addWidget(loadButton);
buttonLayout->addWidget(saveButton);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setMargin(8);
mainLayout->setSpacing(8);
mainLayout->addWidget(actionsTable);
mainLayout->addLayout(buttonLayout);
retranslateStrings();
}
ActionsEditor::~ActionsEditor() {
}
void ActionsEditor::retranslateStrings() {
actionsTable->setHorizontalHeaderLabels( QStringList() << "" <<
tr("Shortcut") << tr("Description") << tr("Name") );
saveButton->setText(tr("&Save"));
saveButton->setIcon(Images::icon("save"));
loadButton->setText(tr("&Load"));
loadButton->setIcon(Images::icon("open"));
#if USE_SHORTCUTGETTER
editButton->setText(tr("&Change shortcut..."));
#endif
//updateView(); // The actions are translated later, so it's useless
}
bool ActionsEditor::isEmpty() {
return actionsList.isEmpty();
}
void ActionsEditor::clear() {
actionsList.clear();
}
void ActionsEditor::addActions(QWidget *widget) {
QAction *action;
QList<QAction *> actions = widget->findChildren<QAction *>();
for (int n=0; n < actions.count(); n++) {
action = static_cast<QAction*> (actions[n]);
if (!action->objectName().isEmpty())
actionsList.append(action);
}
updateView();
}
void ActionsEditor::updateView() {
actionsTable->setRowCount( actionsList.count() );
QAction *action;
QString accelText;
#if !USE_SHORTCUTGETTER
dont_validate = true;
#endif
//actionsTable->setSortingEnabled(false);
for (int n=0; n < actionsList.count(); n++) {
action = static_cast<QAction*> (actionsList[n]);
#if USE_MULTIPLE_SHORTCUTS
accelText = shortcutsToString( action->shortcuts() );
#else
accelText = action->shortcut().toString();
#endif
// Conflict column
QTableWidgetItem * i_conf = new QTableWidgetItem();
// Name column
QTableWidgetItem * i_name = new QTableWidgetItem(action->objectName());
// Desc column
QTableWidgetItem * i_desc = new QTableWidgetItem(action->text().replace("&",""));
i_desc->setIcon( action->icon() );
// Shortcut column
QTableWidgetItem * i_shortcut = new QTableWidgetItem(accelText);
// Set flags
#if !USE_SHORTCUTGETTER
i_conf->setFlags(Qt::ItemIsEnabled);
i_name->setFlags(Qt::ItemIsEnabled);
i_desc->setFlags(Qt::ItemIsEnabled);
#else
i_conf->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
i_name->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
i_desc->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
i_shortcut->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
#endif
// Add items to table
actionsTable->setItem(n, COL_CONFLICTS, i_conf );
actionsTable->setItem(n, COL_NAME, i_name );
actionsTable->setItem(n, COL_DESC, i_desc );
actionsTable->setItem(n, COL_SHORTCUT, i_shortcut );
}
hasConflicts(); // Check for conflicts
actionsTable->resizeColumnsToContents();
actionsTable->setCurrentCell(0, COL_SHORTCUT);
#if !USE_SHORTCUTGETTER
dont_validate = false;
#endif
//actionsTable->setSortingEnabled(true);
}
void ActionsEditor::applyChanges() {
qDebug("ActionsEditor::applyChanges");
for (int row = 0; row < (int)actionsList.size(); ++row) {
QAction *action = actionsList[row];
QTableWidgetItem *i = actionsTable->item(row, COL_SHORTCUT);
#if USE_MULTIPLE_SHORTCUTS
action->setShortcuts( stringToShortcuts(i->text()) );
#else
action->setShortcut( QKeySequence(i->text()) );
#endif
}
}
#if !USE_SHORTCUTGETTER
void ActionsEditor::recordAction(QTableWidgetItem * i) {
//qDebug("ActionsEditor::recordAction");
//QTableWidgetItem * i = actionsTable->currentItem();
if (i->column() == COL_SHORTCUT) {
//qDebug("ActionsEditor::recordAction: %d %d %s", i->row(), i->column(), i->text().toUtf8().data());
oldAccelText = i->text();
}
}
void ActionsEditor::validateAction(QTableWidgetItem * i) {
//qDebug("ActionsEditor::validateAction");
if (dont_validate) return;
if (i->column() == COL_SHORTCUT) {
QString accelText = QKeySequence(i->text()).toString();
if (accelText.isEmpty() && !i->text().isEmpty()) {
/*
QAction * action = static_cast<QAction*> (actionsList[i->row()]);
QString oldAccelText= action->accel().toString();
*/
i->setText(oldAccelText);
}
else {
i->setText(accelText);
}
if (hasConflicts()) qApp->beep();
}
}
#else
void ActionsEditor::editShortcut() {
QTableWidgetItem * i = actionsTable->item( actionsTable->currentRow(), COL_SHORTCUT );
if (i) {
ShortcutGetter d;
QString result = d.exec( i->text() );
if (!result.isNull()) {
QString accelText = QKeySequence(result).toString(QKeySequence::PortableText);
i->setText(accelText);
if (hasConflicts()) qApp->beep();
}
}
}
#endif
int ActionsEditor::findActionName(const QString & name) {
for (int row=0; row < actionsTable->rowCount(); row++) {
if (actionsTable->item(row, COL_NAME)->text() == name) return row;
}
return -1;
}
int ActionsEditor::findActionAccel(const QString & accel, int ignoreRow) {
for (int row=0; row < actionsTable->rowCount(); row++) {
QTableWidgetItem * i = actionsTable->item(row, COL_SHORTCUT);
if ( (i) && (i->text() == accel) ) {
if (ignoreRow == -1) return row;
else
if (ignoreRow != row) return row;
}
}
return -1;
}
bool ActionsEditor::hasConflicts() {
int found;
bool conflict = false;
QString accelText;
QTableWidgetItem *i;
for (int n=0; n < actionsTable->rowCount(); n++) {
//actionsTable->setText( n, COL_CONFLICTS, " ");
i = actionsTable->item( n, COL_CONFLICTS );
if (i) i->setIcon( QPixmap() );
i = actionsTable->item(n, COL_SHORTCUT );
if (i) {
accelText = i->text();
if (!accelText.isEmpty()) {
found = findActionAccel( accelText, n );
if ( (found != -1) && (found != n) ) {
conflict = true;
//actionsTable->setText( n, COL_CONFLICTS, "!");
actionsTable->item( n, COL_CONFLICTS )->setIcon( Images::icon("conflict") );
}
}
}
}
//if (conflict) qApp->beep();
return conflict;
}
void ActionsEditor::saveActionsTable() {
QString s = MyFileDialog::getSaveFileName(
this, tr("Choose a filename"),
latest_dir,
tr("Key files") +" (*.keys)" );
if (!s.isEmpty()) {
// If filename has no extension, add it
if (QFileInfo(s).suffix().isEmpty()) {
s = s + ".keys";
}
if (QFileInfo(s).exists()) {
int res = QMessageBox::question( this,
tr("Confirm overwrite?"),
tr("The file %1 already exists.\n"
"Do you want to overwrite?").arg(s),
QMessageBox::Yes,
QMessageBox::No,
Qt::NoButton);
if (res == QMessageBox::No ) {
return;
}
}
latest_dir = QFileInfo(s).absolutePath();
bool r = saveActionsTable(s);
if (!r) {
QMessageBox::warning(this, tr("Error"),
tr("The file couldn't be saved"),
QMessageBox::Ok, Qt::NoButton);
}
}
}
bool ActionsEditor::saveActionsTable(const QString & filename) {
qDebug("ActionsEditor::saveActions: '%s'", filename.toUtf8().data());
QFile f( filename );
if ( f.open( QIODevice::WriteOnly ) ) {
QTextStream stream( &f );
stream.setCodec("UTF-8");
for (int row=0; row < actionsTable->rowCount(); row++) {
stream << actionsTable->item(row, COL_NAME)->text() << "\t"
<< actionsTable->item(row, COL_SHORTCUT)->text() << "\n";
}
f.close();
return true;
}
return false;
}
void ActionsEditor::loadActionsTable() {
QString s = MyFileDialog::getOpenFileName(
this, tr("Choose a file"),
latest_dir, tr("Key files") +" (*.keys)" );
if (!s.isEmpty()) {
latest_dir = QFileInfo(s).absolutePath();
bool r = loadActionsTable(s);
if (!r) {
QMessageBox::warning(this, tr("Error"),
tr("The file couldn't be loaded"),
QMessageBox::Ok, Qt::NoButton);
}
}
}
bool ActionsEditor::loadActionsTable(const QString & filename) {
qDebug("ActionsEditor::loadActions: '%s'", filename.toUtf8().data());
QRegExp rx("^(.*)\\t(.*)");
int row;
QFile f( filename );
if ( f.open( QIODevice::ReadOnly ) ) {
#if !USE_SHORTCUTGETTER
dont_validate = true;
#endif
QTextStream stream( &f );
stream.setCodec("UTF-8");
QString line;
while ( !stream.atEnd() ) {
line = stream.readLine();
qDebug("line: '%s'", line.toUtf8().data());
if (rx.indexIn(line) > -1) {
QString name = rx.cap(1);
QString accelText = rx.cap(2);
qDebug(" name: '%s' accel: '%s'", name.toUtf8().data(), accelText.toUtf8().data());
row = findActionName(name);
if (row > -1) {
qDebug("Action found!");
actionsTable->item(row, COL_SHORTCUT)->setText(accelText);
}
} else {
qDebug(" wrong line");
}
}
f.close();
hasConflicts(); // Check for conflicts
#if !USE_SHORTCUTGETTER
dont_validate = false;
#endif
return true;
} else {
return false;
}
}
// Static functions
void ActionsEditor::saveToConfig(QObject *o, QSettings *set) {
qDebug("ActionsEditor::saveToConfig");
set->beginGroup("actions");
QAction *action;
QList<QAction *> actions = o->findChildren<QAction *>();
for (int n=0; n < actions.count(); n++) {
action = static_cast<QAction*> (actions[n]);
if (!action->objectName().isEmpty()) {
#if USE_MULTIPLE_SHORTCUTS
QString accelText = shortcutsToString(action->shortcuts());
#else
QString accelText = action->shortcut().toString();
#endif
set->setValue(action->objectName(), accelText);
}
}
set->endGroup();
}
void ActionsEditor::loadFromConfig(QObject *o, QSettings *set) {
qDebug("ActionsEditor::loadFromConfig");
set->beginGroup("actions");
QAction *action;
QString accelText;
QList<QAction *> actions = o->findChildren<QAction *>();
for (int n=0; n < actions.count(); n++) {
action = static_cast<QAction*> (actions[n]);
if (!action->objectName().isEmpty()) {
#if USE_MULTIPLE_SHORTCUTS
QString current = shortcutsToString(action->shortcuts());
accelText = set->value(action->objectName(), current).toString();
action->setShortcuts( stringToShortcuts( accelText ) );
#else
accelText = set->value(action->objectName(), action->shortcut().toString()).toString();
action->setShortcut(QKeySequence(accelText));
#endif
}
}
set->endGroup();
}
QAction * ActionsEditor::findAction(QObject *o, const QString & name) {
QAction *action;
QList<QAction *> actions = o->findChildren<QAction *>();
for (int n=0; n < actions.count(); n++) {
action = static_cast<QAction*> (actions[n]);
if (name == action->objectName()) return action;
}
return 0;
}
QStringList ActionsEditor::actionsNames(QObject *o) {
QStringList l;
QAction *action;
QList<QAction *> actions = o->findChildren<QAction *>();
for (int n=0; n < actions.count(); n++) {
action = static_cast<QAction*> (actions[n]);
//qDebug("action name: '%s'", action->objectName().toUtf8().data());
//qDebug("action name: '%s'", action->text().toUtf8().data());
if (!action->objectName().isEmpty())
l.append( action->objectName() );
}
return l;
}
// Language change stuff
void ActionsEditor::changeEvent(QEvent *e) {
if (e->type() == QEvent::LanguageChange) {
retranslateStrings();
} else {
QWidget::changeEvent(e);
}
}
#include "moc_actionseditor.cpp"

View File

@ -0,0 +1,104 @@
/* 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
*/
/* This is based on qq14-actioneditor-code.zip from Qt */
#ifndef _ACTIONSEDITOR_H_
#define _ACTIONSEDITOR_H_
#include <QWidget>
#include <QList>
#include <QStringList>
#include "config.h"
class QTableWidget;
class QTableWidgetItem;
class QAction;
class QSettings;
class QPushButton;
class ActionsEditor : public QWidget
{
Q_OBJECT
public:
ActionsEditor( QWidget * parent = 0, Qt::WindowFlags f = 0 );
~ActionsEditor();
// Clear the actionlist
void clear();
// There are no actions yet?
bool isEmpty();
void addActions(QWidget * widget);
// Static functions
static QAction * findAction(QObject *o, const QString & name);
static QStringList actionsNames(QObject *o);
static void saveToConfig(QObject *o, QSettings *set);
static void loadFromConfig(QObject *o, QSettings *set);
#if USE_MULTIPLE_SHORTCUTS
static QString shortcutsToString(QList <QKeySequence> shortcuts_list);
static QList <QKeySequence> stringToShortcuts(QString shortcuts);
#endif
public slots:
void applyChanges();
void saveActionsTable();
bool saveActionsTable(const QString & filename);
void loadActionsTable();
bool loadActionsTable(const QString & filename);
void updateView();
protected:
virtual void retranslateStrings();
virtual void changeEvent ( QEvent * event ) ;
// Find in table, not in actionslist
int findActionName(const QString & name);
int findActionAccel(const QString & accel, int ignoreRow = -1);
bool hasConflicts();
protected slots:
#if !USE_SHORTCUTGETTER
void recordAction(QTableWidgetItem*);
void validateAction(QTableWidgetItem*);
#else
void editShortcut();
#endif
private:
QTableWidget *actionsTable;
QList<QAction*> actionsList;
QPushButton *saveButton;
QPushButton *loadButton;
QString latest_dir;
#if USE_SHORTCUTGETTER
QPushButton *editButton;
#else
QString oldAccelText;
bool dont_validate;
#endif
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,526 @@
/* 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 _BASEGUI_H_
#define _BASEGUI_H_
#include <QMainWindow>
#include "mediadata.h"
#include "mediasettings.h"
#include "preferences.h"
#include "core.h"
#include "config.h"
#ifdef Q_OS_WIN
/* Disable screensaver by event */
#include <windows.h>
#endif
class QWidget;
class QMenu;
class LogWindow;
class MplayerWindow;
class QLabel;
class FilePropertiesDialog;
class VideoEqualizer;
class Playlist;
class Recents;
class MyAction;
class MyActionGroup;
class PreferencesDialog;
class MyServer;
class BaseGui : public QMainWindow
{
Q_OBJECT
public:
BaseGui( QWidget* parent = 0, Qt::WindowFlags flags = 0 );
~BaseGui();
/* Return true if the window shouldn't show on startup */
virtual bool startHidden() { return false; };
//! Execute all actions in \a actions. The actions should be
//! separated by spaces. Checkable actions could have a parameter:
//! true or false.
void runActions(QString actions);
public slots:
virtual void open(QString file); // Generic open, autodetect type.
virtual void openFile();
virtual void openFile(QString file);
virtual void openFiles(QStringList files);
virtual void openURL();
virtual void openURL(QString url);
virtual void openVCD();
virtual void openAudioCD();
virtual void openDVD();
virtual void openDVDFromFolder();
virtual void openDVDFromFolder(QString directory);
virtual void openDirectory();
virtual void openDirectory(QString directory);
virtual void helpFAQ();
virtual void helpCLOptions();
virtual void helpAbout();
virtual void helpAboutQt();
virtual void loadSub();
virtual void loadAudioFile(); // Load external audio file
virtual void showPlaylist();
virtual void showPlaylist(bool b);
virtual void showEqualizer();
virtual void showEqualizer(bool b);
virtual void showMplayerLog();
virtual void showLog();
virtual void showPreferencesDialog();
virtual void showFilePropertiesDialog();
virtual void exitFullscreen();
virtual void toggleFullscreen();
virtual void toggleFullscreen(bool);
virtual void toggleCompactMode();
virtual void toggleCompactMode(bool);
virtual void toggleStayOnTop();
virtual void toggleStayOnTop(bool);
virtual void toggleFrameCounter();
virtual void toggleFrameCounter(bool);
protected slots:
virtual void closeWindow();
virtual void setJumpTexts();
// Replace for setCaption (in Qt 4 it's not virtual)
virtual void setWindowCaption(const QString & title);
//virtual void openRecent(int item);
virtual void openRecent();
virtual void enterFullscreenOnPlay();
virtual void exitFullscreenOnStop();
virtual void exitFullscreenIfNeeded();
virtual void playlistHasFinished();
virtual void displayState(Core::State state);
virtual void displayMessage(QString message);
virtual void gotCurrentTime(double);
virtual void initializeMenus();
virtual void updateWidgets();
virtual void updateEqualizer();
virtual void newMediaLoaded();
virtual void updateMediaInfo();
virtual void enableActionsOnPlaying();
virtual void disableActionsOnStop();
virtual void resizeWindow(int w, int h);
virtual void hidePanel();
/* virtual void playlistVisibilityChanged(); */
virtual void displayGotoTime(int);
//! 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( QPoint p );
/*
virtual void mouseReleaseEvent( QMouseEvent * e );
virtual void mouseDoubleClickEvent( QMouseEvent * e );
*/
virtual void wheelEvent( QWheelEvent * e ) ;
virtual void leftClickFunction();
virtual void doubleClickFunction();
virtual void middleClickFunction();
virtual void processFunction(QString function);
virtual void dragEnterEvent( QDragEnterEvent * ) ;
virtual void dropEvent ( QDropEvent * );
virtual void applyNewPreferences();
virtual void applyFileProperties();
virtual void clearRecentsList();
virtual void loadActions();
virtual void saveActions();
// Check the mouse pos in fullscreen mode, to
// show the controlwidget if it's moved to
// the bottom area.
virtual void checkMousePos( QPoint );
// Single instance stuff
// Another instance request open a file
virtual void remoteOpen(QString file);
virtual void remoteOpenFiles(QStringList files);
virtual void remoteAddFiles(QStringList files);
//! Called when core can't parse the mplayer version and there's no
//! version supplied by the user
void askForMplayerVersion(QString);
// stylesheet
virtual void loadQss(QString filename);
virtual void changeStyleSheet(QString style);
#if NEW_RESIZE_CODE
void calculateDiff(); //!< Updates diff_size
#endif
#ifdef Q_OS_WIN
/* Disable screensaver by event */
void clear_just_stopped();
#endif
signals:
void frameChanged(int);
void timeChanged(double, int, QString);
void cursorNearTop(QPoint);
void cursorNearBottom(QPoint);
void cursorFarEdges();
void wheelUp();
void wheelDown();
/*
void doubleClicked();
void leftClicked();
void middleClicked();
*/
protected:
virtual void retranslateStrings();
virtual void changeEvent(QEvent * event);
virtual void hideEvent( QHideEvent * );
virtual void showEvent( QShowEvent * );
#ifdef Q_OS_WIN
/* Disable screensaver by event */
virtual bool winEvent ( MSG * m, long * result );
#endif
virtual void aboutToEnterFullscreen();
virtual void aboutToExitFullscreen();
virtual void aboutToEnterCompactMode();
virtual void aboutToExitCompactMode();
protected:
void createCore();
void createMplayerWindow();
void createVideoEqualizer();
void createPlaylist();
void createPanel();
void createPreferencesDialog();
void createFilePropertiesDialog();
void setDataToFileProperties();
void initializeGui();
void createActions();
void setActionsEnabled(bool);
void createMenus();
void updateRecents();
void configureDiscDevices();
/* virtual void closeEvent( QCloseEvent * e ); */
protected:
QWidget * panel;
// Menu File
MyAction * openFileAct;
MyAction * openDirectoryAct;
MyAction * openPlaylistAct;
MyAction * openVCDAct;
MyAction * openAudioCDAct;
MyAction * openDVDAct;
MyAction * openDVDFolderAct;
MyAction * openURLAct;
MyAction * exitAct;
MyAction * clearRecentsAct;
// Menu Play
MyAction * playAct;
MyAction * playOrPauseAct;
MyAction * pauseAct;
MyAction * pauseAndStepAct;
MyAction * stopAct;
MyAction * frameStepAct;
MyAction * rewind1Act;
MyAction * rewind2Act;
MyAction * rewind3Act;
MyAction * forward1Act;
MyAction * forward2Act;
MyAction * forward3Act;
MyAction * repeatAct;
// Menu Speed
MyAction * normalSpeedAct;
MyAction * halveSpeedAct;
MyAction * doubleSpeedAct;
MyAction * decSpeedAct;
MyAction * incSpeedAct;
// Menu Video
MyAction * fullscreenAct;
MyAction * compactAct;
MyAction * equalizerAct;
MyAction * screenshotAct;
MyAction * onTopAct;
MyAction * flipAct;
MyAction * postProcessingAct;
MyAction * phaseAct;
MyAction * deblockAct;
MyAction * deringAct;
MyAction * addNoiseAct;
#if NEW_ASPECT_CODE
MyAction * addLetterboxAct;
#endif
MyAction * upscaleAct;
// Menu Audio
MyAction * muteAct;
MyAction * decVolumeAct;
MyAction * incVolumeAct;
MyAction * decAudioDelayAct;
MyAction * incAudioDelayAct;
MyAction * extrastereoAct;
MyAction * karaokeAct;
MyAction * volnormAct;
MyAction * loadAudioAct;
MyAction * unloadAudioAct;
// Menu Subtitles
MyAction * loadSubsAct;
MyAction * unloadSubsAct;
MyAction * decSubDelayAct;
MyAction * incSubDelayAct;
MyAction * decSubPosAct;
MyAction * incSubPosAct;
MyAction * incSubStepAct;
MyAction * decSubStepAct;
MyAction * incSubScaleAct;
MyAction * decSubScaleAct;
MyAction * useAssAct;
MyAction * useClosedCaptionAct;
MyAction * useForcedSubsOnlyAct;
// Menu Options
MyAction * showPlaylistAct;
MyAction * showPropertiesAct;
MyAction * frameCounterAct;
MyAction * motionVectorsAct;
MyAction * showPreferencesAct;
MyAction * showLogMplayerAct;
MyAction * showLogSmplayerAct;
// Menu Help
MyAction * showFAQAct;
MyAction * showCLOptions; // Command line options
MyAction * aboutQtAct;
MyAction * aboutThisAct;
// Playlist
MyAction * playPrevAct;
MyAction * playNextAct;
// Actions not in menus
#if !USE_MULTIPLE_SHORTCUTS
MyAction * decVolume2Act;
MyAction * incVolume2Act;
#endif
MyAction * exitFullscreenAct;
MyAction * nextOSDAct;
MyAction * decContrastAct;
MyAction * incContrastAct;
MyAction * decBrightnessAct;
MyAction * incBrightnessAct;
MyAction * decHueAct;
MyAction * incHueAct;
MyAction * decSaturationAct;
MyAction * incSaturationAct;
MyAction * decGammaAct;
MyAction * incGammaAct;
MyAction * nextAudioAct;
MyAction * nextSubtitleAct;
MyAction * nextChapterAct;
MyAction * prevChapterAct;
MyAction * doubleSizeAct;
// Moving and zoom
MyAction * moveUpAct;
MyAction * moveDownAct;
MyAction * moveLeftAct;
MyAction * moveRightAct;
MyAction * incZoomAct;
MyAction * decZoomAct;
MyAction * resetZoomAct;
// OSD Action Group
MyActionGroup * osdGroup;
MyAction * osdNoneAct;
MyAction * osdSeekAct;
MyAction * osdTimerAct;
MyAction * osdTotalAct;
// Denoise Action Group
MyActionGroup * denoiseGroup;
MyAction * denoiseNoneAct;
MyAction * denoiseNormalAct;
MyAction * denoiseSoftAct;
// Window Size Action Group
MyActionGroup * sizeGroup;
MyAction * size50;
MyAction * size75;
MyAction * size100;
MyAction * size125;
MyAction * size150;
MyAction * size175;
MyAction * size200;
MyAction * size300;
MyAction * size400;
// Deinterlace Action Group
MyActionGroup * deinterlaceGroup;
MyAction * deinterlaceNoneAct;
MyAction * deinterlaceL5Act;
MyAction * deinterlaceYadif0Act;
MyAction * deinterlaceYadif1Act;
MyAction * deinterlaceLBAct;
MyAction * deinterlaceKernAct;
// Aspect Action Group
MyActionGroup * aspectGroup;
MyAction * aspectDetectAct;
MyAction * aspect43Act;
MyAction * aspect54Act;
MyAction * aspect149Act;
MyAction * aspect169Act;
MyAction * aspect1610Act;
MyAction * aspect235Act;
#if !NEW_ASPECT_CODE
MyAction * aspect43LetterAct;
MyAction * aspect169LetterAct;
MyAction * aspect43PanscanAct;
MyAction * aspect43To169Act;
#endif
// Audio Channels Action Group
MyActionGroup * channelsGroup;
/* MyAction * channelsDefaultAct; */
MyAction * channelsStereoAct;
MyAction * channelsSurroundAct;
MyAction * channelsFull51Act;
// Stereo Mode Action Group
MyActionGroup * stereoGroup;
MyAction * stereoAct;
MyAction * leftChannelAct;
MyAction * rightChannelAct;
// Audio Track Group
MyActionGroup * audioTrackGroup;
MyActionGroup * subtitleTrackGroup;
MyActionGroup * titleGroup;
MyActionGroup * angleGroup;
MyActionGroup * chapterGroup;
// MENUS
QMenu *openMenu;
QMenu *playMenu;
QMenu *videoMenu;
QMenu *audioMenu;
QMenu *subtitlesMenu;
QMenu *browseMenu;
QMenu *optionsMenu;
QMenu *helpMenu;
QMenu * subtitlestrack_menu;
QMenu * audiotrack_menu;
QMenu * titles_menu;
QMenu * chapters_menu;
QMenu * angles_menu;
QMenu * aspect_menu;
QMenu * osd_menu;
QMenu * deinterlace_menu;
//QMenu * denoise_menu;
QMenu * videosize_menu;
QMenu * audiochannels_menu;
QMenu * stereomode_menu;
QMenu * speed_menu;
QMenu * videofilter_menu;
QMenu * audiofilter_menu;
QMenu * logs_menu;
QMenu * panscan_menu;
QMenu * popup;
QMenu * recentfiles_menu;
LogWindow * mplayer_log_window;
LogWindow * smplayer_log_window;
LogWindow * clhelp_window;
PreferencesDialog *pref_dialog;
FilePropertiesDialog *file_dialog;
Playlist * playlist;
VideoEqualizer * equalizer;
Core * core;
MplayerWindow *mplayerwindow;
Recents * recents;
MyServer * server;
QStringList actions_list;
private:
QString default_style;
int last_second;
bool near_top;
bool near_bottom;
// Variables to restore pos and size of the window
// when exiting from fullscreen mode.
QPoint win_pos;
QSize win_size;
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
};
#endif

View File

@ -0,0 +1,483 @@
/* 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 "baseguiplus.h"
#include "myaction.h"
#include "global.h"
#include "images.h"
#include "playlist.h"
#include "widgetactions.h"
#include <QMenu>
#include <QCloseEvent>
#if DOCK_PLAYLIST
#include <QDockWidget>
#include "playlistdock.h"
#include "desktopinfo.h"
#define PLAYLIST_ON_SIDES 1
#endif
using namespace Global;
BaseGuiPlus::BaseGuiPlus( QWidget * parent, Qt::WindowFlags flags )
: BaseGui( parent, flags ),
mainwindow_visible(true),
//infowindow_visible(false),
trayicon_playlist_was_visible(false)
{
mainwindow_pos = pos();
tray = new QSystemTrayIcon( Images::icon("logo", 22), this );
tray->setToolTip( "SMPlayer" );
connect( tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
quitAct = new MyAction(this, "quit");
connect( quitAct, SIGNAL(triggered()), this, SLOT(quit()) );
openMenu->addAction(quitAct);
showTrayAct = new MyAction(this, "show_tray_icon" );
showTrayAct->setCheckable(true);
connect( showTrayAct, SIGNAL(toggled(bool)),
tray, SLOT(setVisible(bool)) );
optionsMenu->addAction(showTrayAct);
showAllAct = new MyAction(this, "restore/hide");
connect( showAllAct, SIGNAL(triggered()),
this, SLOT(toggleShowAll()) );
context_menu = new QMenu(this);
context_menu->addAction(showAllAct);
context_menu->addSeparator();
context_menu->addAction(openFileAct);
context_menu->addMenu(recentfiles_menu);
context_menu->addAction(openDVDAct);
context_menu->addAction(openURLAct);
context_menu->addSeparator();
context_menu->addAction(playOrPauseAct);
context_menu->addAction(stopAct);
context_menu->addSeparator();
context_menu->addAction(playPrevAct);
context_menu->addAction(playNextAct);
context_menu->addSeparator();
context_menu->addAction(showPlaylistAct);
context_menu->addAction(showPreferencesAct);
context_menu->addSeparator();
context_menu->addAction(quitAct);
tray->setContextMenu( context_menu );
#if DOCK_PLAYLIST
// Playlistdock
playlistdock = new PlaylistDock(this);
playlistdock->setObjectName("playlist");
playlistdock->setFloating(true);
playlistdock->setWidget(playlist);
playlistdock->setAllowedAreas(Qt::TopDockWidgetArea |
Qt::BottomDockWidgetArea
#if PLAYLIST_ON_SIDES
| Qt::LeftDockWidgetArea |
Qt::RightDockWidgetArea
#endif
);
addDockWidget(Qt::BottomDockWidgetArea, playlistdock);
playlistdock->hide();
connect( playlistdock, SIGNAL(closed()), this, SLOT(playlistClosed()) );
connect( playlistdock, SIGNAL(docked()), this, SLOT(stretchWindow()) );
connect( playlistdock, SIGNAL(undocked()), this, SLOT(shrinkWindow()) );
ignore_playlist_events = false;
#endif
retranslateStrings();
loadConfig();
}
BaseGuiPlus::~BaseGuiPlus() {
saveConfig();
}
bool BaseGuiPlus::startHidden() {
#ifdef Q_OS_WIN
return false;
#else
if ( (!showTrayAct->isChecked()) || (mainwindow_visible) )
return false;
else
return true;
#endif
}
void BaseGuiPlus::closeEvent( QCloseEvent * e ) {
qDebug("BaseGuiPlus::closeEvent");
e->ignore();
closeWindow();
}
void BaseGuiPlus::closeWindow() {
qDebug("BaseGuiPlus::closeWindow");
if (tray->isVisible()) {
//e->ignore();
exitFullscreen();
showAll(false); // Hide windows
if (core->state() == Core::Playing) core->stop();
if (pref->balloon_count > 0) {
tray->showMessage( "SMPlayer",
tr("SMPlayer is still running here"),
QSystemTrayIcon::Information, 3000 );
pref->balloon_count--;
}
} else {
BaseGui::closeWindow();
}
//tray->hide();
}
void BaseGuiPlus::quit() {
qDebug("BaseGuiPlus::quit");
BaseGui::closeWindow();
}
void BaseGuiPlus::retranslateStrings() {
BaseGui::retranslateStrings();
quitAct->change( Images::icon("exit"), tr("&Quit") );
showTrayAct->change( Images::icon("systray"), tr("S&how icon in system tray") );
updateShowAllAct();
#if DOCK_PLAYLIST
playlistdock->setWindowTitle( tr("Playlist") );
#endif
}
void BaseGuiPlus::updateShowAllAct() {
if (isVisible())
showAllAct->change( tr("&Hide") );
else
showAllAct->change( tr("&Restore") );
}
void BaseGuiPlus::saveConfig() {
qDebug("BaseGuiPlus::saveConfig");
QSettings * set = settings;
set->beginGroup( "base_gui_plus");
set->setValue( "show_tray_icon", showTrayAct->isChecked() );
set->setValue( "mainwindow_visible", isVisible() );
/*
#if DOCK_PLAYLIST
set->setValue( "playlist_and_toolbars_state", saveState() );
#endif
*/
set->endGroup();
}
void BaseGuiPlus::loadConfig() {
qDebug("BaseGuiPlus::loadConfig");
QSettings * set = settings;
set->beginGroup( "base_gui_plus");
bool show_tray_icon = set->value( "show_tray_icon", false).toBool();
showTrayAct->setChecked( show_tray_icon );
//tray->setVisible( show_tray_icon );
mainwindow_visible = set->value("mainwindow_visible", true).toBool();
/*
#if DOCK_PLAYLIST
restoreState( set->value( "playlist_and_toolbars_state" ).toByteArray() );
#endif
*/
set->endGroup();
updateShowAllAct();
}
void BaseGuiPlus::trayIconActivated(QSystemTrayIcon::ActivationReason reason) {
qDebug("DefaultGui::trayIconActivated: %d", reason);
updateShowAllAct();
if (reason == QSystemTrayIcon::Trigger) {
toggleShowAll();
}
else
if (reason == QSystemTrayIcon::MiddleClick) {
core->pause();
}
}
void BaseGuiPlus::toggleShowAll() {
showAll( !isVisible() );
}
void BaseGuiPlus::showAll(bool b) {
if (!b) {
// Hide all
#if DOCK_PLAYLIST
trayicon_playlist_was_visible = (playlistdock->isVisible() &&
playlistdock->isFloating() );
if (trayicon_playlist_was_visible)
playlistdock->hide();
/*
trayicon_playlist_was_visible = playlistdock->isVisible();
playlistdock->hide();
*/
#else
trayicon_playlist_was_visible = playlist->isVisible();
playlist_pos = playlist->pos();
playlist->hide();
#endif
mainwindow_pos = pos();
hide();
/*
infowindow_visible = info_window->isVisible();
infowindow_pos = info_window->pos();
info_window->hide();
*/
} else {
// Show all
move(mainwindow_pos);
show();
#if DOCK_PLAYLIST
if (trayicon_playlist_was_visible) {
playlistdock->show();
}
#else
if (trayicon_playlist_was_visible) {
playlist->move(playlist_pos);
playlist->show();
}
#endif
/*
if (infowindow_visible) {
info_window->show();
info_window->move(infowindow_pos);
}
*/
}
updateShowAllAct();
}
void BaseGuiPlus::resizeWindow(int w, int h) {
qDebug("BaseGuiPlus::resizeWindow: %d, %d", w, h);
if ( (tray->isVisible()) && (!isVisible()) ) showAll(true);
BaseGui::resizeWindow(w, h );
}
void BaseGuiPlus::updateMediaInfo() {
qDebug("BaseGuiPlus::updateMediaInfo");
BaseGui::updateMediaInfo();
tray->setToolTip( windowTitle() );
}
void BaseGuiPlus::setWindowCaption(const QString & title) {
tray->setToolTip( title );
BaseGui::setWindowCaption( title );
}
// Playlist stuff
void BaseGuiPlus::aboutToEnterFullscreen() {
qDebug("BaseGuiPlus::aboutToEnterFullscreen");
BaseGui::aboutToEnterFullscreen();
#if DOCK_PLAYLIST
fullscreen_playlist_was_visible = playlistdock->isVisible();
fullscreen_playlist_was_floating = playlistdock->isFloating();
//showPlaylistAct->setEnabled(false);
ignore_playlist_events = true;
playlistdock->setFloating(true);
playlistdock->hide();
//showPlaylistAct->setChecked(false);
//playlist_state = saveState();
#endif
}
void BaseGuiPlus::aboutToExitFullscreen() {
qDebug("BaseGuiPlus::aboutToExitFullscreen");
BaseGui::aboutToExitFullscreen();
#if DOCK_PLAYLIST
if (fullscreen_playlist_was_visible) {
playlistdock->show();
}
playlistdock->setFloating( fullscreen_playlist_was_floating );
//restoreState( playlist_state );
ignore_playlist_events = false;
//showPlaylistAct->setEnabled(true);
#endif
}
void BaseGuiPlus::aboutToEnterCompactMode() {
BaseGui::aboutToEnterCompactMode();
#if DOCK_PLAYLIST
compact_playlist_was_visible = (playlistdock->isVisible() &&
!playlistdock->isFloating());
if (compact_playlist_was_visible)
playlistdock->hide();
#endif
}
void BaseGuiPlus::aboutToExitCompactMode() {
BaseGui::aboutToExitCompactMode();
#if DOCK_PLAYLIST
if (compact_playlist_was_visible)
playlistdock->show();
#endif
}
#if DOCK_PLAYLIST
void BaseGuiPlus::showPlaylist(bool b) {
if ( !b ) {
playlistdock->hide();
} else {
exitFullscreenIfNeeded();
playlistdock->show();
}
//updateWidgets();
}
void BaseGuiPlus::playlistClosed() {
showPlaylistAct->setChecked(false);
}
void BaseGuiPlus::stretchWindow() {
qDebug("BaseGuiPlus::stretchWindow");
if ((ignore_playlist_events) || (pref->resize_method!=Preferences::Always)) return;
qDebug("BaseGuiPlus::stretchWindow: dockWidgetArea: %d", (int) dockWidgetArea(playlistdock) );
if ( (dockWidgetArea(playlistdock) == Qt::TopDockWidgetArea) ||
(dockWidgetArea(playlistdock) == Qt::BottomDockWidgetArea) )
{
int new_height = height() + playlistdock->height();
//if (new_height > DesktopInfo::desktop_size(this).height())
// new_height = DesktopInfo::desktop_size(this).height() - 20;
qDebug("BaseGuiPlus::stretchWindow: stretching: new height: %d", new_height);
resize( width(), new_height );
//resizeWindow(core->mset.win_width, core->mset.win_height);
}
else
if ( (dockWidgetArea(playlistdock) == Qt::LeftDockWidgetArea) ||
(dockWidgetArea(playlistdock) == Qt::RightDockWidgetArea) )
{
int new_width = width() + playlistdock->width();
qDebug("BaseGuiPlus::stretchWindow: stretching: new width: %d", new_width);
resize( new_width, height() );
}
}
void BaseGuiPlus::shrinkWindow() {
qDebug("BaseGuiPlus::shrinkWindow");
if ((ignore_playlist_events) || (pref->resize_method!=Preferences::Always)) return;
qDebug("BaseGuiPlus::shrinkWindow: dockWidgetArea: %d", (int) dockWidgetArea(playlistdock) );
if ( (dockWidgetArea(playlistdock) == Qt::TopDockWidgetArea) ||
(dockWidgetArea(playlistdock) == Qt::BottomDockWidgetArea) )
{
int new_height = height() - playlistdock->height();
qDebug("DefaultGui::shrinkWindow: shrinking: new height: %d", new_height);
resize( width(), new_height );
//resizeWindow(core->mset.win_width, core->mset.win_height);
}
else
if ( (dockWidgetArea(playlistdock) == Qt::LeftDockWidgetArea) ||
(dockWidgetArea(playlistdock) == Qt::RightDockWidgetArea) )
{
int new_width = width() - playlistdock->width();
qDebug("BaseGuiPlus::shrinkWindow: shrinking: new width: %d", new_width);
resize( new_width, height() );
}
}
#endif
// Convenience functions intended for other GUI's
TimeSliderAction * BaseGuiPlus::createTimeSliderAction(QWidget * parent) {
TimeSliderAction * timeslider_action = new TimeSliderAction( parent );
connect( timeslider_action, SIGNAL( posChanged(int) ),
core, SLOT(goToPos(int)) );
connect( timeslider_action, SIGNAL( draggingPos(int) ),
this, SLOT(displayGotoTime(int)) );
#if ENABLE_DELAYED_DRAGGING
timeslider_action->setDragDelay( pref->time_slider_drag_delay );
connect( timeslider_action, SIGNAL( delayedDraggingPos(int) ),
this, SLOT(goToPosOnDragging(int)) );
#else
connect( timeslider_action, SIGNAL( draggingPos(int) ),
this, SLOT(goToPosOnDragging(int)) );
#endif
return timeslider_action;
}
VolumeSliderAction * BaseGuiPlus::createVolumeSliderAction(QWidget * parent) {
VolumeSliderAction * volumeslider_action = new VolumeSliderAction(parent);
connect( volumeslider_action, SIGNAL( valueChanged(int) ),
core, SLOT( setVolume(int) ) );
connect( core, SIGNAL(volumeChanged(int)),
volumeslider_action, SLOT(setValue(int)) );
return volumeslider_action;
}
#include "moc_baseguiplus.cpp"

View File

@ -0,0 +1,109 @@
/* 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 _BASEGUIPLUS_H_
#define _BASEGUIPLUS_H_
#include "basegui.h"
#include <QSystemTrayIcon>
#include <QPoint>
#include "config.h"
class QMenu;
class PlaylistDock;
class TimeSliderAction;
class VolumeSliderAction;
class BaseGuiPlus : public BaseGui
{
Q_OBJECT
public:
BaseGuiPlus( QWidget* parent = 0, Qt::WindowFlags flags = 0 );
~BaseGuiPlus();
virtual bool startHidden();
protected:
virtual void retranslateStrings();
void loadConfig();
void saveConfig();
void updateShowAllAct();
virtual void aboutToEnterFullscreen();
virtual void aboutToExitFullscreen();
virtual void aboutToEnterCompactMode();
virtual void aboutToExitCompactMode();
virtual void closeEvent( QCloseEvent * e );
// Functions for other GUI's
TimeSliderAction * createTimeSliderAction(QWidget * parent);
VolumeSliderAction * createVolumeSliderAction(QWidget * parent);
protected slots:
// Reimplemented methods
virtual void closeWindow();
virtual void setWindowCaption(const QString & title);
virtual void resizeWindow(int w, int h);
virtual void updateMediaInfo();
// New
virtual void trayIconActivated(QSystemTrayIcon::ActivationReason);
virtual void toggleShowAll();
virtual void showAll(bool b);
virtual void quit();
#if DOCK_PLAYLIST
virtual void showPlaylist(bool b);
void playlistClosed();
void stretchWindow();
void shrinkWindow();
#endif
protected:
QSystemTrayIcon * tray;
QMenu * context_menu;
MyAction * quitAct;
MyAction * showTrayAct;
MyAction * showAllAct;
// To save state
QPoint mainwindow_pos;
bool mainwindow_visible;
QPoint playlist_pos;
bool trayicon_playlist_was_visible;
//QPoint infowindow_pos;
//bool infowindow_visible;
#if DOCK_PLAYLIST
PlaylistDock * playlistdock;
bool fullscreen_playlist_was_visible;
bool fullscreen_playlist_was_floating;
bool compact_playlist_was_visible;
bool ignore_playlist_events;
#endif
};
#endif

View File

@ -0,0 +1,165 @@
/* 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 "clhelp.h"
#include <QObject>
#include <QApplication>
#include <QFileInfo>
QString CLHelp::formatText(QString s, int col) {
QString res = "";
int last = 0;
int pos;
pos = s.indexOf(" ");
while (pos != -1) {
if (s.count() < col) {
res = res + s;
s = "";
break;
}
while ((pos < col) && (pos != -1)) {
last = pos;
pos = s.indexOf(" ", pos+1);
}
res = res + s.left(last) + "\n";
s = s.mid(last+1);
last = 0;
pos = s.indexOf(" ");
}
if (!s.isEmpty()) res = res + s;
return res;
}
QString CLHelp::formatHelp(QString parameter, QString help, bool html) {
if (html) {
return "<tr><td><b>"+parameter+"</b></td><td>"+help+"</td></tr>";
} else {
int par_width = 20;
int help_width = 80 - par_width;
QString s;
s = s.fill( ' ', par_width - (parameter.count()+2) );
s = s + parameter + ": ";
QString f;
f = f.fill(' ', par_width);
QString s2 = formatText(help, help_width);
int pos = s2.indexOf('\n');
while (pos != -1) {
s2 = s2.insert(pos+1, f);
pos = s2.indexOf('\n', pos+1);
}
return s + s2 + "\n";
}
}
QString CLHelp::help(bool html) {
QString app_name = QFileInfo(qApp->applicationFilePath()).baseName();
QString options = QString("%1 [-mini] [-ini-path %2] "
"[-send-action %3] [-actions %4] "
"[-close-at-end] [-no-close-at-end] [-fullscreen] [-no-fullscreen] "
"[-add-to-playlist] [-help|--help|-h|-?] "
"[[-playlist] %5] [[-playlist] %5]...")
.arg(app_name)
.arg(QObject::tr("directory"))
.arg(QObject::tr("action_name"))
.arg(QObject::tr("action_list"))
.arg(QObject::tr("media"));
QString s;
if (html) {
s = QObject::tr("Usage:") + " <b>" + options + "</b><br>";
s += "<table>";
} else {
s = formatText(QObject::tr("Usage:") + " " + options, 80);
s += "\n\n";
}
#ifdef Q_OS_WIN
s += formatHelp( "-uninstall", QObject::tr(
"Restores the old associations and cleans up the registry."), html );
#endif
s += formatHelp( "-mini", 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( "-send-action", QObject::tr(
"tries to make a connection to another running instance "
"and send to it the specified action. Example: -send-action pause "
"The rest of options (if any) will be ignored and the "
"application will exit. It will return 0 on success or -1 "
"on failure."), html );
s += formatHelp( "-actions", QObject::tr(
"action_list is a list of actions separated by spaces. "
"The actions will be executed just after loading the file (if any) "
"in the same order you entered. For checkable actions you can pass "
"true or false as parameter. Example: "
"-actions \"fullscreen compact true\". Quotes are necessary in "
"case you pass more than one action."), html );
s += formatHelp( "-close-at-end", QObject::tr(
"the main window will be closed when the file/playlist finishes."), html );
s += formatHelp( "-no-close-at-end", QObject::tr(
"the main window won't be closed when the file/playlist finishes."), html );
s += formatHelp( "-fullscreen", QObject::tr(
"the video will be played in fullscreen mode."), html );
s += formatHelp( "-no-fullscreen", QObject::tr(
"the video will be played in window mode."), html );
s += formatHelp( "-help", QObject::tr(
"will show this message and then will exit."), html );
s += formatHelp( "-add-to-playlist", QObject::tr(
"if there's another instance running, the media will be added "
"to that instance's playlist. If there's no other instance, "
"this option will be ignored and the "
"files will be opened in a new instance."), html );
s += formatHelp( QObject::tr("media"), QObject::tr(
"'media' is any kind of file that SMPlayer can open. It can "
"be a local file, a DVD (e.g. dvd://1), an Internet stream "
"(e.g. mms://....) or a local playlist in format m3u or pls. "
"If the -playlist option is used, that means that SMPlayer "
"will pass the -playlist option to MPlayer, so MPlayer will "
"handle the playlist, not SMPlayer."), html );
if (html) s += "</table>";
return s;
}

View File

@ -0,0 +1,31 @@
/* 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 <QString>
//! Provides help about the comand line options.
class CLHelp
{
public:
static QString help(bool html = false);
protected:
static QString formatText(QString s, int col);
static QString formatHelp(QString parameter, QString help, bool html = false);
};

Binary file not shown.

View File

@ -0,0 +1,105 @@
/* 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_
// Activate the new code for aspect ratio
#define NEW_ASPECT_CODE 1
// CONTROLWIDGET_OVER_VIDEO
// if set to 1, the controlwidget will be shown in fullscreen
// *over* the video (not moving the video) when the user move the mouse
// to the bottom area of the screen.
#define CONTROLWIDGET_OVER_VIDEO 1
// NEW_CONTROLWIDGET
// New design for the floating control, with only one row.
#define NEW_CONTROLWIDGET 1
// DOCK_PLAYLIST
// if 1, the playlist will be docked in the main window, instead
// of being a top level window
#define DOCK_PLAYLIST 1
// STYLE_SWITCHING
// if 1, the preferences dialog will have an option to switch
// the Qt style
#define STYLE_SWITCHING 1
// New code to resize the main window
#define NEW_RESIZE_CODE 1
// Allow to use multiple shortcuts for actions
#define USE_MULTIPLE_SHORTCUTS 1
// EXTERNAL_SLEEP
// if 1, it will be used the function usleep() from unistd.h
// instead of QThread::msleep()
// It can be useful if your Qt doesn't have QThread support.
// Note: not much test it
// Note 2: not used anymore
#define EXTERNAL_SLEEP 0
// USE_SHORTCUTGETTER
// if 1, a new dialog will be used to ask the user for a
// keyshortcut.
#define USE_SHORTCUTGETTER 1
// ENABLE_DELAYED_DRAGGING
// if 1, sends the dragging position of the time slider
// some ms later
#define ENABLE_DELAYED_DRAGGING 1
// SCALE_ASS_SUBS
// MPlayer r25843 adds the possibility to change the
// size of the subtitles, when using -ass, with the
// sub_scale slave command. Unfortunately this require
// a different code, which also makes the size of the
// subtitles to be very different when using -ass or not.
// Setting SCALE_ASS_SUBS to 1 activates this code.
#define SCALE_ASS_SUBS 1
// Testing with a QGLWidget (for Windows)
#define USE_GL_WIDGET 0
#endif

View File

@ -0,0 +1,29 @@
/* 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 _CONSTANTS_H_
#define _CONSTANTS_H_
#define COMPANY "RVM"
#define PROGRAM "smplayer"
#define IS_PLAYLIST_TAG "|smplayer:isplaylist"
#define IS_PLAYLIST_TAG_RX "\\|smplayer\\:isplaylist$"
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,317 @@
/* 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 _CORE_H_
#define _CORE_H_
#include <QObject>
#include "mediadata.h"
#include "mediasettings.h"
#include "config.h"
class MplayerProcess;
class MplayerWindow;
class QSettings;
#ifdef Q_OS_WIN
class WinScreenSaver;
#endif
class Core : public QObject
{
Q_OBJECT
public:
enum State { Stopped = 0, Playing = 1, Paused = 2 };
Core( MplayerWindow *mpw, QWidget* parent = 0 );
~Core();
MediaData mdat;
MediaSettings mset;
QString mplayer_log;
//! Return the current state
State state() { return _state; };
//! Return a string with the name of the current state,
//! so it can be printed on debugging messages.
QString stateToString();
protected:
//! Change the current state (Stopped, Playing or Paused)
//! And sends the stateChanged() signal.
void setState(State s);
public slots:
//! Generic open, with autodetection of type
void open(QString file, int seek=-1);
void openFile(QString filename, int seek=-1);
void openStream(QString name);
/*
void openDVD( bool from_folder, QString directory = "");
void openDVD(); // Plays title 1
void openDVD(int title = 1);
*/
void openDVD(QString dvd_url);
void openVCD(int title = -1);
void openAudioCD(int title = -1);
void loadSub(const QString & sub);
void unloadSub();
void loadAudioFile(const QString & audiofile);
void unloadAudioFile();
void stop();
void play();
void play_or_pause();
void pause_and_frame_step();
void pause();
void frameStep();
void screenshot();
//! Public restart, for the GUI.
void restart();
void goToPos( int perc );
/*void goToSec( double sec );*/
void toggleRepeat();
void toggleRepeat(bool b);
void toggleFlip();
void toggleFlip(bool b);
// Audio filters
void toggleKaraoke();
void toggleKaraoke(bool b);
void toggleExtrastereo();
void toggleExtrastereo(bool b);
void toggleVolnorm();
void toggleVolnorm(bool b);
void setAudioChannels(int channels);
void setStereoMode(int mode);
// Video filters
void toggleAutophase();
void toggleAutophase(bool b);
void toggleDeblock();
void toggleDeblock(bool b);
void toggleDering();
void toggleDering(bool b);
void toggleNoise();
void toggleNoise(bool b);
void togglePostprocessing();
void togglePostprocessing(bool b);
void changeDenoise(int);
#if NEW_ASPECT_CODE
void changeLetterbox(bool);
#endif
void changeUpscale(bool);
void seek(int secs);
void sforward(); // + 10 seconds
void srewind(); // - 10 seconds
void forward(); // + 1 minute
void rewind(); // -1 minute
void fastforward(); // + 10 minutes
void fastrewind(); // - 10 minutes
void forward(int secs);
void rewind(int secs);
void wheelUp();
void wheelDown();
void setSpeed( double value );
void incSpeed();
void decSpeed();
void doubleSpeed();
void halveSpeed();
void normalSpeed();
void setVolume(int volume, bool force = false);
void switchMute();
void mute(bool b);
void incVolume();
void decVolume();
void setBrightness(int value);
void setContrast(int value);
void setGamma(int value);
void setHue(int value);
void setSaturation(int value);
void incBrightness();
void decBrightness();
void incContrast();
void decContrast();
void incGamma();
void decGamma();
void incHue();
void decHue();
void incSaturation();
void decSaturation();
void incSubDelay();
void decSubDelay();
void incAudioDelay();
void decAudioDelay();
void incSubPos();
void decSubPos();
void changeSubScale(double value);
void incSubScale();
void decSubScale();
//! Select next line in subtitle file
void incSubStep();
//! Select previous line in subtitle file
void decSubStep();
void changeDeinterlace(int);
void changeSubtitle(int);
void nextSubtitle();
void changeAudio(int);
void nextAudio();
void changeTitle(int);
void changeChapter(int);
void prevChapter();
void nextChapter();
void changeAngle(int);
void changeAspectRatio(int);
void changeOSD(int);
void nextOSD();
void changeSize(int); // Size of the window
void toggleDoubleSize();
void changePanscan(double); // Zoom on mplayerwindow
void incPanscan();
void decPanscan();
void resetPanscan();
void changeUseAss(bool);
void toggleClosedCaption(bool);
void toggleForcedSubsOnly(bool);
void visualizeMotionVectors(bool);
// Pass a command to mplayer by stdin:
void tellmp(const QString & command);
public:
//! Returns the number of the first chapter in mkv
//! files. In some versions of mplayer is 0, in others 1
static int mkv_first_chapter();
protected slots:
void changeCurrentSec(double sec);
void changePause();
void gotWindowResolution( int w, int h );
void gotNoVideo();
void gotVO(QString);
void gotAO(QString);
void gotStartingTime(double);
void finishRestart();
void processFinished();
void fileReachedEnd();
void updateLog(QString line);
void displayMessage(QString text);
void displayScreenshotName(QString filename);
void streamTitleAndUrlChanged(QString,QString);
void autosaveMplayerLog();
void watchState(Core::State state);
//! Called when a video has just started to play.
//! This function checks if the codec of video is ffh264 and if
//! the resolution is HD
void checkIfVideoIsHD();
protected:
void playNewFile(QString file, int seek=-1);
void restartPlay();
void initPlaying(int seek=-1);
void newMediaPlaying();
void startMplayer(QString file, double seek = -1 );
void stopMplayer();
bool checkHaveSettingsSaved(QString filename);
void saveMediaInfo();
void loadMediaInfo(QString filename);
void initializeMenus();
void updateWidgets();
#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
void mediaLoaded();
void mediaInfoChanged();
void stateChanged(Core::State state);
void mediaStartPlay();
void mediaFinished(); // Media has arrived to the end.
void mediaStoppedByUser();
void showMessage(QString text);
void menusNeedInitialize();
void widgetsNeedUpdate();
void equalizerNeedsUpdate();
void showTime(double sec);
void showFrame(int frame);
void needResize(int w, int h);
void mplayerFinishedWithError(int);
void noVideo();
void volumeChanged(int);
// Resend signal from mplayerprocess:
void failedToParseMplayerVersion(QString line_with_mplayer_version);
protected:
MplayerProcess * proc;
MplayerWindow * mplayerwindow;
QSettings * file_settings;
#ifdef Q_OS_WIN
WinScreenSaver * win_screensaver;
#endif
private:
// Some variables to proper restart
bool we_are_restarting;
bool just_loaded_external_subs;
bool just_unloaded_external_subs;
State _state;
bool change_volume_after_unpause;
};
#endif

View File

@ -0,0 +1,579 @@
/* 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 "defaultgui.h"
#include "helper.h"
#include "core.h"
#include "global.h"
#include "widgetactions.h"
#include "playlist.h"
#include "mplayerwindow.h"
#include "myaction.h"
#include "images.h"
#include "floatingwidget.h"
#include <QMenu>
#include <QToolBar>
#include <QSettings>
#include <QLabel>
#include <QStatusBar>
#include <QPushButton>
#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)
{
createStatusBar();
connect( this, SIGNAL(timeChanged(double, int, QString)),
this, SLOT(displayTime(double, int, QString)) );
connect( this, SIGNAL(frameChanged(int)),
this, SLOT(displayFrame(int)) );
connect( this, SIGNAL(cursorNearBottom(QPoint)),
this, SLOT(showFloatingControl(QPoint)) );
connect( this, SIGNAL(cursorNearTop(QPoint)),
this, SLOT(showFloatingMenu(QPoint)) );
connect( this, SIGNAL(cursorFarEdges()),
this, SLOT(hideFloatingControls()) );
createActions();
createMainToolBars();
createControlWidget();
createControlWidgetMini();
createFloatingControl();
createMenus();
retranslateStrings();
loadConfig();
//if (playlist_visible) showPlaylist(true);
if (pref->compact_mode) {
controlwidget->hide();
toolbar1->hide();
toolbar2->hide();
}
}
DefaultGui::~DefaultGui() {
saveConfig();
}
/*
void DefaultGui::closeEvent( QCloseEvent * ) {
qDebug("DefaultGui::closeEvent");
//BaseGuiPlus::closeEvent(e);
qDebug("w: %d h: %d", width(), height() );
}
*/
void DefaultGui::createActions() {
qDebug("DefaultGui::createActions");
timeslider_action = createTimeSliderAction(this);
timeslider_action->disable();
volumeslider_action = createVolumeSliderAction(this);
volumeslider_action->disable();
}
void DefaultGui::enableActionsOnPlaying() {
qDebug("DefaultGui::enableActionsOnPlaying");
BaseGuiPlus::enableActionsOnPlaying();
timeslider_action->enable();
volumeslider_action->enable();
}
void DefaultGui::disableActionsOnStop() {
qDebug("DefaultGui::disableActionsOnStop");
BaseGuiPlus::disableActionsOnStop();
timeslider_action->disable();
volumeslider_action->disable();
}
void DefaultGui::createMenus() {
toolbar_menu = new QMenu(this);
toolbar_menu->addAction(toolbar1->toggleViewAction());
toolbar_menu->addAction(toolbar2->toggleViewAction());
optionsMenu->addSeparator();
optionsMenu->addMenu(toolbar_menu);
}
QMenu * DefaultGui::createPopupMenu() {
QMenu * m = new QMenu(this);
m->addAction(toolbar1->toggleViewAction());
m->addAction(toolbar2->toggleViewAction());
return m;
}
void DefaultGui::createMainToolBars() {
toolbar1 = new QToolBar( this );
toolbar1->setObjectName("toolbar1");
//toolbar1->setMovable(false);
addToolBar(Qt::TopToolBarArea, toolbar1);
toolbar1->addAction(openFileAct);
toolbar1->addAction(openDVDAct);
toolbar1->addAction(openURLAct);
toolbar1->addSeparator();
toolbar1->addAction(compactAct);
toolbar1->addAction(fullscreenAct);
toolbar1->addSeparator();
toolbar1->addAction(screenshotAct);
toolbar1->addSeparator();
toolbar1->addAction(showPropertiesAct);
toolbar1->addAction(showPlaylistAct);
toolbar1->addAction(showPreferencesAct);
toolbar1->addSeparator();
toolbar1->addAction(playPrevAct);
toolbar1->addAction(playNextAct);
// Test:
//toolbar1->addSeparator();
//toolbar1->addAction(timeslider_action);
//toolbar1->addAction(volumeslider_action);
toolbar2 = new QToolBar( this );
toolbar2->setObjectName("toolbar2");
//toolbar2->setMovable(false);
addToolBar(Qt::TopToolBarArea, toolbar2);
select_audio = new QPushButton( this );
select_audio->setMenu( audiotrack_menu );
toolbar2->addWidget(select_audio);
select_subtitle = new QPushButton( this );
select_subtitle->setMenu( subtitlestrack_menu );
toolbar2->addWidget(select_subtitle);
/*
toolbar1->show();
toolbar2->show();
*/
// Modify toolbars' actions
QAction *tba;
tba = toolbar1->toggleViewAction();
tba->setObjectName("show_main_toolbar");
tba->setShortcut(Qt::Key_F5);
tba = toolbar2->toggleViewAction();
tba->setObjectName("show_language_toolbar");
tba->setShortcut(Qt::Key_F6);
}
void DefaultGui::createControlWidgetMini() {
qDebug("DefaultGui::createControlWidgetMini");
controlwidget_mini = new QToolBar( this );
controlwidget_mini->setObjectName("controlwidget_mini");
//controlwidget_mini->setResizeEnabled(false);
controlwidget_mini->setMovable(false);
//addDockWindow(controlwidget_mini, Qt::DockBottom );
addToolBar(Qt::BottomToolBarArea, controlwidget_mini);
controlwidget_mini->addAction(playOrPauseAct);
controlwidget_mini->addAction(stopAct);
controlwidget_mini->addSeparator();
controlwidget_mini->addAction(rewind1Act);
controlwidget_mini->addAction(timeslider_action);
controlwidget_mini->addAction(forward1Act);
controlwidget_mini->addSeparator();
controlwidget_mini->addAction(muteAct );
controlwidget_mini->addAction(volumeslider_action);
controlwidget_mini->hide();
}
void DefaultGui::createControlWidget() {
qDebug("DefaultGui::createControlWidget");
controlwidget = new QToolBar( this );
controlwidget->setObjectName("controlwidget");
//controlwidget->setResizeEnabled(false);
controlwidget->setMovable(false);
//addDockWindow(controlwidget, Qt::DockBottom );
addToolBar(Qt::BottomToolBarArea, controlwidget);
controlwidget->addAction(playAct);
controlwidget->addAction(pauseAndStepAct);
controlwidget->addAction(stopAct);
controlwidget->addSeparator();
controlwidget->addAction(rewind3Act);
controlwidget->addAction(rewind2Act);
controlwidget->addAction(rewind1Act);
controlwidget->addAction(timeslider_action);
controlwidget->addAction(forward1Act);
controlwidget->addAction(forward2Act);
controlwidget->addAction(forward3Act);
controlwidget->addSeparator();
controlwidget->addAction(fullscreenAct);
controlwidget->addAction(muteAct);
controlwidget->addAction(volumeslider_action);
/*
controlwidget->show();
*/
}
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);
floating_control->toolbar()->addAction(playAct);
floating_control->toolbar()->addAction(pauseAct);
floating_control->toolbar()->addAction(stopAct);
floating_control->toolbar()->addSeparator();
floating_control->toolbar()->addAction(rewind3Act);
floating_control->toolbar()->addAction(rewind2Act);
floating_control->toolbar()->addAction(rewind1Act);
floating_control->toolbar()->addAction(timeslider_action);
floating_control->toolbar()->addAction(forward1Act);
floating_control->toolbar()->addAction(forward2Act);
floating_control->toolbar()->addAction(forward3Act);
floating_control->toolbar()->addSeparator();
floating_control->toolbar()->addAction(fullscreenAct);
floating_control->toolbar()->addAction(muteAct);
floating_control->toolbar()->addAction(volumeslider_action);
floating_control->toolbar()->addSeparator();
floating_control->toolbar()->addAction(time_label_action);
floating_control->adjustSize();
}
void DefaultGui::createStatusBar() {
qDebug("DefaultGui::createStatusBar");
time_display = new QLabel( statusBar() );
time_display->setAlignment(Qt::AlignRight);
time_display->setFrameShape(QFrame::NoFrame);
time_display->setText(" 88:88:88 / 88:88:88 ");
time_display->setMinimumSize(time_display->sizeHint());
frame_display = new QLabel( statusBar() );
frame_display->setAlignment(Qt::AlignRight);
frame_display->setFrameShape(QFrame::NoFrame);
frame_display->setText("88888888");
frame_display->setMinimumSize(frame_display->sizeHint());
statusBar()->setAutoFillBackground(TRUE);
Helper::setBackgroundColor( statusBar(), QColor(0,0,0) );
Helper::setForegroundColor( statusBar(), QColor(255,255,255) );
Helper::setBackgroundColor( time_display, QColor(0,0,0) );
Helper::setForegroundColor( time_display, QColor(255,255,255) );
Helper::setBackgroundColor( frame_display, QColor(0,0,0) );
Helper::setForegroundColor( frame_display, QColor(255,255,255) );
statusBar()->setSizeGripEnabled(FALSE);
statusBar()->showMessage( tr("Welcome to SMPlayer") );
statusBar()->addPermanentWidget( frame_display, 0 );
frame_display->setText( "0" );
statusBar()->addPermanentWidget( time_display, 0 );
time_display->setText(" 00:00:00 / 00:00:00 ");
time_display->show();
frame_display->hide();
}
void DefaultGui::retranslateStrings() {
BaseGuiPlus::retranslateStrings();
toolbar_menu->menuAction()->setText( tr("&Toolbars") );
toolbar_menu->menuAction()->setIcon( Images::icon("toolbars") );
toolbar1->setWindowTitle( tr("&Main toolbar") );
toolbar1->toggleViewAction()->setIcon(Images::icon("main_toolbar"));
toolbar2->setWindowTitle( tr("&Language toolbar") );
toolbar2->toggleViewAction()->setIcon(Images::icon("lang_toolbar"));
select_audio->setText( tr("Audio") );
select_subtitle->setText( tr("Subtitle") );
}
void DefaultGui::displayTime(double sec, int perc, QString text) {
time_display->setText( text );
timeslider_action->setPos(perc);
time_label->setText(text);
}
void DefaultGui::displayFrame(int frame) {
if (frame_display->isVisible()) {
frame_display->setNum( frame );
}
}
void DefaultGui::updateWidgets() {
qDebug("DefaultGui::updateWidgets");
BaseGuiPlus::updateWidgets();
// Frame counter
frame_display->setVisible( pref->show_frame_counter );
panel->setFocus();
}
void DefaultGui::aboutToEnterFullscreen() {
qDebug("DefaultGui::aboutToEnterFullscreen");
BaseGuiPlus::aboutToEnterFullscreen();
// Save visibility of toolbars
fullscreen_toolbar1_was_visible = toolbar1->isVisible();
fullscreen_toolbar2_was_visible = toolbar2->isVisible();
if (!pref->compact_mode) {
//menuBar()->hide();
//statusBar()->hide();
controlwidget->hide();
controlwidget_mini->hide();
toolbar1->hide();
toolbar2->hide();
}
}
void DefaultGui::aboutToExitFullscreen() {
qDebug("DefaultGui::aboutToExitFullscreen");
BaseGuiPlus::aboutToExitFullscreen();
floating_control->hide();
if (!pref->compact_mode) {
//menuBar()->show();
//statusBar()->show();
controlwidget->show();
toolbar1->setVisible( fullscreen_toolbar1_was_visible );
toolbar2->setVisible( fullscreen_toolbar2_was_visible );
}
}
void DefaultGui::aboutToEnterCompactMode() {
BaseGuiPlus::aboutToEnterCompactMode();
// Save visibility of toolbars
compact_toolbar1_was_visible = toolbar1->isVisible();
compact_toolbar2_was_visible = toolbar2->isVisible();
//menuBar()->hide();
//statusBar()->hide();
controlwidget->hide();
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() {
BaseGuiPlus::aboutToExitCompactMode();
//menuBar()->show();
//statusBar()->show();
controlwidget->show();
toolbar1->setVisible( compact_toolbar1_was_visible );
toolbar2->setVisible( compact_toolbar2_was_visible );
// Recheck size of controlwidget
resizeEvent( new QResizeEvent( size(), size() ) );
}
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);
#else
if (!controlwidget->isVisible()) {
controlwidget->show();
}
#endif
}
void DefaultGui::showFloatingMenu(QPoint /*p*/) {
#if !CONTROLWIDGET_OVER_VIDEO
qDebug("DefaultGui::showFloatingMenu");
if (!menuBar()->isVisible())
menuBar()->show();
#endif
}
void DefaultGui::hideFloatingControls() {
qDebug("DefaultGui::hideFloatingControls");
#if CONTROLWIDGET_OVER_VIDEO
floating_control->hide();
#else
if (controlwidget->isVisible())
controlwidget->hide();
if (menuBar()->isVisible())
menuBar()->hide();
#endif
}
void DefaultGui::resizeEvent( QResizeEvent * ) {
/*
qDebug("defaultGui::resizeEvent");
qDebug(" controlwidget width: %d", controlwidget->width() );
qDebug(" controlwidget_mini width: %d", controlwidget_mini->width() );
*/
#if QT_VERSION < 0x040000
#define LIMIT 470
#else
#define LIMIT 570
#endif
if ( (controlwidget->isVisible()) && (width() < LIMIT) ) {
controlwidget->hide();
controlwidget_mini->show();
}
else
if ( (controlwidget_mini->isVisible()) && (width() > LIMIT) ) {
controlwidget_mini->hide();
controlwidget->show();
}
}
void DefaultGui::saveConfig() {
qDebug("DefaultGui::saveConfig");
QSettings * set = settings;
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);
set->setValue("compact_toolbar2_was_visible", compact_toolbar2_was_visible);
if (pref->save_window_size_on_exit) {
qDebug("DefaultGui::saveConfig: w: %d h: %d", width(), height());
set->setValue( "x", x() );
set->setValue( "y", y() );
set->setValue( "width", width() );
set->setValue( "height", height() );
}
set->setValue( "toolbars_state", saveState() );
set->endGroup();
}
void DefaultGui::loadConfig() {
qDebug("DefaultGui::loadConfig");
QSettings * set = settings;
set->beginGroup( "default_gui");
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();
if (height < 200) {
width = 580;
height = 440;
}
move(x,y);
resize(width,height);
}
restoreState( set->value( "toolbars_state" ).toByteArray() );
set->endGroup();
updateWidgets();
}
void DefaultGui::closeEvent (QCloseEvent * event)
{
hide();
event->ignore();
}
#include "moc_defaultgui.cpp"

View File

@ -0,0 +1,119 @@
/* 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 _DEFAULTGUI_H_
#define _DEFAULTGUI_H_
#include "config.h"
#include "baseguiplus.h"
#include <QPoint>
class QLabel;
class QToolBar;
class QPushButton;
class QResizeEvent;
class MyAction;
class QMenu;
class TimeSliderAction;
class VolumeSliderAction;
class FloatingWidget;
class QLabel;
class DefaultGui : public BaseGuiPlus
{
Q_OBJECT
public:
DefaultGui( QWidget* parent = 0, Qt::WindowFlags flags = 0 );
~DefaultGui();
public slots:
//virtual void showPlaylist(bool b);
protected:
void closeEvent (QCloseEvent * event);
virtual void retranslateStrings();
virtual QMenu * createPopupMenu();
void createStatusBar();
void createMainToolBars();
void createControlWidget();
void createControlWidgetMini();
void createFloatingControl();
void createActions();
void createMenus();
void loadConfig();
void saveConfig();
virtual void aboutToEnterFullscreen();
virtual void aboutToExitFullscreen();
virtual void aboutToEnterCompactMode();
virtual void aboutToExitCompactMode();
virtual void resizeEvent( QResizeEvent * );
/* virtual void closeEvent( QCloseEvent * ); */
protected slots:
virtual void updateWidgets();
virtual void displayTime(double sec, int perc, QString text);
virtual void displayFrame(int frame);
virtual void showFloatingControl(QPoint p);
virtual void showFloatingMenu(QPoint p);
virtual void hideFloatingControls();
// Reimplemented:
virtual void enableActionsOnPlaying();
virtual void disableActionsOnStop();
protected:
QLabel * time_display;
QLabel * frame_display;
QToolBar * controlwidget;
QToolBar * controlwidget_mini;
QToolBar * toolbar1;
QToolBar * toolbar2;
QPushButton * select_audio;
QPushButton * select_subtitle;
TimeSliderAction * timeslider_action;
VolumeSliderAction * volumeslider_action;
FloatingWidget * floating_control;
QLabel * time_label;
QMenu * toolbar_menu;
int last_second;
bool fullscreen_toolbar1_was_visible;
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

View File

@ -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
*/
#include "desktopinfo.h"
#include <QApplication>
#include <QDesktopWidget>
QSize DesktopInfo::desktop_size(QWidget *w) {
QDesktopWidget * dw = QApplication::desktop();
qDebug("DesktopInfo::desktop_size: primary screen: %d", dw->primaryScreen());
QSize s = dw->screen( dw->primaryScreen() )->size();
qDebug("DesktopInfo::desktop_size: size of primary screen: %d x %d", s.width(), s.height() );
//return dw->screen( dw->primaryScreen() )->size();
QRect r = dw->screenGeometry(w);
qDebug("DesktopInfo::desktop_size: size of screen: %d x %d", r.width(), r.height() );
return QSize(r.width(), r.height() );
}
double DesktopInfo::desktop_aspectRatio(QWidget *w) {
QSize s = DesktopInfo::desktop_size(w);
return (double) s.width() / s.height() ;
}

View File

@ -0,0 +1,34 @@
/* 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 _DESKTOPINFO_H_
#define _DESKTOPINFO_H_
#include <QSize>
class QWidget;
class DesktopInfo
{
public:
static QSize desktop_size(QWidget *w);
static double desktop_aspectRatio(QWidget *w);
};
#endif

View File

@ -0,0 +1,75 @@
/* 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"

View File

@ -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 _ENCODINGS_H_
#define _ENCODINGS_H_
#include <QObject>
#include <QStringList>
class Encodings : public QObject
{
Q_OBJECT
public:
Encodings( QObject * parent = 0 );
~Encodings();
QStringList list() { return l;} ;
QString parseEncoding(QString item);
int findEncoding(QString encoding);
void retranslate();
private:
QStringList l;
};
#endif

View File

@ -0,0 +1,78 @@
/* 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 "eqslider.h"
#include <QSlider>
#include <QLabel>
#include <QPixmap>
#include "verticaltext.h"
EqSlider::EqSlider( QWidget* parent, Qt::WindowFlags f)
: QWidget(parent, f)
{
setupUi(this);
_icon->setText( QString::null );
_slider->setFocusPolicy( Qt::StrongFocus );
_slider->setTickPosition( QSlider::TicksRight );
_slider->setTickInterval( 10 );
_slider->setSingleStep( 1 );
_slider->setPageStep( 10 );
connect( _slider, SIGNAL(valueChanged(int)),
this, SLOT(sliderValueChanged(int)) );
}
EqSlider::~EqSlider() {
}
/*
void EqSlider::languageChange() {
}
*/
void EqSlider::setIcon( QPixmap i) {
_icon->setPixmap(i);
}
const QPixmap * EqSlider::icon() const {
return _icon->pixmap();
}
void EqSlider::setLabel( QString s) {
_label->setText(s);
}
QString EqSlider::label() const {
return _label->text();
}
void EqSlider::setValue(int value) {
_slider->setValue(value);
}
int EqSlider::value() const {
return _slider->value();
}
void EqSlider::sliderValueChanged(int v) {
emit valueChanged( v );
}
#include "moc_eqslider.cpp"

View File

@ -0,0 +1,58 @@
/* 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 _EQSLIDER_H_
#define _EQSLIDER_H_
#include "ui_eqslider.h"
#include <QPixmap>
class EqSlider : public QWidget, public Ui::EqSlider
{
Q_OBJECT
Q_PROPERTY(QPixmap icon READ icon WRITE setIcon)
Q_PROPERTY(QString label READ label WRITE setLabel)
Q_PROPERTY(int value READ value WRITE setValue)
public:
EqSlider( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~EqSlider();
public slots:
void setIcon( QPixmap i);
void setLabel( QString s);
void setValue(int value);
public:
int value() const;
const QPixmap * icon() const;
QString label() const;
signals:
void valueChanged(int);
protected slots:
void sliderValueChanged(int);
protected:
/* virtual void languageChange(); */
};
#endif

View File

@ -0,0 +1,85 @@
<ui version="4.0" >
<class>EqSlider</class>
<widget class="QWidget" name="EqSlider" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>124</width>
<height>205</height>
</rect>
</property>
<property name="windowIcon" >
<iconset/>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>0</number>
</property>
<item>
<widget class="QLabel" name="_icon" >
<property name="text" >
<string>icon</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>0</number>
</property>
<item>
<widget class="VerticalText" native="1" name="_label" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="_slider" >
<property name="minimum" >
<number>-100</number>
</property>
<property name="maximum" >
<number>100</number>
</property>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<layoutdefault spacing="0" margin="0" />
<customwidgets>
<customwidget>
<class>VerticalText</class>
<extends>QWidget</extends>
<header>verticaltext.h</header>
</customwidget>
</customwidgets>
<includes>
<include location="local" >verticaltext.h</include>
</includes>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,70 @@
/* 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 "extensions.h"
ExtensionList::ExtensionList() : QStringList()
{
}
QString ExtensionList::forFilter() {
QString s;
for (int n=0; n < count(); n++) {
s = s + "*." + at(n) + " ";
}
if (!s.isEmpty()) s = " (" + s + ")";
return s;
}
QString ExtensionList::forRegExp() {
QString s;
for (int n=0; n < count(); n++) {
if (!s.isEmpty()) s = s + "|";
s = s + "^" + at(n) + "$";
}
return s;
}
Extensions::Extensions()
{
_video << "avi" << "vfw" << "divx"
<< "mpg" << "mpeg" << "m1v" << "m2v" << "mpv" << "dv" << "3gp"
<< "mov" << "mp4" << "m4v" << "mqv"
<< "dat" << "vcd"
<< "ogg" << "ogm"
<< "asf" << "wmv"
<< "bin" << "iso" << "vob"
<< "mkv" << "nsv" << "ram" << "flv"
<< "ts" << "rmvb" << "dvr-ms";
_audio << "mp3" << "ogg" << "wav" << "wma" << "ac3" << "ra" << "ape";
_subtitles << "srt" << "sub" << "ssa" << "ass" << "idx" << "txt" << "smi"
<< "rt" << "utf" << "aqt";
_playlist << "m3u" << "m3u8" << "pls";
_multimedia = _video;
for (int n = 0; n < _audio.count(); n++) {
if (!_multimedia.contains(_audio[n])) _multimedia << _audio[n];
}
}
Extensions::~Extensions() {
}

View File

@ -0,0 +1,50 @@
/* 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 _EXTENSIONS_H_
#define _EXTENSIONS_H_
#include <QStringList>
class ExtensionList : public QStringList
{
public:
ExtensionList();
QString forFilter();
QString forRegExp();
};
class Extensions
{
public:
Extensions();
~Extensions();
ExtensionList video() { return _video; };
ExtensionList audio() { return _audio; };
ExtensionList playlist() { return _playlist; };
ExtensionList subtitles() { return _subtitles; };
ExtensionList multimedia() { return _multimedia; };
protected:
ExtensionList _video, _audio, _playlist, _subtitles;
ExtensionList _multimedia; // video and audio
};
#endif

View File

@ -0,0 +1,60 @@
/* 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 "filedialog.h"
#include <QWidget>
QString MyFileDialog::getOpenFileName( QWidget * parent,
const QString & caption,
const QString & dir, const QString & filter,
QString * selectedFilter, QFileDialog::Options options )
{
return QFileDialog::getOpenFileName( parent, caption, dir, filter,
selectedFilter, options );
}
QString MyFileDialog::getExistingDirectory ( QWidget * parent,
const QString & caption,
const QString & dir,
QFileDialog::Options options )
{
return QFileDialog::getExistingDirectory( parent, caption, dir, options );
}
QString MyFileDialog::getSaveFileName ( QWidget * parent,
const QString & caption,
const QString & dir,
const QString & filter,
QString * selectedFilter,
QFileDialog::Options options )
{
return QFileDialog::getSaveFileName( parent, caption, dir, filter,
selectedFilter, options );
}
QStringList MyFileDialog::getOpenFileNames ( QWidget * parent,
const QString & caption,
const QString & dir,
const QString & filter,
QString * selectedFilter,
QFileDialog::Options options )
{
return QFileDialog::getOpenFileNames( parent, caption, dir, filter,
selectedFilter, options );
}

View File

@ -0,0 +1,61 @@
/* 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 _FILEDIALOG_H
#define _FILEDIALOG_H
#include <QString>
#include <QStringList>
#include <QFileDialog>
class QWidget;
class MyFileDialog {
public:
static QString getOpenFileName( QWidget * parent = 0,
const QString & caption = QString(),
const QString & dir = QString(),
const QString & filter = QString(),
QString * selectedFilter = 0,
QFileDialog::Options options = QFileDialog::DontResolveSymlinks ) ;
static QString getExistingDirectory ( QWidget * parent = 0,
const QString & caption = QString(),
const QString & dir = QString(),
QFileDialog::Options options = QFileDialog::ShowDirsOnly );
static QString getSaveFileName ( QWidget * parent = 0,
const QString & caption = QString(),
const QString & dir = QString(),
const QString & filter = QString(),
QString * selectedFilter = 0,
QFileDialog::Options options = QFileDialog::DontResolveSymlinks |
QFileDialog::DontConfirmOverwrite );
static QStringList getOpenFileNames ( QWidget * parent = 0,
const QString & caption = QString(),
const QString & dir = QString(),
const QString & filter = QString(),
QString * selectedFilter = 0,
QFileDialog::Options options = QFileDialog::DontResolveSymlinks );
};
#endif

View File

@ -0,0 +1,225 @@
/* 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 "filepropertiesdialog.h"
#include <QListWidget>
#include <QLineEdit>
#include <QTextEdit>
#include <QPushButton>
#include "images.h"
#include "infofile.h"
FilePropertiesDialog::FilePropertiesDialog( QWidget* parent, Qt::WindowFlags f )
: QDialog(parent, f)
{
setupUi(this);
// Setup buttons
okButton = buttonBox->button(QDialogButtonBox::Ok);
cancelButton = buttonBox->button(QDialogButtonBox::Cancel);
applyButton = buttonBox->button(QDialogButtonBox::Apply);
connect( applyButton, SIGNAL(clicked()), this, SLOT(apply()) );
codecs_set = FALSE;
// Read codec info from InfoReader:
InfoReader *i = InfoReader::obj();
setCodecs( i->vcList(), i->acList(), i->demuxerList() );
retranslateStrings();
}
FilePropertiesDialog::~FilePropertiesDialog() {
}
void FilePropertiesDialog::setMediaData(MediaData md) {
media_data = md;
showInfo();
}
void FilePropertiesDialog::showInfo() {
InfoFile info;
info_edit->setText( info.getInfo(media_data) );
}
void FilePropertiesDialog::retranslateStrings() {
retranslateUi(this);
setWindowIcon( Images::icon("logo") );
showInfo();
// Qt 4.2 doesn't update the buttons' text
#if QT_VERSION < 0x040300
okButton->setText( tr("OK") );
cancelButton->setText( tr("Cancel") );
applyButton->setText( tr("Apply") );
#endif
}
void FilePropertiesDialog::accept() {
qDebug("FilePropertiesDialog::accept");
hide();
setResult( QDialog::Accepted );
emit applied();
}
void FilePropertiesDialog::apply() {
qDebug("FilePropertiesDialog::apply");
setResult( QDialog::Accepted );
emit applied();
}
void FilePropertiesDialog::setCodecs(InfoList vc, InfoList ac, InfoList demuxer)
{
vclist = vc;
aclist = ac;
demuxerlist = demuxer;
InfoList::iterator it;
for ( it = vclist.begin(); it != vclist.end(); ++it ) {
vc_listbox->addItem( (*it).name() +" - "+ (*it).desc() );
}
for ( it = aclist.begin(); it != aclist.end(); ++it ) {
ac_listbox->addItem( (*it).name() +" - "+ (*it).desc() );
}
for ( it = demuxerlist.begin(); it != demuxerlist.end(); ++it ) {
demuxer_listbox->addItem( (*it).name() +" - "+ (*it).desc() );
}
codecs_set = TRUE;
}
void FilePropertiesDialog::setDemuxer(QString demuxer, QString original_demuxer) {
qDebug("FilePropertiesDialog::setDemuxer");
if (!original_demuxer.isEmpty()) orig_demuxer = original_demuxer;
int pos = find(demuxer, demuxerlist );
if (pos != -1) demuxer_listbox->setCurrentRow(pos);
qDebug(" * demuxer: '%s', pos: %d", demuxer.toUtf8().data(), pos );
}
QString FilePropertiesDialog::demuxer() {
int pos = demuxer_listbox->currentRow();
if ( pos < 0 )
return "";
else
return demuxerlist[pos].name();
}
void FilePropertiesDialog::setVideoCodec(QString vc, QString original_vc) {
qDebug("FilePropertiesDialog::setVideoCodec");
if (!original_vc.isEmpty()) orig_vc = original_vc;
int pos = find(vc, vclist );
if (pos != -1) vc_listbox->setCurrentRow(pos);
qDebug(" * vc: '%s', pos: %d", vc.toUtf8().data(), pos );
}
QString FilePropertiesDialog::videoCodec() {
int pos = vc_listbox->currentRow();
if ( pos < 0 )
return "";
else
return vclist[pos].name();
}
void FilePropertiesDialog::setAudioCodec(QString ac, QString original_ac) {
qDebug("FilePropertiesDialog::setAudioCodec");
if (!original_ac.isEmpty()) orig_ac = original_ac;
int pos = find(ac, aclist );
if (pos != -1) ac_listbox->setCurrentRow(pos);
qDebug(" * ac: '%s', pos: %d", ac.toUtf8().data(), pos );
}
QString FilePropertiesDialog::audioCodec() {
int pos = ac_listbox->currentRow();
if ( pos < 0 )
return "";
else
return aclist[pos].name();
}
void FilePropertiesDialog::on_resetDemuxerButton_clicked() {
setDemuxer( orig_demuxer );
}
void FilePropertiesDialog::on_resetACButton_clicked() {
setAudioCodec( orig_ac );
}
void FilePropertiesDialog::on_resetVCButton_clicked() {
setVideoCodec( orig_vc );
}
int FilePropertiesDialog::find(QString s, InfoList &list) {
qDebug("FilePropertiesDialog::find");
int n=0;
InfoList::iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
//qDebug(" * item: '%s', s: '%s'", (*it).name().toUtf8().data(), s.toUtf8().data());
if ((*it).name() == s) return n;
n++;
}
return -1;
}
void FilePropertiesDialog::setMplayerAdditionalArguments(QString args) {
mplayer_args_edit->setText(args);
}
QString FilePropertiesDialog::mplayerAdditionalArguments() {
return mplayer_args_edit->text();
}
void FilePropertiesDialog::setMplayerAdditionalVideoFilters(QString s) {
mplayer_vfilters_edit->setText(s);
}
QString FilePropertiesDialog::mplayerAdditionalVideoFilters() {
return mplayer_vfilters_edit->text();
}
void FilePropertiesDialog::setMplayerAdditionalAudioFilters(QString s) {
mplayer_afilters_edit->setText(s);
}
QString FilePropertiesDialog::mplayerAdditionalAudioFilters() {
return mplayer_afilters_edit->text();
}
// Language change stuff
void FilePropertiesDialog::changeEvent(QEvent *e) {
if (e->type() == QEvent::LanguageChange) {
retranslateStrings();
} else {
QWidget::changeEvent(e);
}
}
#include "moc_filepropertiesdialog.cpp"

View File

@ -0,0 +1,91 @@
/* 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 _FILEPROPERTIESDIALOG_H_
#define _FILEPROPERTIESDIALOG_H_
#include "ui_filepropertiesdialog.h"
#include "inforeader.h"
#include "mediadata.h"
class QPushButton;
class FilePropertiesDialog : public QDialog, public Ui::FilePropertiesDialog
{
Q_OBJECT
public:
FilePropertiesDialog( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~FilePropertiesDialog();
void setMediaData(MediaData md);
void setDemuxer(QString demuxer, QString original_demuxer="");
QString demuxer();
void setVideoCodec(QString vc, QString original_vc="");
QString videoCodec();
void setAudioCodec(QString ac, QString original_ac="");
QString audioCodec();
void setMplayerAdditionalArguments(QString args);
QString mplayerAdditionalArguments();
void setMplayerAdditionalVideoFilters(QString s);
QString mplayerAdditionalVideoFilters();
void setMplayerAdditionalAudioFilters(QString s);
QString mplayerAdditionalAudioFilters();
public slots:
void accept(); // Reimplemented to send a signal
void apply();
signals:
void applied();
protected slots:
virtual void on_resetDemuxerButton_clicked();
virtual void on_resetACButton_clicked();
virtual void on_resetVCButton_clicked();
protected:
// Call it as soon as possible
void setCodecs(InfoList vc, InfoList ac, InfoList demuxer);
bool hasCodecsList() { return codecs_set; };
int find(QString s, InfoList &list);
void showInfo();
protected:
virtual void retranslateStrings();
virtual void changeEvent ( QEvent * event ) ;
private:
bool codecs_set;
InfoList vclist, aclist, demuxerlist;
QString orig_demuxer, orig_ac, orig_vc;
MediaData media_data;
QPushButton * okButton;
QPushButton * cancelButton;
QPushButton * applyButton;
};
#endif

View File

@ -0,0 +1,502 @@
<ui version="4.0" >
<author>Ricardo Villalba</author>
<class>FilePropertiesDialog</class>
<widget class="QDialog" name="FilePropertiesDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>502</width>
<height>455</height>
</rect>
</property>
<property name="windowTitle" >
<string>SMPlayer - File properties</string>
</property>
<property name="windowIcon" >
<iconset/>
</property>
<property name="sizeGripEnabled" >
<bool>true</bool>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<number>0</number>
</property>
<widget class="QWidget" name="info_page" >
<attribute name="title" >
<string>&amp;Information</string>
</attribute>
<layout class="QGridLayout" >
<property name="margin" >
<number>6</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QTextEdit" name="info_edit" >
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="demuxer_page" >
<attribute name="title" >
<string>&amp;Demuxer</string>
</attribute>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>6</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="textLabel2" >
<property name="text" >
<string>&amp;Select the demuxer that will be used for this file:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
<property name="buddy" >
<cstring>demuxer_listbox</cstring>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="demuxer_listbox" />
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>241</width>
<height>41</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="resetDemuxerButton" >
<property name="text" >
<string>&amp;Reset</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="vc_page" >
<attribute name="title" >
<string>&amp;Video codec</string>
</attribute>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>6</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="textLabel3" >
<property name="text" >
<string>&amp;Select the video codec:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
<property name="buddy" >
<cstring>vc_listbox</cstring>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="vc_listbox" />
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>241</width>
<height>41</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="resetVCButton" >
<property name="text" >
<string>&amp;Reset</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="ac_page" >
<attribute name="title" >
<string>A&amp;udio codec</string>
</attribute>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>6</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="textLabel4" >
<property name="text" >
<string>&amp;Select the audio codec:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
<property name="buddy" >
<cstring>ac_listbox</cstring>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="ac_listbox" />
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>241</width>
<height>41</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="resetACButton" >
<property name="text" >
<string>&amp;Reset</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="options_page" >
<attribute name="title" >
<string>&amp;MPlayer options</string>
</attribute>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<string>Additional Options for MPlayer</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="textLabel3_2" >
<property name="text" >
<string>Here you can pass extra options to MPlayer.
Write them separated by spaces.
Example: -flip -nosound</string>
</property>
<property name="alignment" >
<set>Qt::AlignVCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="textLabel1_3" >
<property name="text" >
<string>&amp;Options:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
<property name="buddy" >
<cstring>mplayer_args_edit</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mplayer_args_edit" />
</item>
</layout>
</item>
<item>
<widget class="Line" name="line2" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="textLabel4_2" >
<property name="text" >
<string>You can also pass additional video filters.
Separate them with ",". Do not use spaces!
Example: scale=512:-2,eq2=1.1</string>
</property>
<property name="alignment" >
<set>Qt::AlignVCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="textLabel2_3" >
<property name="text" >
<string>V&amp;ideo filters:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
<property name="buddy" >
<cstring>mplayer_vfilters_edit</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mplayer_vfilters_edit" />
</item>
</layout>
</item>
<item>
<widget class="Line" name="line3" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="textLabel5_2" >
<property name="text" >
<string>And finally audio filters. Same rule as for video filters.
Example: resample=44100:0:0,volnorm</string>
</property>
<property name="alignment" >
<set>Qt::AlignVCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="textLabel3_3" >
<property name="text" >
<string>Audio &amp;filters:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
<property name="buddy" >
<cstring>mplayer_afilters_edit</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mplayer_afilters_edit" />
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>resetDemuxerButton</tabstop>
<tabstop>resetVCButton</tabstop>
<tabstop>resetACButton</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>FilePropertiesDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>267</x>
<y>468</y>
</hint>
<hint type="destinationlabel" >
<x>267</x>
<y>246</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>FilePropertiesDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>267</x>
<y>468</y>
</hint>
<hint type="destinationlabel" >
<x>267</x>
<y>246</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,247 @@
/* 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"

View File

@ -0,0 +1,65 @@
/* 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 _FLOATINGCONTROL_H_
#define _FLOATINGCONTROL_H_
#include <QWidget>
#include "config.h"
class QToolButton;
class TimeSlider;
class MySlider;
class QLCDNumber;
class QLabel;
class FloatingControl : public QWidget
{
Q_OBJECT
public:
FloatingControl( QWidget * parent = 0);
~FloatingControl();
QToolButton * rewind1;
QToolButton * rewind2;
QToolButton * rewind3;
QToolButton * forward1;
QToolButton * forward2;
QToolButton * forward3;
QToolButton * play;
QToolButton * stop;
QToolButton * pause;
TimeSlider * time;
QToolButton * fullscreen;
QToolButton * mute;
MySlider * volume;
#if NEW_CONTROLWIDGET
QLabel * time_label;
#else
QLCDNumber * lcd;
#endif
protected:
void retranslateStrings();
virtual void changeEvent ( QEvent * event ) ;
};
#endif

View File

@ -0,0 +1,106 @@
/* 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 "floatingwidget.h"
#include <QToolBar>
#include <QTimer>
#include <QHBoxLayout>
FloatingWidget::FloatingWidget( QWidget * parent )
: QWidget( parent, Qt::Window | Qt::FramelessWindowHint |
Qt::WindowStaysOnTopHint |
Qt::X11BypassWindowManagerHint )
{
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
tb = new QToolBar;
tb->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
QHBoxLayout *layout = new QHBoxLayout;
layout->setSpacing(2);
layout->setMargin(2);
layout->addWidget(tb);
setLayout(layout);
_animated = false;
animation_timer = new QTimer(this);
animation_timer->setInterval(2);
connect( animation_timer, SIGNAL(timeout()), this, SLOT(animate()) );
}
FloatingWidget::~FloatingWidget() {
}
void FloatingWidget::showOver(QWidget * widget, int size, Place place) {
qDebug("FloatingWidget::showOver");
int w = widget->width() * size / 100;
int h = height();
resize( w, h );
//qDebug("widget x: %d, y: %d, h: %d, w: %d", widget->x(), widget->y(), widget->width(), widget->height());
int x = (widget->width() - width() ) / 2;
int y;
if (place == Top)
y = 0;
else
y = widget->height() - height();
QPoint p = widget->mapToGlobal(QPoint(x, y));
//qDebug("FloatingWidget::showOver: x: %d, y: %d, w: %d, h: %d", x, y, w, h);
//qDebug("FloatingWidget::showOver: global x: %d global y: %d", p.x(), p.y());
move(p);
if (isAnimated()) {
Movement m = Upward;
if (place == Top) m = Downward;
showAnimated(p, m);
} else {
show();
}
}
void FloatingWidget::showAnimated(QPoint final_position, Movement movement) {
current_movement = movement;
final_y = final_position.y();
if (movement == Upward) {
current_y = final_position.y() + height();
} else {
current_y = final_position.y() - height();
}
move(x(), current_y);
show();
animation_timer->start();
}
void FloatingWidget::animate() {
if (current_y == final_y) {
animation_timer->stop();
} else {
if (current_movement == Upward) current_y--; else current_y++;
move(x(), current_y);
}
}
#include "moc_floatingwidget.cpp"

View File

@ -0,0 +1,64 @@
/* 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 _FLOATING_WIDGET_H_
#define _FLOATING_WIDGET_H_
#include <QWidget>
class QToolBar;
class FloatingWidget : public QWidget
{
Q_OBJECT
public:
enum Place { Top = 0, Bottom = 1 };
enum Movement { Upward = 0, Downward = 1 };
FloatingWidget(QWidget * parent = 0);
~FloatingWidget();
//! Show the floating widget over the specified widget.
void showOver(QWidget * widget, int size = 100, Place place = Bottom);
void showAnimated(QPoint final_position, Movement movement);
QToolBar * toolbar() { return tb; };
bool isAnimated() { return _animated; };
public slots:
void setAnimated(bool b) { _animated = b; };
protected:
QToolBar * tb;
private slots:
void animate();
private:
// Animation variables
bool _animated;
QTimer * animation_timer;
int final_y;
int current_y;
Movement current_movement;
};
#endif

View File

@ -0,0 +1,85 @@
/* 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 "global.h"
#include "constants.h"
#include <QSettings>
#include "preferences.h"
#include "translator.h"
#include "helper.h"
#include <QApplication>
#include <QFile>
QSettings * Global::settings = 0;
Preferences * Global::pref = 0;
Translator * Global::translator = 0;
using namespace Global;
void Global::global_init(const QString & ini_path) {
qDebug("global_init");
// Translator
translator = new Translator();
// settings
Helper::setIniPath(ini_path);
if (Helper::iniPath().isEmpty()) {
settings = new QSettings(QSettings::IniFormat, QSettings::UserScope,
QString(COMPANY), QString(PROGRAM) );
} else {
QString filename = Helper::iniPath() + "/smplayer.ini";
settings = new QSettings( filename, QSettings::IniFormat );
qDebug("global_init: config file: '%s'", filename.toUtf8().data());
}
/*
if (!ini_path.isEmpty()) {
QString file = ini_path + "/smplayer.ini";
settings = new QSettings( file, QSettings::IniFormat );
qDebug("global_init: config file: '%s'", file.toUtf8().data());
}
else
if (QFile::exists(Helper::appHomePath())) {
QString file = Helper::appHomePath() + "/smplayer.ini";
settings = new QSettings( file, QSettings::IniFormat );
qDebug("global_init: config file: '%s'", file.toUtf8().data());
}
else
{
settings = new QSettings(QSettings::IniFormat, QSettings::UserScope,
QString(COMPANY), QString(PROGRAM) );
}
*/
// Preferences
pref = new Preferences();
}
void Global::global_end() {
qDebug("global_end");
// delete
delete pref;
pref = 0;
delete settings;
delete translator;
}

View File

@ -0,0 +1,49 @@
/* 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 _GLOBAL_H_
#define _GLOBAL_H_
#include <QString>
// Some global objects
class QSettings;
class Preferences;
class Translator;
namespace Global {
//! Read and store application settings
extern QSettings * settings;
//! Prefences
extern Preferences * pref;
//! Translator (for changing language)
extern Translator * translator;
void global_init(const QString & ini_path);
void global_end();
};
#endif

View File

@ -0,0 +1,394 @@
/* 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 "helper.h"
#include <QApplication>
#include <QFileInfo>
#include <QColor>
#include <QRegExp>
#include <QDir>
#include <QTextCodec>
#include <QWidget>
#include <QLocale>
#include "config.h"
#include <QLibraryInfo>
#ifdef Q_OS_WIN
#include <windows.h> // For the screensaver stuff
#endif
#if EXTERNAL_SLEEP
#include <unistd.h>
#else
#include <qthread.h>
#endif
#if !EXTERNAL_SLEEP
class Sleeper : public QThread
{
public:
static void sleep(unsigned long secs) {QThread::sleep(secs);}
static void msleep(unsigned long msecs) {
//qDebug("sleeping...");
QThread::msleep(msecs);
//qDebug("finished");
}
static void usleep(unsigned long usecs) {QThread::usleep(usecs);}
};
#endif
QString Helper::logs;
QString Helper::app_path;
QString Helper::ini_path;
void Helper::setAppPath(QString path) {
app_path = path;
}
QString Helper::appPath() {
return app_path;
}
QString Helper::dataPath() {
#ifdef DATA_PATH
QString path = QString(DATA_PATH);
if (!path.isEmpty())
return path;
else
return appPath();
#else
return appPath();
#endif
}
QString Helper::translationPath() {
#ifdef TRANSLATION_PATH
QString path = QString(TRANSLATION_PATH);
if (!path.isEmpty())
return path;
else
return appPath() + "/translations";
#else
return appPath() + "/translations";
#endif
}
QString Helper::docPath() {
#ifdef DOC_PATH
QString path = QString(DOC_PATH);
if (!path.isEmpty())
return path;
else
return appPath() + "/docs";
#else
return appPath() + "/docs";
#endif
}
QString Helper::confPath() {
#ifdef CONF_PATH
QString path = QString(CONF_PATH);
if (!path.isEmpty())
return path;
else
return appPath();
#else
return appPath();
#endif
}
QString Helper::themesPath() {
#ifdef THEMES_PATH
QString path = QString(THEMES_PATH);
if (!path.isEmpty())
return path;
else
return appPath() + "/themes";
#else
return appPath() + "/themes";
#endif
}
QString Helper::shortcutsPath() {
#ifdef SHORTCUTS_PATH
QString path = QString(SHORTCUTS_PATH);
if (!path.isEmpty())
return path;
else
return appPath() + "/shortcuts";
#else
return appPath() + "/shortcuts";
#endif
}
QString Helper::qtTranslationPath() {
return QLibraryInfo::location(QLibraryInfo::TranslationsPath);
}
QString Helper::doc(QString file, QString locale) {
if (locale.isEmpty()) {
locale = QLocale::system().name();
}
QString f = docPath() + "/" + locale + "/" + file;
qDebug("Helper:doc: checking '%s'", f.toUtf8().data());
if (QFile::exists(f)) return f;
if (locale.indexOf(QRegExp("_[A-Z]+")) != -1) {
locale.replace(QRegExp("_[A-Z]+"), "");
f = docPath() + "/" + locale + "/" + file;
qDebug("Helper:doc: checking '%s'", f.toUtf8().data());
if (QFile::exists(f)) return f;
}
f = docPath() + "/en/" + file;
return f;
}
QString Helper::appHomePath() {
return QDir::homePath() + "/.smplayer";
}
void Helper::setIniPath(QString path) {
ini_path = path;
}
QString Helper::iniPath() {
if (!ini_path.isEmpty()) {
return ini_path;
} else {
if (QFile::exists(appHomePath())) return appHomePath();
}
return "";
}
QString Helper::filenameForPref(const QString & filename) {
QString s = filename;
s = s.replace('/', '_');
s = s.replace('\\', '_');
s = s.replace(':', '_');
s = s.replace('.', '_');
s = s.replace(' ', '_');
QFileInfo fi(filename);
if (fi.exists()) {
s += "_" + QString::number( fi.size() );
}
return s;
}
QString Helper::dvdForPref(const QString & dvd_id, int title) {
return QString("DVD_%1_%2").arg(dvd_id).arg(title);
}
void Helper::addLog(QString s) {
logs += s + "\n";
}
QString Helper::log() {
return logs;
}
QString Helper::formatTime(int secs) {
int t = secs;
int hours = (int) t / 3600;
t -= hours*3600;
int minutes = (int) t / 60;
t -= minutes*60;
int seconds = t;
QString tf;
return tf.sprintf("%02d:%02d:%02d",hours,minutes,seconds);
}
QString Helper::timeForJumps(int secs) {
int minutes = (int) secs / 60;
int seconds = secs % 60;
if (minutes==0) {
if (seconds==1)
return QObject::tr("1 second");
else
return QObject::tr("%1 seconds").arg(seconds);
}
else {
if (minutes==1) {
if (seconds==0)
return QObject::tr("1 minute");
else
if (seconds==1)
return QObject::tr("1 minute and 1 second");
else
return QObject::tr("1 minute and %1 seconds").arg(seconds);
} else {
if (seconds==0)
return QObject::tr("%1 minutes").arg(minutes);
else
if (seconds==1)
return QObject::tr("%1 minutes and 1 second").arg(minutes);
else
return QObject::tr("%1 minutes and %2 seconds").arg(minutes)
.arg(seconds);
}
}
}
#ifdef Q_OS_WIN
// This function has been copied (and modified a little bit) from Scribus (program under GPL license):
// http://docs.scribus.net/devel/util_8cpp-source.html#l00112
QString Helper::shortPathName(QString long_path) {
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_NT) && (QFile::exists(long_path))) {
QString short_path = long_path;
int max_path = 4096;
WCHAR shortName[max_path];
QString nativePath = QDir::convertSeparators(long_path);
int ret = GetShortPathNameW((LPCWSTR) nativePath.utf16(), shortName, max_path);
if (ret != ERROR_INVALID_PARAMETER && ret < MAX_PATH)
short_path = QString::fromUtf16((const ushort*) shortName);
return short_path;
} else {
return long_path;
}
}
/*
void Helper::setScreensaverEnabled(bool b) {
qDebug("Helper::setScreensaverEnabled: %d", b);
if (b) {
// Activate screensaver
SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, true, 0, SPIF_SENDWININICHANGE);
SystemParametersInfo( SPI_SETLOWPOWERACTIVE, 1, NULL, 0);
SystemParametersInfo( SPI_SETPOWEROFFACTIVE, 1, NULL, 0);
} else {
SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, false, 0, SPIF_SENDWININICHANGE);
SystemParametersInfo( SPI_SETLOWPOWERACTIVE, 0, NULL, 0);
SystemParametersInfo( SPI_SETPOWEROFFACTIVE, 0, NULL, 0);
}
}
*/
#endif
void Helper::msleep(int ms) {
#if EXTERNAL_SLEEP
//qDebug("Helper::msleep: %d (using usleep)", ms);
usleep(ms*1000);
#else
//qDebug("Helper::msleep: %d (using QThread::msleep)", ms);
Sleeper::msleep( ms );
#endif
}
QString Helper::colorToRRGGBBAA(unsigned int color) {
QColor c;
c.setRgb( color );
QString s;
return s.sprintf("%02x%02x%02x00", c.red(), c.green(), c.blue() );
}
QString Helper::colorToRRGGBB(unsigned int color) {
QColor c;
c.setRgb( color );
QString s;
return s.sprintf("%02x%02x%02x", c.red(), c.green(), c.blue() );
}
QString Helper::colorToRGB(unsigned int color) {
QColor c;
c.setRgb( color );
QString s;
return s.sprintf("0x%02x%02x%02x", c.blue(), c.green(), c.red() );
}
void Helper::setForegroundColor(QWidget * w, const QColor & color) {
QPalette p = w->palette();
p.setColor(w->foregroundRole(), color);
w->setPalette(p);
}
void Helper::setBackgroundColor(QWidget * w, const QColor & color) {
QPalette p = w->palette();
p.setColor(w->backgroundRole(), color);
w->setPalette(p);
}
QString Helper::changeSlashes(QString filename) {
// Only change if file exists (it's a local file)
if (QFileInfo(filename).exists())
return filename.replace('/', '\\');
else
return filename;
}
QString Helper::dvdSplitFolder(QString dvd_url) {
qDebug("Helper::dvdSplitFolder: '%s'", dvd_url.toUtf8().data());
QRegExp s("^dvd://(\\d+):(.*)", Qt::CaseInsensitive);
if (s.indexIn(dvd_url)!=-1) {
return s.cap(2);
} else {
return QString::null;
}
}
int Helper::dvdSplitTitle(QString dvd_url) {
qDebug("Helper::dvdSplitTitle: '%s'", dvd_url.toUtf8().data());
QRegExp s("^dvd://(\\d+)(.*)", Qt::CaseInsensitive);
if (s.indexIn(dvd_url)!=-1) {
return s.cap(1).toInt();
} else {
return -1;
}
}
bool Helper::directoryContainsDVD(QString directory) {
//qDebug("Helper::directoryContainsDVD: '%s'", directory.latin1());
QDir dir(directory);
QStringList l = dir.entryList();
bool valid = FALSE;
for (int n=0; n < l.count(); n++) {
//qDebug(" * entry %d: '%s'", n, l[n].toUtf8().data());
if (l[n].toLower() == "video_ts") valid = TRUE;
}
return valid;
}
#if COLOR_OUTPUT_SUPPORT
QString Helper::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

View 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
*/
#ifndef _HELPER_H_
#define _HELPER_H_
#include <QString>
#include <QStringList>
#ifdef Q_OS_WIN
#include "config.h"
#endif
#ifndef Q_OS_WIN
#define COLOR_OUTPUT_SUPPORT 1
#endif
class QWidget;
class QColor;
class Helper
{
public:
static void setAppPath(QString path);
static QString appPath();
static QString dataPath();
static QString translationPath();
static QString docPath();
static QString confPath();
static QString themesPath();
static QString shortcutsPath();
static QString qtTranslationPath();
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);
//! Returns a string suitable to be used for -colorkey
static QString colorToRGB(unsigned int color);
//! Changes the foreground color of the specified widget
static void setForegroundColor(QWidget * w, const QColor & color);
//! Changes the background color of the specified widget
static void setBackgroundColor(QWidget * w, const QColor & color);
//! Change filenames like "C:/Program Files/" to "C:\Program Files\"
static QString changeSlashes(QString filename);
static QString dvdSplitFolder(QString dvd_url);
static int dvdSplitTitle(QString dvd_url);
static bool directoryContainsDVD(QString directory);
/**
** \brief Strip colors and tags from MPlayer output lines
**
** Some MPlayer configurations (configured with --enable-color-console)
** use colored/tagged console output. This function removes those colors
** and tags.
**
** \param s The string to strip colors and tags from
** \return Returns a clean string (no colors, no tags)
*/
#if COLOR_OUTPUT_SUPPORT
static QString stripColorsTags(QString s);
#endif
private:
static QString logs;
static QString app_path;
static QString ini_path;
};
#endif

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Some files were not shown because too many files have changed in this diff Show More