File: PlayBackDialog.h

package info (click to toggle)
kwave 25.04.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,272 kB
  • sloc: cpp: 56,173; xml: 817; perl: 688; sh: 57; makefile: 11
file content (168 lines) | stat: -rw-r--r-- 5,435 bytes parent folder | download
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/***************************************************************************
       PlayBackDialog.h  -  dialog for configuring the playback
                             -------------------
    begin                : Sun May 13 2001
    copyright            : (C) 2001 by Thomas Eschenbacher
    email                : Thomas.Eschenbacher@gmx.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef PLAY_BACK_DIALOG_H
#define PLAY_BACK_DIALOG_H

#include "config.h"

#include <QMap>
#include <QString>

#include "libkwave/PlayBackParam.h"
#include "libkwave/PlayBackTypesMap.h"

#include "libgui/TreeWidgetWrapper.h"

#include "ui_PlayBackDlg.h"

class QTreeWidgetItem;

namespace Kwave
{

    class PlaybackController;
    class PlayBackDevice;
    class Plugin;

    class PlayBackDialog: public QDialog, public Ui::PlayBackDlg
    {
        Q_OBJECT

    public:
        /** Constructor */
        PlayBackDialog(Kwave::Plugin &p,
                       Kwave::PlaybackController &playback_controller,
                       const Kwave::PlayBackParam &params);

        /** Destructor */
        ~PlayBackDialog() override;

        /** Returns the current set of parameters */
        const Kwave::PlayBackParam &params();

        /**
         * Selects a new playback method.
         */
        void setMethod(Kwave::playback_method_t method);

        /**
         * Sets the list of supported devices, just entries
         * for the device selection combo box.
         */
        void setSupportedDevices(QStringList devices);

        /** return the file filter used for the "Select..." dialog */
        inline QString fileFilter() {
            return m_file_filter;
        }

        /** Sets the list of supported bits per sample */
        void setSupportedBits(const QList<unsigned int> &bits);

        /**
         * Sets the lowest and highest number of playback channels
         * @param min lowest supported number of channels
         * @param max highest supported number of channels
         */
        void setSupportedChannels(unsigned int min, unsigned int max);

    signals:

        /** emits changes in the currently selected playback method */
        void sigMethodChanged(Kwave::playback_method_t method);

        /** emitted when the user clicked on the "Test..." button */
        void sigTestPlayback();

    public slots:

        /** set the file filter used for the "Select..." dialog */
        void setFileFilter(const QString &filter);

        /** set a new device name */
        void setDevice(const QString &device);

        /** sets the new value for bits per sample */
        void setBitsPerSample(unsigned int bits);

        /** Sets the number of channels */
        void setChannels(int channels);

    private slots:

        /**
         * called when a new playback method has been selected
         * from the combo box
         * @param index the position within the combo box
         */
        void methodSelected(int index);

        /** Selects a buffer size exponent */
        void setBufferSize(int exp);

        /** Select a playback device through a File/Open dialog */
        void selectPlaybackDevice();

        /** selection in the device list view has changed */
        void listEntrySelected(QTreeWidgetItem *current,
                               QTreeWidgetItem *previous);

        /** selection in the device list view has changed */
        void listItemExpanded(QTreeWidgetItem *item);

        /**
         * updates/fixes the device selection when the tree view has
         * lost focus, to avoid that nothing is selected
         */
        void updateListSelection();

        /** selection in the bits per sample combo box has changed */
        void bitsPerSampleSelected(const QString &text);

        /** invoke the online help */
        void invokeHelp();

    private:

        /** reference to the playback controller */
        Kwave::PlaybackController &m_playback_controller;

        /** The playback device used for configuring and testing playback */
        Kwave::PlayBackDevice *m_device;

        /** all parameters needed for playback */
        Kwave::PlayBackParam m_playback_params;

        /** map of playback methods/types */
        Kwave::PlayBackTypesMap m_methods_map;

        /** file filter for the "Select..." dialog (optional) */
        QString m_file_filter;

        /** map for items in the list view */
        QMap<QTreeWidgetItem *, QString> m_devices_list_map;

        /** if false, do nothing in setDevice */
        bool m_enable_setDevice;
    };
}

#endif /* _PLAY_BACK_DIALOG_H */

//***************************************************************************
//***************************************************************************