Make 'wikipedia intro only' and backdrops configurable

This commit is contained in:
craig.p.drummond
2013-05-23 16:56:39 +00:00
committed by craig.p.drummond
parent 8780e072ff
commit 751149c28e
12 changed files with 131 additions and 13 deletions

View File

@@ -104,7 +104,7 @@ SET( CANTATA_SRCS gui/application.cpp gui/main.cpp gui/initialsettingswizard.cpp
devices/deviceoptions.cpp
context/lyricsettings.cpp context/ultimatelyricsprovider.cpp context/ultimatelyrics.cpp context/lyricsdialog.cpp
context/contextpage.cpp context/view.cpp context/artistview.cpp context/albumview.cpp context/songview.cpp context/contextengine.cpp
context/wikipediaengine.cpp context/wikipediasettings.cpp context/contextsettings.cpp)
context/wikipediaengine.cpp context/wikipediasettings.cpp context/othersettings.cpp context/contextsettings.cpp)
SET( CANTATA_MOC_HDRS
gui/initialsettingswizard.h gui/mainwindow.h gui/settings.h gui/covers.h gui/folderpage.h gui/librarypage.h gui/albumspage.h
gui/playlistspage.h gui/serverplaybacksettings.h gui/serversettings.h gui/preferencesdialog.h gui/filesettings.h
@@ -121,14 +121,14 @@ SET( CANTATA_MOC_HDRS
network/networkaccessmanager.h
context/lyricsettings.h context/ultimatelyrics.h context/ultimatelyricsprovider.h context/lyricsdialog.h
context/contextpage.h context/artistview.h context/albumview.h context/songview.h context/view.h context/contextengine.h
context/wikipediaengine.h context/wikipediasettings.h)
context/wikipediaengine.h context/wikipediasettings.h context/othersettings.h)
SET( CANTATA_UIS
gui/initialsettingswizard.ui gui/mainwindow.ui gui/folderpage.ui gui/librarypage.ui gui/albumspage.ui gui/playlistspage.ui
gui/filesettings.ui gui/interfacesettings.ui gui/playbacksettings.ui gui/serverplaybacksettings.ui gui/serversettings.ui
gui/coverdialog.ui
streams/streamspage.ui
dynamic/dynamicpage.ui dynamic/dynamicrule.ui dynamic/dynamicrules.ui
context/lyricsettings.ui context/wikipediasettings.ui
context/lyricsettings.ui context/wikipediasettings.ui context/othersettings.ui
widgets/itemview.ui)
if (ENABLE_ONLINE_SERVICES)

View File

@@ -18,14 +18,7 @@
view). Use a fading divider instead.
11. Remove lyrics and info pages, and place within a new context view.
12. Remove EchoNest usage, as this only seems to return English results. Use
wikipedia instead. Only the introduction is displayed by default. To have
the whole wikipedia page (excluding images, and some other parts), edit
Cantata's config file and add the following to the "[General]" section:
wikipediaIntroOnly=false
...any existing Artist/Album entries will have to be removed from the
cache.
wikipedia instead. Only the introduction is displayed by default.
1.0.3
-----

View File

