aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input/cdaudio/decodercdaudiofactory.h
blob: 9432c261f98c4e77e1f6e1004944eeb298ceccf3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/***************************************************************************
 *   Copyright (C) 2009 by Ilya Kotov                                      *
 *   forkotov02@hotmail.ru                                                 *
 *                                                                         *
 *   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.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 ***************************************************************************/
#ifndef DECODERCDAUDIOFACTORY_H
#define DECODERCDAUDIOFACTORY_H

#include <QObject>
#include <QString>
#include <QIODevice>
#include <QWidget>

#include <qmmp/decoder.h>
#include <qmmp/output.h>
#include <qmmp/decoderfactory.h>
#include <qmmp/fileinfo.h>

class DecoderCDAudioFactory : public QObject, DecoderFactory
{
    Q_OBJECT
    Q_INTERFACES(DecoderFactory);
public:
    bool supports(const QString &source) const;
    bool canDecode(QIODevice *input) const;
    const DecoderProperties properties() const;
    Decoder *create(const QString &, QIODevice *);
    QList<FileInfo *> createPlayList(const QString &fileName, bool useMetaData);
    MetaDataModel* createMetaDataModel(const QString &path, QObject *parent = 0);
    void showSettings(QWidget *parent);
    void showAbout(QWidget *parent);
    QTranslator *createTranslator(QObject *parent);
};

#endif
865f9a5e38> 2013-11-06 11:44:05 +0000 fixed regression' href='/qmmp/commit/src/plugins/General/hotkey/settingsdialog.cpp?id=81a0b1c8b5be7affa71bccdd55ed90fa67863be7'>81a0b1c8b
5db018499




c3d5ffcaf
bfa4ea1b7
5db018499




5db018499










1e31fe896
5db018499









7ef8d11ba

5db018499

7ef8d11ba
1e31fe896
5db018499


c12d72d9e
409e6f5ba

c12d72d9e

1e31fe896

c12d72d9e


5db018499









c3d5ffcaf
5db018499

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
                                                                            
                                                                            
                                                                            













                                                                            
                                                                            



                                                                             
                      
                      
                    





                                               

                                                                                      
                                                                                 
                                               
                                                                                     













                                                                                  


                                                                 
                                                                         




                                                                                              
                                                                                                    
                                                                                                        




                            










                                                                 
                                              









                                                                              

                                                                                                                          

               
                      
                                                                      


                                                     
                                                                                                       

                                                                                                       

                                     

                                                  


                                                                                                              









                                                       
                                                                                                                 

     
/***************************************************************************
 *   Copyright (C) 2009-2021 by Ilya Kotov                                 *
 *   forkotov02@ya.ru                                                      *
 *                                                                         *
 *   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.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 ***************************************************************************/

#include <QSettings>
#include <QHeaderView>
#include <QMessageBox>
#include <qmmp/qmmp.h>
#include <algorithm>
#include "hotkeydialog.h"
#include "settingsdialog.h"

SettingsDialog::SettingsDialog(QWidget *parent)
        : QDialog(parent)
{
    m_ui.setupUi(this);
    m_ui.tableWidget->verticalHeader()->setDefaultSectionSize(fontMetrics().height());
    m_ui.tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
    m_ui.tableWidget->verticalHeader()->hide();
    m_ui.tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
    m_ui.tableWidget->setRowCount (13);
    m_ui.tableWidget->setItem(0,0, new QTableWidgetItem(tr("Play")));
    m_ui.tableWidget->setItem(1,0, new QTableWidgetItem(tr("Stop")));
    m_ui.tableWidget->setItem(2,0, new QTableWidgetItem(tr("Pause")));
    m_ui.tableWidget->setItem(3,0, new QTableWidgetItem(tr("Play/Pause")));
    m_ui.tableWidget->setItem(4,0, new QTableWidgetItem(tr("Next")));
    m_ui.tableWidget->setItem(5,0, new QTableWidgetItem(tr("Previous")));
    m_ui.tableWidget->setItem(6,0, new QTableWidgetItem(tr("Show/Hide")));
    m_ui.tableWidget->setItem(7,0, new QTableWidgetItem(tr("Volume +")));
    m_ui.tableWidget->setItem(8,0, new QTableWidgetItem(tr("Volume -")));
    m_ui.tableWidget->setItem(9,0, new QTableWidgetItem(tr("Forward 5 seconds")));
    m_ui.tableWidget->setItem(10,0, new QTableWidgetItem(tr("Rewind 5 seconds")));
    m_ui.tableWidget->setItem(11,0, new QTableWidgetItem(tr("Jump to track")));
    m_ui.tableWidget->setItem(12,0, new QTableWidgetItem(tr("Mute")));

    QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
    settings.beginGroup("Hotkey");
    for (int i = Hotkey::PLAY, j = 0; i <= Hotkey::VOLUME_MUTE; ++i, ++j)
    {
        Hotkey *hotkey = new Hotkey;
        hotkey->action = i;
        hotkey->key = settings.value(QString("key_%1").arg(i), hotkey->defaultKey()).toUInt();
        hotkey->mod = settings.value(QString("modifiers_%1").arg(i), 0).toUInt();
        m_ui.tableWidget->setItem(j,1, new QTableWidgetItem(HotkeyManager::getKeyString(hotkey->key,
                                                                                      hotkey->mod), i));
        m_hotkeys << hotkey;
    }
    settings.endGroup();
}

SettingsDialog::~SettingsDialog()
{
    while (!m_hotkeys.isEmpty())
        delete m_hotkeys.takeFirst ();

}

void SettingsDialog::accept()
{
    QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
    settings.beginGroup("Hotkey");
    for(const Hotkey *k : qAsConst(m_hotkeys))
    {
        settings.setValue(QString("key_%1").arg(k->action), k->key);
        settings.setValue(QString("modifiers_%1").arg(k->action), k->mod);
    }
    settings.endGroup();
    QDialog::accept();
}

void SettingsDialog::on_tableWidget_itemDoubleClicked (QTableWidgetItem *item)
{
    auto it = std::find_if(m_hotkeys.cbegin(), m_hotkeys.cend(), [item](Hotkey *k) { return k->action == item->type(); });
    if(it == m_hotkeys.cend())
        return;

    Hotkey *key = *it;
    HotkeyDialog *dialog = new HotkeyDialog(key->key, key->mod, this);