author | zecke <zecke> | 2004-04-19 07:12:16 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-19 07:12:16 (UTC) |
commit | 0b59a16b5a5a179c46ddb3f8c585dbca59b2826e (patch) (unidiff) | |
tree | 3780a3ae09806e781582aefb23ad3040bc15d816 | |
parent | 359b681f32d5c3ac2ea3bfd39a3637d211338bf7 (diff) | |
download | opie-0b59a16b5a5a179c46ddb3f8c585dbca59b2826e.zip opie-0b59a16b5a5a179c46ddb3f8c585dbca59b2826e.tar.gz opie-0b59a16b5a5a179c46ddb3f8c585dbca59b2826e.tar.bz2 |
Small interface update. If we add doctypes disable the viewport() for
updates
-rw-r--r-- | core/launcher/documentlist.cpp | 8 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 10 | ||||
-rw-r--r-- | core/launcher/launcher.h | 2 | ||||
-rw-r--r-- | core/launcher/serverinterface.h | 2 |
4 files changed, 20 insertions, 2 deletions
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp index 59dd721..19ceb0f 100644 --- a/core/launcher/documentlist.cpp +++ b/core/launcher/documentlist.cpp | |||
@@ -47,49 +47,49 @@ using namespace Opie::Core; | |||
47 | #include <qcopchannel_qws.h> | 47 | #include <qcopchannel_qws.h> |
48 | #include <qlistview.h> | 48 | #include <qlistview.h> |
49 | #include <qlist.h> | 49 | #include <qlist.h> |
50 | #include <qpixmap.h> | 50 | #include <qpixmap.h> |
51 | 51 | ||
52 | 52 | ||
53 | AppLnkSet *DocumentList::appLnkSet = 0; | 53 | AppLnkSet *DocumentList::appLnkSet = 0; |
54 | 54 | ||
55 | static const int MAX_SEARCH_DEPTH = 10; | 55 | static const int MAX_SEARCH_DEPTH = 10; |
56 | 56 | ||
57 | 57 | ||
58 | class DocumentListPrivate : public QObject { | 58 | class DocumentListPrivate : public QObject { |
59 | Q_OBJECT | 59 | Q_OBJECT |
60 | public: | 60 | public: |
61 | DocumentListPrivate( ServerInterface *gui ); | 61 | DocumentListPrivate( ServerInterface *gui ); |
62 | ~DocumentListPrivate(); | 62 | ~DocumentListPrivate(); |
63 | 63 | ||
64 | void initialize(); | 64 | void initialize(); |
65 | 65 | ||
66 | const QString nextFile(); | 66 | const QString nextFile(); |
67 | const DocLnk *iterate(); | 67 | const DocLnk *iterate(); |
68 | bool store( DocLnk* dl ); | 68 | bool store( DocLnk* dl ); |
69 | void estimatedPercentScanned(); | 69 | void estimatedPercentScanned(); |
70 | void appendDocpath(FileSystem*); | 70 | void appendDocpath(FileSystem*); |
71 | 71 | ||
72 | 72 | ||
73 | DocLnkSet dls; | 73 | DocLnkSet dls; |
74 | QDict<void> reference; | 74 | QDict<void> reference; |
75 | QDictIterator<void> *dit; | 75 | QDictIterator<void> *dit; |
76 | enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state; | 76 | enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state; |
77 | 77 | ||
78 | QStringList docPaths; | 78 | QStringList docPaths; |
79 | unsigned int docPathsSearched; | 79 | unsigned int docPathsSearched; |
80 | 80 | ||
81 | int searchDepth; | 81 | int searchDepth; |
82 | QDir *listDirs[MAX_SEARCH_DEPTH]; | 82 | QDir *listDirs[MAX_SEARCH_DEPTH]; |
83 | const QFileInfoList *lists[MAX_SEARCH_DEPTH]; | 83 | const QFileInfoList *lists[MAX_SEARCH_DEPTH]; |
84 | unsigned int listPositions[MAX_SEARCH_DEPTH]; | 84 | unsigned int listPositions[MAX_SEARCH_DEPTH]; |
85 | 85 | ||
86 | StorageInfo *storage; | 86 | StorageInfo *storage; |
87 | 87 | ||
88 | int tid; | 88 | int tid; |
89 | 89 | ||
90 | ServerInterface *serverGui; | 90 | ServerInterface *serverGui; |
91 | 91 | ||
92 | bool needToSendAllDocLinks; | 92 | bool needToSendAllDocLinks; |
93 | bool sendAppLnks; | 93 | bool sendAppLnks; |
94 | bool sendDocLnks; | 94 | bool sendDocLnks; |
95 | bool scanDocs; | 95 | bool scanDocs; |
@@ -169,62 +169,66 @@ void DocumentList::resend() | |||
169 | 169 | ||
170 | 170 | ||
171 | void DocumentList::resendWorker() | 171 | void DocumentList::resendWorker() |
172 | { | 172 | { |
173 | const QList<DocLnk> &list = d->dls.children(); | 173 | const QList<DocLnk> &list = d->dls.children(); |
174 | for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) | 174 | for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) |
175 | add( *(*it) ); | 175 | add( *(*it) ); |
176 | resume(); | 176 | resume(); |
177 | } | 177 | } |
178 | */ | 178 | */ |
179 | 179 | ||
180 | void DocumentList::rescan() | 180 | void DocumentList::rescan() |
181 | { | 181 | { |
182 | //odebug << "rescan" << oendl; | 182 | //odebug << "rescan" << oendl; |
183 | pause(); | 183 | pause(); |
184 | d->initialize(); | 184 | d->initialize(); |
185 | resume(); | 185 | resume(); |
186 | } | 186 | } |
187 | 187 | ||
188 | 188 | ||
189 | void DocumentList::timerEvent( QTimerEvent *te ) | 189 | void DocumentList::timerEvent( QTimerEvent *te ) |
190 | { | 190 | { |
191 | if ( te->timerId() == d->tid ) { | 191 | if ( te->timerId() == d->tid ) { |
192 | // Do 3 at a time | 192 | // Do 3 at a time |
193 | if ( d->serverGui ) | ||
194 | d->serverGui->aboutToAddBegin(); | ||
193 | for (int i = 0; i < 3; i++ ) { | 195 | for (int i = 0; i < 3; i++ ) { |
194 | const DocLnk *lnk = d->iterate(); | 196 | const DocLnk *lnk = d->iterate(); |
195 | if ( lnk ) { | 197 | if ( lnk ) { |
196 | add( *lnk ); | 198 | add( *lnk ); |
197 | } else { | 199 | } else { |
198 | // stop when done | 200 | // stop when done |
199 | pause(); | 201 | pause(); |
200 | if ( d->serverGui ) | 202 | if ( d->serverGui ) |
201 | d->serverGui->documentScanningProgress( 100 ); | 203 | d->serverGui->documentScanningProgress( 100 ); |
202 | if ( d->needToSendAllDocLinks ) | 204 | if ( d->needToSendAllDocLinks ) |
203 | sendAllDocLinks(); | 205 | sendAllDocLinks(); |
204 | break; | 206 | break; |
205 | } | 207 | } |
206 | } | 208 | } |
209 | if ( d->serverGui ) | ||
210 | d->serverGui->aboutToAddEnd(); | ||
207 | } | 211 | } |
208 | } | 212 | } |
209 | 213 | ||
210 | 214 | ||
211 | void DocumentList::reloadAppLnks() | 215 | void DocumentList::reloadAppLnks() |
212 | { | 216 | { |
213 | if ( d->sendAppLnks && d->serverGui ) { | 217 | if ( d->sendAppLnks && d->serverGui ) { |
214 | d->serverGui->applicationScanningProgress( 0 ); | 218 | d->serverGui->applicationScanningProgress( 0 ); |
215 | d->serverGui->allApplicationsRemoved(); | 219 | d->serverGui->allApplicationsRemoved(); |
216 | } | 220 | } |
217 | 221 | ||
218 | delete appLnkSet; | 222 | delete appLnkSet; |
219 | appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); | 223 | appLnkSet = new AppLnkSet( MimeType::appsFolderName() ); |
220 | 224 | ||
221 | if ( d->sendAppLnks && d->serverGui ) { | 225 | if ( d->sendAppLnks && d->serverGui ) { |
222 | static QStringList prevTypeList; | 226 | static QStringList prevTypeList; |
223 | QStringList types = appLnkSet->types(); | 227 | QStringList types = appLnkSet->types(); |
224 | for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { | 228 | for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) { |
225 | if ( !(*ittypes).isEmpty() ) { | 229 | if ( !(*ittypes).isEmpty() ) { |
226 | if ( !prevTypeList.contains(*ittypes) ) { | 230 | if ( !prevTypeList.contains(*ittypes) ) { |
227 | QString name = appLnkSet->typeName(*ittypes); | 231 | QString name = appLnkSet->typeName(*ittypes); |
228 | QPixmap pm = appLnkSet->typePixmap(*ittypes); | 232 | QPixmap pm = appLnkSet->typePixmap(*ittypes); |
229 | QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes); | 233 | QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes); |
230 | 234 | ||
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index bf2287d..6afbcd8 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -675,48 +675,58 @@ void Launcher::applicationAdded( const QString& type, const AppLnk& app ) | |||
675 | MimeType::registerApp( app ); | 675 | MimeType::registerApp( app ); |
676 | } | 676 | } |
677 | 677 | ||
678 | void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) | 678 | void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) |
679 | { | 679 | { |
680 | LauncherView *view = tabs->view( type ); | 680 | LauncherView *view = tabs->view( type ); |
681 | if ( view ) | 681 | if ( view ) |
682 | view->removeLink( app.linkFile() ); | 682 | view->removeLink( app.linkFile() ); |
683 | else | 683 | else |
684 | owarn << "removeAppLnk: No view for " << type << "!" << oendl; | 684 | owarn << "removeAppLnk: No view for " << type << "!" << oendl; |
685 | } | 685 | } |
686 | 686 | ||
687 | void Launcher::allApplicationsRemoved() | 687 | void Launcher::allApplicationsRemoved() |
688 | { | 688 | { |
689 | MimeType::clear(); | 689 | MimeType::clear(); |
690 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) | 690 | for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) |
691 | tabs->view( (*it) )->removeAllItems(); | 691 | tabs->view( (*it) )->removeAllItems(); |
692 | } | 692 | } |
693 | 693 | ||
694 | void Launcher::documentAdded( const DocLnk& doc ) | 694 | void Launcher::documentAdded( const DocLnk& doc ) |
695 | { | 695 | { |
696 | tabs->docView()->addItem( new DocLnk( doc ), FALSE ); | 696 | tabs->docView()->addItem( new DocLnk( doc ), FALSE ); |
697 | } | 697 | } |
698 | 698 | ||
699 | void Launcher::aboutToAddBegin() | ||
700 | { | ||
701 | tabs->docView()->setUpdatesEnabled( false ); | ||
702 | } | ||
703 | |||
704 | void Launcher::aboutToAddEnd() | ||
705 | { | ||
706 | tabs->docView()->setUpdatesEnabled( true ); | ||
707 | } | ||
708 | |||
699 | void Launcher::showLoadingDocs() | 709 | void Launcher::showLoadingDocs() |
700 | { | 710 | { |
701 | tabs->docView()->hide(); | 711 | tabs->docView()->hide(); |
702 | } | 712 | } |
703 | 713 | ||
704 | void Launcher::showDocTab() | 714 | void Launcher::showDocTab() |
705 | { | 715 | { |
706 | if ( tabs->categoryBar->currentView() == tabs->docView() ) | 716 | if ( tabs->categoryBar->currentView() == tabs->docView() ) |
707 | tabs->docView()->show(); | 717 | tabs->docView()->show(); |
708 | } | 718 | } |
709 | 719 | ||
710 | void Launcher::documentRemoved( const DocLnk& doc ) | 720 | void Launcher::documentRemoved( const DocLnk& doc ) |
711 | { | 721 | { |
712 | tabs->docView()->removeLink( doc.linkFile() ); | 722 | tabs->docView()->removeLink( doc.linkFile() ); |
713 | } | 723 | } |
714 | 724 | ||
715 | void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) | 725 | void Launcher::documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) |
716 | { | 726 | { |
717 | documentRemoved( oldDoc ); | 727 | documentRemoved( oldDoc ); |
718 | documentAdded( newDoc ); | 728 | documentAdded( newDoc ); |
719 | } | 729 | } |
720 | 730 | ||
721 | void Launcher::allDocumentsRemoved() | 731 | void Launcher::allDocumentsRemoved() |
722 | { | 732 | { |
diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h index 4f3ff8c..29bd7db 100644 --- a/core/launcher/launcher.h +++ b/core/launcher/launcher.h | |||
@@ -89,48 +89,50 @@ private: | |||
89 | QWidgetStack *stack; | 89 | QWidgetStack *stack; |
90 | LauncherView *docLoadingWidget; | 90 | LauncherView *docLoadingWidget; |
91 | QProgressBar *docLoadingWidgetProgress; | 91 | QProgressBar *docLoadingWidgetProgress; |
92 | bool docLoadingWidgetEnabled; | 92 | bool docLoadingWidgetEnabled; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | class Launcher : public QMainWindow, public ServerInterface | 95 | class Launcher : public QMainWindow, public ServerInterface |
96 | { | 96 | { |
97 | Q_OBJECT | 97 | Q_OBJECT |
98 | public: | 98 | public: |
99 | Launcher(); | 99 | Launcher(); |
100 | ~Launcher(); | 100 | ~Launcher(); |
101 | 101 | ||
102 | // implementing ServerInterface | 102 | // implementing ServerInterface |
103 | void createGUI(); | 103 | void createGUI(); |
104 | void destroyGUI(); | 104 | void destroyGUI(); |
105 | void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ); | 105 | void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ); |
106 | void typeRemoved( const QString& type ); | 106 | void typeRemoved( const QString& type ); |
107 | void applicationAdded( const QString& type, const AppLnk& doc ); | 107 | void applicationAdded( const QString& type, const AppLnk& doc ); |
108 | void applicationRemoved( const QString& type, const AppLnk& doc ); | 108 | void applicationRemoved( const QString& type, const AppLnk& doc ); |
109 | void allApplicationsRemoved(); | 109 | void allApplicationsRemoved(); |
110 | void applicationStateChanged( const QString& name, ApplicationState state ); | 110 | void applicationStateChanged( const QString& name, ApplicationState state ); |
111 | void documentAdded( const DocLnk& doc ); | 111 | void documentAdded( const DocLnk& doc ); |
112 | void documentRemoved( const DocLnk& doc ); | 112 | void documentRemoved( const DocLnk& doc ); |
113 | void aboutToAddBegin(); | ||
114 | void aboutToAddEnd(); | ||
113 | void allDocumentsRemoved(); | 115 | void allDocumentsRemoved(); |
114 | void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ); | 116 | void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ); |
115 | void storageChanged( const QList<FileSystem> & ); | 117 | void storageChanged( const QList<FileSystem> & ); |
116 | void applicationScanningProgress( int percent ); | 118 | void applicationScanningProgress( int percent ); |
117 | void documentScanningProgress( int percent ); | 119 | void documentScanningProgress( int percent ); |
118 | bool requiresApplications() const { return TRUE; } | 120 | bool requiresApplications() const { return TRUE; } |
119 | bool requiresDocuments() const; | 121 | bool requiresDocuments() const; |
120 | void showLoadingDocs(); | 122 | void showLoadingDocs(); |
121 | void showDocTab(); | 123 | void showDocTab(); |
122 | 124 | ||
123 | QStringList idList() const { return ids; } | 125 | QStringList idList() const { return ids; } |
124 | 126 | ||
125 | public slots: | 127 | public slots: |
126 | void viewSelected(const QString&); | 128 | void viewSelected(const QString&); |
127 | void showTab(const QString&); | 129 | void showTab(const QString&); |
128 | void select( const AppLnk * ); | 130 | void select( const AppLnk * ); |
129 | void properties( AppLnk * ); | 131 | void properties( AppLnk * ); |
130 | void makeVisible(); | 132 | void makeVisible(); |
131 | 133 | ||
132 | signals: | 134 | signals: |
133 | void executing( const AppLnk * ); | 135 | void executing( const AppLnk * ); |
134 | 136 | ||
135 | private slots: | 137 | private slots: |
136 | void systemMessage( const QCString &, const QByteArray &); | 138 | void systemMessage( const QCString &, const QByteArray &); |
diff --git a/core/launcher/serverinterface.h b/core/launcher/serverinterface.h index e57ea51..132766f 100644 --- a/core/launcher/serverinterface.h +++ b/core/launcher/serverinterface.h | |||
@@ -29,44 +29,46 @@ | |||
29 | 29 | ||
30 | 30 | ||
31 | class ServerInterface { | 31 | class ServerInterface { |
32 | public: | 32 | public: |
33 | virtual ~ServerInterface(); | 33 | virtual ~ServerInterface(); |
34 | 34 | ||
35 | virtual void createGUI() = 0; | 35 | virtual void createGUI() = 0; |
36 | virtual void destroyGUI() = 0; | 36 | virtual void destroyGUI() = 0; |
37 | 37 | ||
38 | // These notify of the application categories, like what is used in the current launcher tabs, | 38 | // These notify of the application categories, like what is used in the current launcher tabs, |
39 | // for example "Applications", "Games" etc. | 39 | // for example "Applications", "Games" etc. |
40 | virtual void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ) = 0; | 40 | virtual void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ) = 0; |
41 | virtual void typeRemoved( const QString& type ) = 0; | 41 | virtual void typeRemoved( const QString& type ) = 0; |
42 | 42 | ||
43 | // These functions notify when an application is added or removed and to which category it belongs | 43 | // These functions notify when an application is added or removed and to which category it belongs |
44 | virtual void applicationAdded( const QString& type, const AppLnk& doc ) = 0; | 44 | virtual void applicationAdded( const QString& type, const AppLnk& doc ) = 0; |
45 | virtual void applicationRemoved( const QString& type, const AppLnk& doc ) = 0; | 45 | virtual void applicationRemoved( const QString& type, const AppLnk& doc ) = 0; |
46 | virtual void allApplicationsRemoved() = 0; | 46 | virtual void allApplicationsRemoved() = 0; |
47 | // Useful for wait icons, or running application lists etc | 47 | // Useful for wait icons, or running application lists etc |
48 | enum ApplicationState { Launching, Running, Terminated }; | 48 | enum ApplicationState { Launching, Running, Terminated }; |
49 | virtual void applicationStateChanged( const QString& name, ApplicationState state ) = 0; | 49 | virtual void applicationStateChanged( const QString& name, ApplicationState state ) = 0; |
50 | static const AppLnkSet& appLnks(); | 50 | static const AppLnkSet& appLnks(); |
51 | 51 | ||
52 | // These functions notify of adding, removal and changes of document links used in the documents tab for example | 52 | // These functions notify of adding, removal and changes of document links used in the documents tab for example |
53 | virtual void aboutToAddBegin() {} | ||
54 | virtual void aboutToAddEnd() {} | ||
53 | virtual void documentAdded( const DocLnk& doc ) = 0; | 55 | virtual void documentAdded( const DocLnk& doc ) = 0; |
54 | virtual void documentRemoved( const DocLnk& doc ) = 0; | 56 | virtual void documentRemoved( const DocLnk& doc ) = 0; |
55 | virtual void allDocumentsRemoved() = 0; | 57 | virtual void allDocumentsRemoved() = 0; |
56 | virtual void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) = 0; | 58 | virtual void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) = 0; |
57 | 59 | ||
58 | virtual void storageChanged( const QList<FileSystem> & ) = 0; | 60 | virtual void storageChanged( const QList<FileSystem> & ) = 0; |
59 | 61 | ||
60 | virtual void applicationScanningProgress( int percent ) = 0; | 62 | virtual void applicationScanningProgress( int percent ) = 0; |
61 | virtual void documentScanningProgress( int percent ) = 0; | 63 | virtual void documentScanningProgress( int percent ) = 0; |
62 | 64 | ||
63 | // Tells the server if the GUI needs to be updated about documents or applnks | 65 | // Tells the server if the GUI needs to be updated about documents or applnks |
64 | virtual bool requiresApplications() const = 0; | 66 | virtual bool requiresApplications() const = 0; |
65 | virtual bool requiresDocuments() const = 0; | 67 | virtual bool requiresDocuments() const = 0; |
66 | 68 | ||
67 | enum DockArea { Top, Bottom, Left, Right }; | 69 | enum DockArea { Top, Bottom, Left, Right }; |
68 | static void dockWidget( QWidget *w, DockArea placement ); | 70 | static void dockWidget( QWidget *w, DockArea placement ); |
69 | }; | 71 | }; |
70 | 72 | ||
71 | 73 | ||
72 | #endif // SERVER_INTERFACE_H | 74 | #endif // SERVER_INTERFACE_H |