clementine/clementine-1.0.0-metalarchives.patch

223 lines
8.8 KiB
Diff
Raw Normal View History

2012-07-04 08:22:24 +04:00
diff -urN clementine-1.0.0/src/translations/ru.po clementine-1.0.0-patched/src/translations/ru.po
--- clementine-1.0.0/src/translations/ru.po 2011-12-28 05:16:09.000000000 +1100
+++ clementine-1.0.0-patched/src/translations/ru.po 2012-01-14 14:56:05.179963401 +1100
@@ -305,6 +305,10 @@
msgid "ALL GLORY TO THE HYPNOTOAD"
msgstr "ВСЯ СЛАВА ГИПНОЖАБЕ!"
+#: widgets/nowplayingwidget.cpp:122
+msgid "Search at metal-archives.com"
+msgstr "Искать на metal-archives.com"
+
#: ui/about.cpp:32
#, qt-format
msgid "About %1"
diff -urN clementine-1.0.0/src/ui/mainwindow.cpp clementine-1.0.0-patched/src/ui/mainwindow.cpp
--- clementine-1.0.0/src/ui/mainwindow.cpp 2011-12-28 05:16:09.000000000 +1100
+++ clementine-1.0.0-patched/src/ui/mainwindow.cpp 2012-01-14 16:51:19.274890182 +1100
@@ -126,6 +126,7 @@
#include <QtDebug>
#include <QTimer>
#include <QUndoStack>
+#include <QDesktopServices>
#ifdef Q_OS_WIN32
# include <qtsparkle/Updater>
@@ -351,6 +352,8 @@
connect(ui_->action_selection_set_value, SIGNAL(triggered()), SLOT(SelectionSetValue()));
connect(ui_->action_edit_value, SIGNAL(triggered()), SLOT(EditValue()));
connect(ui_->action_auto_complete_tags, SIGNAL(triggered()), SLOT(AutoCompleteTags()));
+ connect(ui_->action_open_metalarchives, SIGNAL(triggered()), SLOT(SearchMA()));
+ ui_->action_open_metalarchives->setVisible(false);
connect(ui_->action_configure, SIGNAL(triggered()), SLOT(OpenSettingsDialog()));
connect(ui_->action_about, SIGNAL(triggered()), SLOT(ShowAboutDialog()));
connect(ui_->action_about_qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
@@ -516,6 +519,7 @@
playlist_menu_->addAction(ui_->action_renumber_tracks);
playlist_menu_->addAction(ui_->action_selection_set_value);
playlist_menu_->addAction(ui_->action_auto_complete_tags);
+ playlist_menu_->addAction(ui_->action_open_metalarchives);
playlist_menu_->addSeparator();
playlist_copy_to_library_ = playlist_menu_->addAction(IconLoader::Load("edit-copy"), tr("Copy to library..."), this, SLOT(PlaylistCopyToLibrary()));
playlist_move_to_library_ = playlist_menu_->addAction(IconLoader::Load("go-jump"), tr("Move to library..."), this, SLOT(PlaylistMoveToLibrary()));
@@ -542,6 +546,8 @@
connect(devices_->connected_devices_model(), SIGNAL(IsEmptyChanged(bool)),
playlist_copy_to_device_, SLOT(setDisabled(bool)));
+ connect(ui_->action_metalarchives, SIGNAL(toggled(bool)), SLOT(EnableMA(bool)));
+
// Internet connections
connect(internet_model_, SIGNAL(StreamError(QString)), SLOT(ShowErrorDialog(QString)));
connect(internet_model_, SIGNAL(StreamMetadataFound(QUrl,Song)), playlists_, SLOT(SetActiveStreamMetadata(QUrl,Song)));
@@ -684,6 +690,7 @@
SLOT(NowPlayingWidgetPositionChanged(bool)));
connect(ui_->action_hypnotoad, SIGNAL(toggled(bool)), ui_->now_playing, SLOT(AllHail(bool)));
connect(ui_->action_kittens, SIGNAL(toggled(bool)), ui_->now_playing, SLOT(EnableKittens(bool)));
+ connect(ui_->action_metalarchives, SIGNAL(toggled(bool)), ui_->now_playing, SLOT(EnableMA(bool)));
NowPlayingWidgetPositionChanged(ui_->now_playing->show_above_status_bar());
// Load theme
@@ -2171,6 +2178,28 @@
ui_->playlist->view()->update();
}
+void MainWindow::EnableMA(bool metalarchives) {
+ ui_->action_open_metalarchives->setVisible(metalarchives);
+}
+
+void MainWindow::SearchMA() {
+ QStringList albums;
+ foreach (const QModelIndex& index,
+ ui_->playlist->view()->selectionModel()->selection().indexes()) {
+ if (index.column() != 0)
+ continue;
+ int row = playlists_->current()->proxy()->mapToSource(index).row();
+ PlaylistItemPtr item(playlists_->current()->item_at(row));
+ QString album = item->Metadata().artist() + "/" + item->Metadata().album();
+ if (!albums.contains(album))
+ {
+ QDesktopServices::openUrl(QUrl("http://www.metal-archives.com/albums/" + Qt::escape(album)));
+ albums << album;
+ }
+ }
+
+}
+
QPixmap MainWindow::CreateOverlayedIcon(int position, int scrobble_point) {
QPixmap normal_icon = QIcon(":/last.fm/as_light.png").pixmap(16);
QPixmap light_icon = QIcon(":/last.fm/as.png").pixmap(16);
diff -urN clementine-1.0.0/src/ui/mainwindow.h clementine-1.0.0-patched/src/ui/mainwindow.h
--- clementine-1.0.0/src/ui/mainwindow.h 2011-12-28 05:16:09.000000000 +1100
+++ clementine-1.0.0-patched/src/ui/mainwindow.h 2012-01-14 16:41:22.000000000 +1100
@@ -162,6 +162,9 @@
void AutoCompleteTagsAccepted();
void PlaylistUndoRedoChanged(QAction* undo, QAction* redo);
+ void EnableMA(bool metalarchives);
+ void SearchMA();
+
void PlaylistCopyToLibrary();
void PlaylistMoveToLibrary();
void PlaylistCopyToDevice();
diff -urN clementine-1.0.0/src/ui/mainwindow.ui clementine-1.0.0-patched/src/ui/mainwindow.ui
--- clementine-1.0.0/src/ui/mainwindow.ui 2011-12-03 08:24:44.000000000 +1100
+++ clementine-1.0.0-patched/src/ui/mainwindow.ui 2012-01-14 15:57:07.000000000 +1100
@@ -475,6 +475,7 @@
<addaction name="action_rain"/>
<addaction name="action_hypnotoad"/>
<addaction name="action_kittens"/>
+ <addaction name="action_metalarchives"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="menu_tools">
@@ -695,6 +696,14 @@
<string comment="Label for buton to enable/disable kittens in the now playing widget">Kittens</string>
</property>
</action>
+ <action name="action_metalarchives">
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string comment="Label for buton to enable/disable search at metal-archives.com in the now playing widget menu">Encyclopaedia Metallum</string>
+ </property>
+ </action>
<action name="action_shuffle_mode">
<property name="text">
<string>&amp;Shuffle mode</string>
@@ -815,6 +824,11 @@
<string>Ctrl+T</string>
</property>
</action>
+ <action name="action_open_metalarchives">
+ <property name="text">
+ <string>Search at metal-archives.com</string>
+ </property>
+ </action>
<action name="action_toggle_scrobbling">
<property name="text">
<string>Toggle scrobbling</string>
diff -urN clementine-1.0.0/src/widgets/nowplayingwidget.cpp clementine-1.0.0-patched/src/widgets/nowplayingwidget.cpp
--- clementine-1.0.0/src/widgets/nowplayingwidget.cpp 2011-12-03 08:24:44.000000000 +1100
+++ clementine-1.0.0-patched/src/widgets/nowplayingwidget.cpp 2012-01-14 14:44:42.000000000 +1100
@@ -33,6 +33,7 @@
#include <QTextDocument>
#include <QTimeLine>
#include <QtDebug>
+#include <QDesktopServices>
const char* NowPlayingWidget::kSettingsGroup = "NowPlayingWidget";
@@ -64,6 +65,7 @@
mode_(SmallSongDetails),
menu_(new QMenu(this)),
above_statusbar_action_(NULL),
+ metalarchives_action_(NULL),
visible_(false),
small_ideal_height_(0),
cover_height_(0),
@@ -116,6 +118,11 @@
connect(above_statusbar_action_, SIGNAL(toggled(bool)), SLOT(ShowAboveStatusBar(bool)));
above_statusbar_action_->setChecked(s.value("above_status_bar", false).toBool());
+ menu_->addSeparator();
+ metalarchives_action_ = menu_->addAction(tr("Search at metal-archives.com"));
+ metalarchives_action_->setVisible(false);
+ connect(metalarchives_action_, SIGNAL(triggered()), SLOT(SearchMA()));
+
bask_in_his_glory_action_ = menu_->addAction(tr("ALL GLORY TO THE HYPNOTOAD"));
bask_in_his_glory_action_->setVisible(false);
connect(bask_in_his_glory_action_, SIGNAL(triggered()), SLOT(Bask()));
@@ -441,6 +448,11 @@
aww_ = aww;
}
+void NowPlayingWidget::EnableMA(bool metalarchives) {
+ metalarchives_action_->setVisible(metalarchives);
+}
+
+
void NowPlayingWidget::LoadCoverFromFile() {
QString cover = album_cover_choice_controller_->LoadCoverFromFile(&metadata_);
@@ -479,6 +491,10 @@
album_cover_choice_controller_->SetLibrary(backend);
}
+void NowPlayingWidget::SearchMA() {
+ QDesktopServices::openUrl(QUrl("http://www.metal-archives.com/albums/" + Qt::escape(metadata_.artist()) + "/" + Qt::escape(metadata_.album())));
+}
+
void NowPlayingWidget::Bask() {
big_hypnotoad_.reset(new FullscreenHypnotoad);
big_hypnotoad_->showFullScreen();
diff -urN clementine-1.0.0/src/widgets/nowplayingwidget.h clementine-1.0.0-patched/src/widgets/nowplayingwidget.h
--- clementine-1.0.0/src/widgets/nowplayingwidget.h 2011-12-03 08:24:44.000000000 +1100
+++ clementine-1.0.0-patched/src/widgets/nowplayingwidget.h 2012-01-14 14:42:55.000000000 +1100
@@ -76,6 +76,7 @@
void Stopped();
void AllHail(bool hypnotoad);
void EnableKittens(bool aww);
+ void EnableMA(bool metalarchives);
protected:
void paintEvent(QPaintEvent* e);
@@ -103,6 +104,8 @@
void UnsetCover();
void ShowCover();
+ void SearchMA();
+
void Bask();
private:
@@ -125,6 +128,8 @@
QAction* above_statusbar_action_;
+ QAction* metalarchives_action_;
+
bool visible_;
int small_ideal_height_;
int cover_height_;