summaryrefslogtreecommitdiff
path: root/src/basegui.cpp
diff options
context:
space:
mode:
authorAlessio Treglia <alessio@debian.org>2013-02-10 10:18:21 +0000
committerAlessio Treglia <alessio@debian.org>2013-02-10 10:18:21 +0000
commit038de1a143b9775f37d4848f52c59af7cee66e36 (patch)
tree8d10a35c194be220b6cb2d1b2982546dbcef9480 /src/basegui.cpp
parent69d32924ffbfe2bb05d881a23af13b6070b9a9bd (diff)
Imported Upstream version 0.8.3
Diffstat (limited to 'src/basegui.cpp')
-rw-r--r--src/basegui.cpp69
1 files changed, 50 insertions, 19 deletions
diff --git a/src/basegui.cpp b/src/basegui.cpp
index 14c92cc..f3558de 100644
--- a/src/basegui.cpp
+++ b/src/basegui.cpp
@@ -308,12 +308,6 @@ void BaseGui::createActions() {
connect( openAudioCDAct, SIGNAL(triggered()),
this, SLOT(openAudioCD()) );
-#ifdef Q_OS_WIN
- // VCD's and Audio CD's seem they don't work on windows
- //openVCDAct->setEnabled(pref->enable_vcd_on_windows);
- openAudioCDAct->setEnabled(pref->enable_audiocd_on_windows);
-#endif
-
openDVDAct = new MyAction( this, "open_dvd" );
connect( openDVDAct, SIGNAL(triggered()),
this, SLOT(openDVD()) );
@@ -750,9 +744,9 @@ void BaseGui::createActions() {
connect( showCheckUpdatesAct, SIGNAL(triggered()),
this, SLOT(helpCheckUpdates()) );
- donateAct = new MyAction( this, "donate" );
- connect( donateAct, SIGNAL(triggered()),
- this, SLOT(helpDonate()) );
+ showConfigAct = new MyAction( this, "show_config" );
+ connect( showConfigAct, SIGNAL(triggered()),
+ this, SLOT(helpShowConfig()) );
aboutQtAct = new MyAction( this, "about_qt" );
connect( aboutQtAct, SIGNAL(triggered()),
@@ -960,6 +954,8 @@ void BaseGui::createActions() {
channelsStereoAct = new MyActionGroupItem(this, channelsGroup, "channels_stereo", MediaSettings::ChStereo);
channelsSurroundAct = new MyActionGroupItem(this, channelsGroup, "channels_surround", MediaSettings::ChSurround);
channelsFull51Act = new MyActionGroupItem(this, channelsGroup, "channels_ful51", MediaSettings::ChFull51);
+ channelsFull61Act = new MyActionGroupItem(this, channelsGroup, "channels_ful61", MediaSettings::ChFull61);
+ channelsFull71Act = new MyActionGroupItem(this, channelsGroup, "channels_ful71", MediaSettings::ChFull71);
connect( channelsGroup, SIGNAL(activated(int)),
core, SLOT(setAudioChannels(int)) );
@@ -1561,7 +1557,7 @@ void BaseGui::retranslateStrings() {
showFAQAct->change( Images::icon("faq"), tr("&FAQ") );
showCLOptionsAct->change( Images::icon("cl_help"), tr("&Command line options") );
showCheckUpdatesAct->change( Images::icon("check_updates"), tr("Check for &updates") );
- donateAct->change( Images::icon("donate"), tr("&Donate") );
+ showConfigAct->change( Images::icon("show_config"), tr("&Open configuration folder") );
aboutQtAct->change( QPixmap(":/icons-png/qt.png"), tr("About &Qt") );
aboutThisAct->change( Images::icon("logo_small"), tr("About &SMPlayer") );
@@ -1766,6 +1762,8 @@ void BaseGui::retranslateStrings() {
channelsStereoAct->change( tr("&Stereo") );
channelsSurroundAct->change( tr("&4.0 Surround") );
channelsFull51Act->change( tr("&5.1 Surround") );
+ channelsFull61Act->change( tr("&6.1 Surround") );
+ channelsFull71Act->change( tr("&7.1 Surround") );
stereoAct->change( tr("&Stereo") );
leftChannelAct->change( tr("&Left channel") );
@@ -1902,6 +1900,9 @@ void BaseGui::createCore() {
connect( core, SIGNAL(mediaStoppedByUser()),
this, SLOT(exitFullscreenOnStop()) );
+ connect( core, SIGNAL(mediaStoppedByUser()),
+ mplayerwindow, SLOT(showLogo()) );
+
connect( core, SIGNAL(mediaLoaded()),
this, SLOT(enableActionsOnPlaying()) );
#if NOTIFY_AUDIO_CHANGES
@@ -1967,7 +1968,11 @@ void BaseGui::createMplayerWindow() {
#endif
mplayerwindow->allowVideoMovement( pref->allow_video_movement );
- QHBoxLayout * layout = new QHBoxLayout;
+#if LOGO_ANIMATION
+ mplayerwindow->setAnimatedLogo( pref->animated_logo);
+#endif
+
+ QVBoxLayout * layout = new QVBoxLayout;
layout->setSpacing(0);
layout->setMargin(0);
layout->addWidget(mplayerwindow);
@@ -1994,6 +1999,8 @@ void BaseGui::createMplayerWindow() {
this, SLOT(xbutton2ClickFunction()) );
connect( mplayerwindow, SIGNAL(mouseMoved(QPoint)),
this, SLOT(checkMousePos(QPoint)) );
+ connect( mplayerwindow, SIGNAL(mouseMovedDiff(QPoint)),
+ this, SLOT(moveWindow(QPoint)));
}
void BaseGui::createVideoEqualizer() {
@@ -2060,6 +2067,10 @@ void BaseGui::createPlaylist() {
*/
connect( playlist, SIGNAL(playlistEnded()),
this, SLOT(playlistHasFinished()) );
+
+ connect( playlist, SIGNAL(playlistEnded()),
+ mplayerwindow, SLOT(showLogo()) );
+
/*
connect( playlist, SIGNAL(visibilityChanged()),
this, SLOT(playlistVisibilityChanged()) );
@@ -2478,7 +2489,7 @@ void BaseGui::createMenus() {
helpMenu->addAction(showFAQAct);
helpMenu->addAction(showCLOptionsAct);
helpMenu->addAction(showCheckUpdatesAct);
- helpMenu->addAction(donateAct);
+ helpMenu->addAction(showConfigAct);
helpMenu->addSeparator();
helpMenu->addAction(aboutQtAct);
helpMenu->addAction(aboutThisAct);
@@ -3090,6 +3101,10 @@ void BaseGui::updateRecents() {
// Let's see if it looks like a file (no dvd://1 or something)
if (fullname.indexOf(QRegExp("^.*://.*")) == -1) filename = fi.fileName();
+ if (filename.size() > 85) {
+ filename = filename.left(80) + "...";
+ }
+
QAction * a = recentfiles_menu->addAction( QString("%1. " + filename ).arg( i.insert( i.size()-1, '&' ), 3, ' ' ));
a->setStatusTip(fullname);
a->setData(n);
@@ -3665,9 +3680,15 @@ void BaseGui::loadAudioFile() {
}
void BaseGui::helpFAQ() {
+ /*
QUrl url = QUrl::fromLocalFile(Paths::doc("faq.html", pref->language));
qDebug("BaseGui::helpFAQ: file to open %s", url.toString().toUtf8().data());
QDesktopServices::openUrl( url );
+ */
+
+ QString url = "http://smplayer.sourceforge.net/faq.php";
+ if (!pref->language.isEmpty()) url += QString("?tr_lang=%1").arg(pref->language);
+ QDesktopServices::openUrl( QUrl(url) );
}
void BaseGui::helpCLOptions() {
@@ -3685,13 +3706,8 @@ void BaseGui::helpCheckUpdates() {
QDesktopServices::openUrl( QUrl(url) );
}
-void BaseGui::helpDonate() {
- QMessageBox d(QMessageBox::NoIcon, tr("Donate"),
- tr("If you like SMPlayer, a really good way to support it is by sending a donation, even the smallest one is highly appreciated.") + "<br>" +
- tr("You can send your donation using %1.").arg("<a href=\"https://sourceforge.net/donate/index.php?group_id=185512\">"+tr("this form")),
- QMessageBox::Ok, this);
- d.setIconPixmap( Images::icon("logo", 64) );
- d.exec();
+void BaseGui::helpShowConfig() {
+ QDesktopServices::openUrl(QUrl::fromLocalFile(Paths::configPath()));
}
void BaseGui::helpAbout() {
@@ -4160,6 +4176,8 @@ void BaseGui::exitFullscreenOnStop() {
void BaseGui::playlistHasFinished() {
qDebug("BaseGui::playlistHasFinished");
+ core->stop();
+
exitFullscreenOnStop();
qDebug("BaseGui::playlistHasFinished: arg_close_on_finish: %d, pref->close_on_finish: %d", arg_close_on_finish, pref->close_on_finish);
@@ -4461,6 +4479,13 @@ void BaseGui::loadQss(QString filename) {
file.open(QFile::ReadOnly);
QString styleSheet = QLatin1String(file.readAll());
+ QDir current = QDir::current();
+ QString td = Images::themesDirectory();
+ QString relativePath = current.relativeFilePath(td);
+ styleSheet.replace(QRegExp("url\\s*\\(\\s*([^\\);]+)\\s*\\)", Qt::CaseSensitive, QRegExp::RegExp2),
+ QString("url(%1\\1)").arg(relativePath + "/"));
+ qDebug("styeSheet: %s", styleSheet.toUtf8().constData());
+
qApp->setStyleSheet(styleSheet);
}
@@ -4506,6 +4531,12 @@ void BaseGui::saveActions() {
#endif
}
+void BaseGui::moveWindow(QPoint diff) {
+ if (pref->fullscreen || isMaximized()) {
+ return;
+ }
+ move(pos() + diff);
+}
void BaseGui::showEvent( QShowEvent * ) {
qDebug("BaseGui::showEvent");