1 /***************************************************************************
2 * Copyright (C) 2013 by Ilya Kotov *
3 * forkotov02@ya.ru *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
20
21 #include <QAction>
22 #include <qmmp/soundcore.h>
23 #include <qmmpui/uihelper.h>
24 #include <qmmpui/playlistmanager.h>
25 #include <qmmpui/playlistitem.h>
26 #include <qmmpui/mediaplayer.h>
27 #include "rgscandialog.h"
28 #include "rgscanhelper.h"
29
RGScanHelper(QObject * parent)30 RGScanHelper::RGScanHelper(QObject *parent) : QObject(parent)
31 {
32 QAction *action = new QAction(tr("ReplayGain Scanner"), this);
33 action->setShortcut(tr("Meta+R"));
34 UiHelper::instance()->addAction(action, UiHelper::PLAYLIST_MENU);
35 connect (action, SIGNAL(triggered ()), SLOT(openRGScaner()));
36 }
37
~RGScanHelper()38 RGScanHelper::~RGScanHelper()
39 {}
40
openRGScaner()41 void RGScanHelper::openRGScaner()
42 {
43 PlayListManager *pl_manager = MediaPlayer::instance()->playListManager();
44 QList <PlayListTrack *> tracks = pl_manager->selectedPlayList()->selectedTracks();
45 if (tracks.isEmpty())
46 return;
47
48 RGScanDialog *d = new RGScanDialog(tracks, qApp->activeWindow ());
49 d->exec();
50 d->deleteLater();
51 }
52