summaryrefslogtreecommitdiffstats
path: root/ksplashml/kcmksplash/installer.h
blob: 43e37d0fce8030e163329d08e346b5cd9a13126e (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
/***************************************************************************
 *   Copyright Ravikiran Rajagopal 2003                                    *
 *   ravi@ee.eng.ohio-state.edu                                            *
 *   Copyright (c) 1998 Stefan Taferner <taferner@kde.org>                 *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License (version 2) as   *
 *   published by the Free Software Foundation.                            *
 *                                                                         *
 ***************************************************************************/
#ifndef SPLASHINSTALLER_H
#define SPLASHINSTALLER_H

#include <qmap.h>
#include <qpoint.h>

#include <klistbox.h>
#include <kurl.h>

class QLabel;
class QTextEdit;
class QPushButton;
class ThemeListBox;

class SplashInstaller : public QWidget
{
  Q_OBJECT
public:
  SplashInstaller(QWidget *parent=0, const char *aName=0, bool aInit=FALSE);
  ~SplashInstaller();

  virtual void load();
  virtual void load( bool useDefaults );
  virtual void save();
  virtual void defaults();

signals:
  void changed( bool state );

protected slots:
  virtual void slotAdd();
  virtual void slotRemove();
  virtual void slotTest();
  virtual void slotSetTheme(int);
  void slotFilesDropped(const KURL::List &urls);

protected:
  /** Scan Themes directory for available theme packages */
  virtual void readThemesList();
  /** add a theme to the list, returns the list index */
  int addTheme(const QString &path, const QString &name);
  void addNewTheme(const KURL &srcURL);
  int findTheme( const QString &theme );

private:
  bool mGui;
  ThemeListBox *mThemesList;
  QPushButton *mBtnAdd, *mBtnRemove, *mBtnTest;
  QTextEdit *mText;
  QLabel *mPreview;
};

class ThemeListBox: public KListBox
{
  Q_OBJECT
public:
  ThemeListBox(QWidget *parent);
  QMap<QString, QString> text2path;

signals:
  void filesDropped(const KURL::List &urls);

protected:
  void dragEnterEvent(QDragEnterEvent* event);
  void dropEvent(QDropEvent* event);
  void mouseMoveEvent(QMouseEvent *e);

protected slots:
  void slotMouseButtonPressed(int button, QListBoxItem *item, const QPoint &p);

private:
  QString mDragFile;
  QPoint mOldPos;

};

#endif