summaryrefslogtreecommitdiffstats
path: root/noatun/modules/kjofol-skin/kjloader.h
blob: 44b507d65cd54ee8ccb9232316b1f85db4ef719c (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
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
#ifndef KJLOADER_H
#define KJLOADER_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

// local includes
#include "parser.h"

// noatun-specific includes
#include <noatun/plugin.h>
#include <noatun/app.h>

// system includes
#include <qwidget.h>
#include <qbitmap.h>
#include <qptrlist.h>
#include <qcstring.h>

#include <kwinmodule.h>

class QLabel;
class KJWidget;
class KHelpMenu;
class KJSeeker;
class NoatunPreferences;
class KJToolTip;
class KJFont;
class KJPrefs;


class KJLoader :  public QWidget, public UserInterface, public Parser
{
Q_OBJECT
NOATUNPLUGIND

	friend class KJWidget;
public:
	KJLoader();
	~KJLoader();

public:
	void minimize();
	KHelpMenu *helpMenu() const { return mHelpMenu; }
	QStringList &item(const QString &key) { return *Parser::find(key); }

	// returns path to currently loaded configfile
	// can be either a newly loaded one or one of the three below
	QString currentSkin() { return mCurrentSkin; }

	// returns path to mainskin-configfile
	QString currentDefaultSkin() { return mCurrentDefaultSkin; }

	//returns path to dockmode-configfile if present
	QString currentDockModeSkin() { return mCurrentDockModeSkin; }

	//returns path to winshademode-configfile if present (not supported yet)
	QString currentWinshadeModeSkin() { return mCurrentWinshadeModeSkin; }

	KJPrefs *prefs() const { return mPrefs; }

	QPtrList<KJWidget> widgetsAt(const QPoint &pt) const;

	void removeChild(KJWidget *c);
	void addChild(KJWidget *c);

public slots:
	void loadSkin(const QString &file);
	void readConfig();
	void switchToDockmode();
	void returnFromDockmode();

protected:
	void unloadSkin();
	void showSplash();

public slots:
	void timeUpdate();
	void newSong();

private slots:
	void loadSeeker();
	void slotWindowActivate(WId win);
	void slotWindowRemove(WId win);
	void slotWindowChange(WId win);
	void slotDesktopChange(int);
	void slotStackingChanged();
	void restack();
	void hideSplash();

protected:
	virtual void mouseMoveEvent(QMouseEvent *e);
	virtual void mousePressEvent(QMouseEvent *e);
	virtual void mouseReleaseEvent(QMouseEvent *e);
	virtual void paintEvent(QPaintEvent *e);
	virtual void closeEvent(QCloseEvent*e);
	virtual void wheelEvent(QWheelEvent *e);

	virtual void dragEnterEvent(QDragEnterEvent *event);
	virtual void dropEvent(QDropEvent *event);

public:
	static KJLoader* kjofol;

private:
	// ==== docking stuff ====
	KWinModule *mWin;
	WId mDockToWin;
	int mDockPositionX, mDockPositionY, mDockPosition;
	QRect mDockWindowRect;
	// ==== end of docking stuff ====
	bool moving;
	QPoint mMousePoint;
	QPtrList<KJWidget> subwidgets;
	KJWidget *mClickedIn;
	KHelpMenu *mHelpMenu;
	KJFont *mText, *mNumbers, *mVolumeFont, *mPitchFont;
	QLabel *splashScreen;
	KJToolTip *mTooltips;
	QString mCurrentSkin;
	QString mCurrentDefaultSkin;
	QString mCurrentDockModeSkin;
	QString mCurrentWinshadeModeSkin;

	KJPrefs *mPrefs;
};

#endif // KJLOADER_H