summaryrefslogtreecommitdiffstats
path: root/ksplashml/wndmain.h
blob: c1fa4ae4550fde8885b6e11f9ea124e31b790673 (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
/***************************************************************************
 *   Copyright Brian Ledbetter 2001-2003 <[email protected]>             *
 *   Copyright Ravikiran Rajagopal 2003 <[email protected]>                     *
 *                                                                         *
 *   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. (The original KSplash/ML   *
 *   codebase (upto version 0.95.3) is BSD-licensed.)                      *
 *                                                                         *
 ***************************************************************************/

#ifndef __WNDMAIN_H__
#define __WNDMAIN_H__

#include <kapplication.h>

#include <tqptrlist.h>
#include <tqstring.h>
#include <tqobject.h>

#include "ksplashiface.h"

// MAKE SURE THAT THIS MATCHES WHAT'S IN ../kcmksplash/kcmksplash.h!!!
#define N_ACTIONITEMS 8

// Action: This represents an "action entry" to any object which is interested
// in knowing this.
typedef struct
{
  TQString ItemPixmap;
  TQString ItemText;
} Action;

class WndStatus;
class ObjKsTheme;
class ThemeEngine;
class KConfig;

class KSplash: public TQWidget, virtual public KSplashIface
{
  Q_OBJECT

public:
  KSplash(const char *name = "ksplash");
  ~KSplash();

  TQPtrList<Action> actionList();

  // DCOP interface
  ASYNC upAndRunning( TQString );
  ASYNC setMaxProgress(int);
  ASYNC setProgress(int);
  ASYNC setStartupItemCount( int count );
  ASYNC programStarted( TQString programIcon, TQString programName, TQString description );
  ASYNC startupComplete();
  ASYNC close();
  ASYNC hide();
  ASYNC show();

signals:
  void stepsChanged(int);
  void progressChanged(int);
  void actionListChanged();

protected:
  bool eventFilter( TQObject *o, TQEvent *e );

public slots:
  void slotUpdateSteps( int );
  void slotUpdateProgress( int );

private slots:
  void initDcop();
  void prepareIconList();
  void prepareSplashScreen();
  void slotExec();
  void nextIcon();
  void slotInsertAction( const TQString&, const TQString& );
  void slotReadProperties( KConfig * );

  void slotSetText( const TQString& );
  void slotSetPixmap( const TQString& );

  void loadTheme( const TQString& );

private:
  ThemeEngine *_loadThemeEngine( const TQString& pluginName, const TQString& theme );
  void updateState( unsigned int state );

protected:
  unsigned int mState;
  unsigned int mMaxProgress;
  unsigned int mStep; // ??
  TQTimer* close_timer;

  bool mSessMgrCalled;
  bool mTimeToGo;

  TQString mTheme;
  ObjKsTheme *mKsTheme;

  ThemeEngine *mThemeEngine;
  TQPtrList<Action> mActionList;
  Action *mCurrentAction, *mPreviousAction;

  TQString mThemeLibName;
};

#endif