OSDN Git Service

refactoring.
[kita/kita.git] / kita / src / mainwindow.h
1 /***************************************************************************
2 *   Copyright (C) 2004 by Kita Developers                                 *
3 *   ikemo@users.sourceforge.jp                                            *
4 *                                                                         *
5 *   This program is free software; you can redistribute it and/or modify  *
6 *   it under the terms of the GNU General Public License as published by  *
7 *   the Free Software Foundation; either version 2 of the License, or     *
8 *   (at your option) any later version.                                   *
9 ***************************************************************************/
10
11 #ifndef _KITA_H_
12 #define _KITA_H_
13
14 #ifdef HAVE_CONFIG_H
15 #include <config.h>
16 #endif
17
18 #include <kapplication.h>
19 #include <kparts/dockmainwindow.h>
20
21 class KPrinter;
22 class KToggleAction;
23 class KURL;
24 class KLineEdit;
25
26 class KitaBBSDock;
27 class KitaBBSTabWidget;
28 class KitaBoardTabWidget;
29 class KitaBoardDock;
30 class KitaThreadDock;
31 class KitaThreadTabWidget;
32 class KitaImgDock;
33 class KitaImgTabWidget;
34 class KitaWriteDock;
35 class KitaWriteTabWidget;
36
37 namespace KParts
38 {
39     class URLArgs;
40     class Part;
41 }
42
43 /**
44  * This class serves as the main window for Kita.  It handles the
45  * menus, toolbars, and status bars.
46  *
47  * @short Main window class
48  * @author $AUTHOR <$EMAIL>
49  * @version $APP_VERSION
50  */
51
52 class KitaMainWindow : public KParts::DockMainWindow
53 {
54     Q_OBJECT
55 public:
56     /**
57      * Default Constructor
58      */
59     KitaMainWindow();
60
61     /**
62      * Default Destructor
63      */
64     virtual ~KitaMainWindow();
65
66     /**
67      * Use this method to load whatever file/URL you have
68      */
69     void load( const KURL& url );
70
71 protected:
72     /**
73      * Overridden virtuals for Qt drag 'n drop (XDND)
74      */
75     virtual void dragEnterEvent( QDragEnterEvent* event );
76     virtual void dropEvent( QDropEvent* event );
77
78     /**
79      * This function is called when it is time for the app to save its
80      * properties for session management purposes.
81      */
82     void saveProperties( KConfig* );
83
84     /**
85      * This function is called when this app is restored.  The KConfig
86      * object points to the session management config file that was saved
87      * with @ref saveProperties
88      */
89     void readProperties( KConfig* );
90
91 private slots:
92     void favoritesEdit();
93     void optionsShowToolbar();
94     void optionsShowStatusbar();
95     void optionsConfigureKeys();
96     void optionsConfigureToolbars();
97     void optionsPreferences();
98     void newToolbarConfig();
99     void windowToggleView();
100     void settingsMenuAboutToShow();
101     void slotEditCopy();
102     void resetWindowsCust();
103     void resetWindowsDef1();
104     void resetWindowsDef2();
105     void resetWindowsDef3();
106     void closeSubjectView();
107     void slotCheckBoardToggleAction( bool check );
108     void slotCheckSubjectToggleAction( bool check );
109     void slotCheckNaviToggleAction( bool check );
110     void slotCheckImgToggleAction( bool check );
111     void slotCheckWriteToggleAction( bool check );
112     void login();
113
114     void slotSetMainStatusbar( const QString& statusStr );
115     void slotOpenURLRequest( const KURL& url, const KParts::URLArgs& );
116     void slotOpenURLRequestExt( const KURL& url, const KParts::URLArgs& args,
117                                 QString mimetype = QString::null,
118                                 int usr1 = 0,
119                                 const KURL& usrUrl1 = KURL() );
120
121     void setFont( const QFont& font );
122     void slotURLLine();
123     void setUrl( const KURL& url );
124     void bookmark( const QString& datURL, bool on );
125     void slotSetMainCaption( const QString& captionStr );
126
127 private:
128     KLineEdit* m_urlLine;
129
130     KPrinter *m_printer;
131     KToggleAction *m_toolbarAction;
132     KToggleAction *m_statusbarAction;
133     KToggleAction *m_boardListAction;
134     KToggleAction* m_subjectListAction;
135     KToggleAction* m_showImgViewAction;
136     KToggleAction* m_showNaviAction;
137     KToggleAction* m_showWriteDockAction;
138     KAction* m_toggleViewAction;
139
140     KDockWidget* m_dummyDock; /* dummy MainDockWidget */
141     KitaBBSDock* m_bbsDock;
142     KitaBoardDock* m_boardDock;
143     KitaThreadDock* m_threadDock;
144     KitaThreadDock* m_naviDock;
145     KitaImgDock* m_imageDock;
146     KitaWriteDock* m_writeDock;
147
148     KitaThreadTabWidget* m_threadTab;
149     KitaBBSTabWidget* m_bbsTab;
150     KitaBoardTabWidget* m_boardTab;
151     KitaImgTabWidget* m_imgTab;
152     KitaThreadTabWidget* m_naviTab;
153     KitaWriteTabWidget* m_writeTab;
154
155     void setupAccel();
156     void setupActions();
157     void setupView();
158     void loadCache();
159     void saveCache();
160     void loadFavorites();
161     void saveFavorites();
162     void loadFavoriteBoards();
163     void saveFavoriteBoards();
164     void loadCompletion();
165     void saveCompletion();
166     void loadStyleSheet();
167     void saveStyleSheet();
168     void loadAsciiArt();
169     void saveAsciiArt();
170     void loadAboneIDList();
171     void saveAboneIDList();
172     void loadAboneNameList();
173     void saveAboneNameList();
174     void loadAboneWordList();
175     void saveAboneWordList();
176     void resetWindows( int pattern );
177
178 signals:
179     void favoritesUpdated();
180     void switchSubjectView();
181 };
182
183 #endif // _KITA_H_