blob: 91e655ffa7c74efade2fb1ba6ae2c91f67055fc1 (
plain)
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
|
#pragma once
#include <QMap>
#include <QMutex>
#include <QStackedWidget>
#include <QString>
#include <QEvent>
#include "library/libraryview.h"
#include "skin/skincontext.h"
#include "widget/wbasewidget.h"
class KeyboardEventFilter;
class WLibrary : public QStackedWidget, public WBaseWidget {
Q_OBJECT
public:
explicit WLibrary(QWidget* parent);
void setup(const QDomNode& node, const SkinContext& context);
// registerView is used to add a view to the LibraryWidget which the widget
// can display on request via showView(). To switch to a given view, call
// showView with the name provided here. WLibraryWidget takes ownership of
// the view and is in charge of deleting it. Returns whether or not the
// registration was successful. Registered widget must implement the
// LibraryView interface.
bool registerView(const QString& name, QWidget* view);
LibraryView* getActiveView() const;
// Alpha value for row color background
static constexpr double kDefaultTrackTableBackgroundColorOpacity = 0.125; // 12.5% opacity
static constexpr double kMinTrackTableBackgroundColorOpacity = 0.0; // 0% opacity
static constexpr double kMaxTrackTableBackgroundColorOpacity = 1.0; // 100% opacity
double getTrackTableBackgroundColorOpacity() const {
return m_trackTableBackgroundColorOpacity;
}
bool getShowButtonText() const {
return m_bShowButtonText;
}
public slots:
// Show the view registered with the given name. Does nothing if the current
// view is the specified view, or if the name does not specify any
// registered view.
void switchToView(const QString& name);
void search(const QString&);
protected:
bool event(QEvent* pEvent) override;
private:
QMutex m_mutex;
QMap<QString, QWidget*> m_viewMap;
double m_trackTableBackgroundColorOpacity;
bool m_bShowButtonText;
};
|