@@ -30,6 +30,7 @@
#include "covers.h"
#include "networkaccessmanager.h"
#include "settings.h"
#include "wikipediaengine.h"
#include <QHBoxLayout>
#include <QSpacerItem>
#include <QPainter>
@@ -74,7 +75,13 @@ ContextPage::ContextPage(QWidget *parent)
connect(artist, SIGNAL(findArtist(QString)), this, SIGNAL(findArtist(QString)));
connect(album, SIGNAL(playSong(QString)), this, SIGNAL(playSong(QString)));
connect(artist, SIGNAL(haveBio(QString,QString)), album, SLOT(artistBio(QString,QString)), Qt::QueuedConnection);
readConfig();
}
void ContextPage::readConfig()
{
useBackdrop(Settings::self()->contextBackdrop());
WikipediaEngine::setIntroOnly(Settings::self()->wikipediaIntroOnly());
}
void ContextPage::useBackdrop(bool u)
@@ -82,8 +89,8 @@ void ContextPage::useBackdrop(bool u)
if (u!=drawBackdrop) {
drawBackdrop=u;
if (isVisible() && !currentArtist.isEmpty()) {
currentArtist.clear();
updateArtist=currentArtist;
currentArtist.clear();
updateBackdrop();
QWidget::update();
}

View File

@@ -41,6 +41,8 @@ public:
static const QLatin1String constCacheDir;
ContextPage(QWidget *parent=0);
void readConfig();
void useBackdrop(bool u);
void update(const Song &s);
void showEvent(QShowEvent *e);

View File

@@ -24,6 +24,7 @@
#include "contextsettings.h"
#include "wikipediasettings.h"
#include "lyricsettings.h"
#include "othersettings.h"
#include "localize.h"
ContextSettings::ContextSettings(QWidget *p)
@@ -31,18 +32,22 @@ ContextSettings::ContextSettings(QWidget *p)
{
wiki=new WikipediaSettings(this);
lyrics=new LyricSettings(this);
other=new OtherSettings(this);
addTab(wiki, i18n("Wikipedia Languages"));
addTab(lyrics, i18n("Lyrics Providers"));
addTab(other, i18n("Other"));
}
void ContextSettings::load()
{
wiki->load();
lyrics->load();
other->load();
}
void ContextSettings::save()
{
wiki->save();
lyrics->save();
other->save();
}

View File

@@ -28,6 +28,7 @@
class WikipediaSettings;
class LyricSettings;
class OtherSettings;
class ContextSettings : public QTabWidget {
public:
@@ -39,6 +40,7 @@ public:
private:
WikipediaSettings *wiki;
LyricSettings *lyrics;
OtherSettings *other;
};
#endif

51
context/othersettings.cpp Normal file
View File

@@ -0,0 +1,51 @@
/*
* Cantata
*
* Copyright (c) 2011-2013 Craig Drummond <craig.p.drummond@gmail.com>
*
* ----
*
* 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "othersettings.h"
#include "settings.h"
#include "onoffbutton.h"
OtherSettings::OtherSettings(QWidget *p)
: QWidget(p)
{
setupUi(this);
connect(wikipediaIntroOnly, SIGNAL(toggled(bool)), SLOT(toggleWikiNote()));
}
void OtherSettings::load()
{
wikipediaIntroOnly->setChecked(Settings::self()->wikipediaIntroOnly());
contextBackdrop->setChecked(Settings::self()->contextBackdrop());
toggleWikiNote();
}
void OtherSettings::save()
{
Settings::self()->saveWikipediaIntroOnly(wikipediaIntroOnly->isChecked());
Settings::self()->saveContextBackdrop(contextBackdrop->isChecked());
}
void OtherSettings::toggleWikiNote()
{
wikipediaIntroOnlyNote->setOn(!wikipediaIntroOnly->isChecked());
}

44
context/othersettings.h Normal file
View File

@@ -0,0 +1,44 @@
/*
* Cantata
*
* Copyright (c) 2011-2013 Craig Drummond <craig.p.drummond@gmail.com>
*
* ----
*
* 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; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef OTHER_SETTINGS_H
#define OTHER_SETTINGS_H
#include "ui_othersettings.h"
class OtherSettings : public QWidget, private Ui::OtherSettings
{
Q_OBJECT
public:
OtherSettings(QWidget *p);
virtual ~OtherSettings() { }
void load();
void save();
private Q_SLOTS:
void toggleWikiNote();
};
#endif

View File

@@ -36,6 +36,7 @@ public:
static void setPreferedLangs(const QStringList &l);
static const QStringList & getPreferedLangs() { return preferredLangs; }
static void setIntroOnly(bool v) { introOnly=v; }
const QStringList & getLangs() { return getPreferedLangs(); }
QString getPrefix(const QString &key) { return key.split(QLatin1Char(':')).back(); }

View File

@@ -1347,6 +1347,7 @@ void MainWindow::readSettings()
}
#endif
stopAfterCurrent=Settings::self()->stopAfterCurrent();
context->readConfig();
}
void MainWindow::updateSettings()

View File

@@ -465,7 +465,7 @@ bool Settings::wikipediaIntroOnly()
bool Settings::contextBackdrop()
{
return GET_BOOL("contextBackdrop", false);
return GET_BOOL("contextBackdrop", true);
}
QString Settings::page()
@@ -872,6 +872,16 @@ void Settings::saveWikipediaLangs(const QStringList &v)
SET_VALUE_MOD(wikipediaLangs)
}
void Settings::saveWikipediaIntroOnly(bool v)
{
SET_VALUE_MOD(wikipediaIntroOnly)
}
void Settings::saveContextBackdrop(bool v)
{
SET_VALUE_MOD(contextBackdrop)
}
void Settings::savePage(const QString &v)
{
SET_VALUE_MOD(page)

View File

@@ -207,6 +207,8 @@ public:
void saveGroupMultiple(bool v);
void saveLyricProviders(const QStringList &v);
void saveWikipediaLangs(const QStringList &v);
void saveWikipediaIntroOnly(bool v);
void saveContextBackdrop(bool v);
void savePage(const QString &v);
void saveHiddenPages(const QStringList &v);
void saveGnomeMediaKeys(bool v);