-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 68 |
1 files changed, 33 insertions, 35 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index e184f6b..e489d2d 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -69,138 +69,136 @@ MainWindow :: MainWindow() | |||
69 | 69 | ||
70 | // Packages menu | 70 | // Packages menu |
71 | QPopupMenu *popup = new QPopupMenu( this ); | 71 | QPopupMenu *popup = new QPopupMenu( this ); |
72 | 72 | ||
73 | QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); | 73 | QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); |
74 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); | 74 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); |
75 | connect( a, SIGNAL( activated() ), networkPkgWindow, SLOT( updateServer() ) ); | 75 | connect( a, SIGNAL( activated() ), networkPkgWindow, SLOT( updateServer() ) ); |
76 | a->addTo( popup ); | 76 | a->addTo( popup ); |
77 | a->addTo( bar ); | 77 | a->addTo( bar ); |
78 | 78 | ||
79 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); | 79 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); |
80 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); | 80 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); |
81 | connect( actionUpgrade, SIGNAL( activated() ), networkPkgWindow, SLOT( upgradePackages() ) ); | 81 | connect( actionUpgrade, SIGNAL( activated() ), networkPkgWindow, SLOT( upgradePackages() ) ); |
82 | actionUpgrade->addTo( popup ); | 82 | actionUpgrade->addTo( popup ); |
83 | actionUpgrade->addTo( bar ); | 83 | actionUpgrade->addTo( bar ); |
84 | 84 | ||
85 | iconDownload = Resource::loadPixmap( "aqpkg/download" ); | 85 | iconDownload = Resource::loadPixmap( "aqpkg/download" ); |
86 | iconRemove = Resource::loadPixmap( "aqpkg/remove" ); | 86 | iconRemove = Resource::loadPixmap( "aqpkg/remove" ); |
87 | actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); | 87 | actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); |
88 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); | 88 | actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); |
89 | connect( actionDownload, SIGNAL( activated() ), networkPkgWindow, SLOT( downloadPackage() ) ); | 89 | connect( actionDownload, SIGNAL( activated() ), networkPkgWindow, SLOT( downloadPackage() ) ); |
90 | actionDownload->addTo( popup ); | 90 | actionDownload->addTo( popup ); |
91 | actionDownload->addTo( bar ); | 91 | actionDownload->addTo( bar ); |
92 | 92 | ||
93 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); | 93 | a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); |
94 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); | 94 | a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); |
95 | connect( a, SIGNAL( activated() ), networkPkgWindow, SLOT( applyChanges() ) ); | 95 | connect( a, SIGNAL( activated() ), networkPkgWindow, SLOT( applyChanges() ) ); |
96 | a->addTo( popup ); | 96 | a->addTo( popup ); |
97 | a->addTo( bar ); | 97 | a->addTo( bar ); |
98 | 98 | ||
99 | mb->insertItem( tr( "Packages" ), popup ); | 99 | mb->insertItem( tr( "Packages" ), popup ); |
100 | 100 | ||
101 | // Search menu | ||
102 | popup = new QPopupMenu( this ); | ||
103 | |||
104 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | ||
105 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); | ||
106 | connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); | ||
107 | a->addTo( popup ); | ||
108 | |||
109 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); | ||
110 | actionFindNext->setEnabled( FALSE ); | ||
111 | actionFindNext->setWhatsThis( tr( "Click here to search for the package name containing the text you are searching for." ) ); | ||
112 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); | ||
113 | actionFindNext->addTo( popup ); | ||
114 | actionFindNext->addTo( findBar ); | ||
115 | |||
116 | // Show 'quick jump' keypad? | ||
117 | |||
118 | popup->insertSeparator(); | ||
119 | |||
120 | actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); | ||
121 | actionFilter->setToggleAction( TRUE ); | ||
122 | actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); | ||
123 | connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); | ||
124 | actionFilter->addTo( popup ); | ||
125 | |||
126 | a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); | ||
127 | a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); | ||
128 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); | ||
129 | a->addTo( popup ); | ||
130 | |||
131 | mb->insertItem( tr( "Search" ), popup ); | ||
132 | |||
133 | |||
134 | // View menu | 101 | // View menu |
135 | popup = new QPopupMenu( this ); | 102 | popup = new QPopupMenu( this ); |
136 | 103 | ||
137 | actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); | 104 | actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); |
138 | actionUninstalled->setToggleAction( TRUE ); | 105 | actionUninstalled->setToggleAction( TRUE ); |
139 | actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); | 106 | actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); |
140 | connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); | 107 | connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); |
141 | actionUninstalled->addTo( popup ); | 108 | actionUninstalled->addTo( popup ); |
142 | 109 | ||
143 | actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); | 110 | actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); |
144 | actionInstalled->setToggleAction( TRUE ); | 111 | actionInstalled->setToggleAction( TRUE ); |
145 | actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); | 112 | actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); |
146 | connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); | 113 | connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); |
147 | actionInstalled->addTo( popup ); | 114 | actionInstalled->addTo( popup ); |
148 | 115 | ||
149 | actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); | 116 | actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); |
150 | actionUpdated->setToggleAction( TRUE ); | 117 | actionUpdated->setToggleAction( TRUE ); |
151 | actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); | 118 | actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); |
152 | connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); | 119 | connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); |
153 | actionUpdated->addTo( popup ); | 120 | actionUpdated->addTo( popup ); |
154 | 121 | ||
155 | popup->insertSeparator(); | 122 | popup->insertSeparator(); |
156 | 123 | ||
124 | actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); | ||
125 | actionFilter->setToggleAction( TRUE ); | ||
126 | actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); | ||
127 | connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); | ||
128 | actionFilter->addTo( popup ); | ||
129 | |||
130 | a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); | ||
131 | a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); | ||
132 | connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); | ||
133 | a->addTo( popup ); | ||
134 | |||
135 | popup->insertSeparator(); | ||
136 | |||
137 | a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | ||
138 | a->setWhatsThis( tr( "Click here to search for text in package names." ) ); | ||
139 | connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); | ||
140 | a->addTo( popup ); | ||
141 | |||
142 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); | ||
143 | actionFindNext->setEnabled( FALSE ); | ||
144 | actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); | ||
145 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); | ||
146 | actionFindNext->addTo( popup ); | ||
147 | actionFindNext->addTo( findBar ); | ||
148 | |||
149 | mb->insertItem( tr( "View" ), popup ); | ||
150 | |||
151 | |||
152 | // Options menu | ||
153 | popup = new QPopupMenu( this ); | ||
154 | |||
157 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 ); | 155 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 ); |
158 | a->setWhatsThis( tr( "Click here to configure this application." ) ); | 156 | a->setWhatsThis( tr( "Click here to configure this application." ) ); |
159 | connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); | 157 | connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); |
160 | a->addTo( popup ); | 158 | a->addTo( popup ); |
161 | 159 | ||
162 | popup->insertSeparator(); | 160 | popup->insertSeparator(); |
163 | 161 | ||
164 | a = new QAction( tr( "Help" ), Resource::loadPixmap( "help_icon" ), QString::null, 0, this, 0 ); | 162 | a = new QAction( tr( "Help" ), Resource::loadPixmap( "help_icon" ), QString::null, 0, this, 0 ); |
165 | a->setWhatsThis( tr( "Click here for help." ) ); | 163 | a->setWhatsThis( tr( "Click here for help." ) ); |
166 | connect( a, SIGNAL( activated() ), this, SLOT( displayHelp() ) ); | 164 | connect( a, SIGNAL( activated() ), this, SLOT( displayHelp() ) ); |
167 | a->addTo( popup ); | 165 | a->addTo( popup ); |
168 | 166 | ||
169 | a = new QAction( tr( "About" ), Resource::loadPixmap( "UtilsIcon" ), QString::null, 0, this, 0 ); | 167 | a = new QAction( tr( "About" ), Resource::loadPixmap( "UtilsIcon" ), QString::null, 0, this, 0 ); |
170 | a->setWhatsThis( tr( "Click here for software version information." ) ); | 168 | a->setWhatsThis( tr( "Click here for software version information." ) ); |
171 | connect( a, SIGNAL( activated() ), this, SLOT( displayAbout() ) ); | 169 | connect( a, SIGNAL( activated() ), this, SLOT( displayAbout() ) ); |
172 | a->addTo( popup ); | 170 | a->addTo( popup ); |
173 | 171 | ||
174 | mb->insertItem( tr( "View" ), popup ); | 172 | mb->insertItem( tr( "Options" ), popup ); |
175 | 173 | ||
176 | // Finish find toolbar creation | 174 | // Finish find toolbar creation |
177 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 175 | a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
178 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); | 176 | a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); |
179 | connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); | 177 | connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); |
180 | a->addTo( findBar ); | 178 | a->addTo( findBar ); |
181 | findBar->hide(); | 179 | findBar->hide(); |
182 | 180 | ||
183 | 181 | ||
184 | // Create widget stack and add UI widgets | 182 | // Create widget stack and add UI widgets |
185 | stack = new QWidgetStack( this ); | 183 | stack = new QWidgetStack( this ); |
186 | stack->addWidget( progressWindow, 2 ); | 184 | stack->addWidget( progressWindow, 2 ); |
187 | stack->addWidget( networkPkgWindow, 1 ); | 185 | stack->addWidget( networkPkgWindow, 1 ); |
188 | setCentralWidget( stack ); | 186 | setCentralWidget( stack ); |
189 | stack->raiseWidget( progressWindow ); | 187 | stack->raiseWidget( progressWindow ); |
190 | 188 | ||
191 | // Delayed call to finish initialization | 189 | // Delayed call to finish initialization |
192 | QTimer::singleShot( 100, this, SLOT( init() ) ); | 190 | QTimer::singleShot( 100, this, SLOT( init() ) ); |
193 | } | 191 | } |
194 | 192 | ||
195 | MainWindow :: ~MainWindow() | 193 | MainWindow :: ~MainWindow() |
196 | { | 194 | { |
197 | delete mgr; | 195 | delete mgr; |
198 | } | 196 | } |
199 | 197 | ||
200 | void MainWindow :: init() | 198 | void MainWindow :: init() |
201 | { | 199 | { |
202 | stack->raiseWidget( progressWindow ); | 200 | stack->raiseWidget( progressWindow ); |
203 | 201 | ||
204 | mgr = new DataManager(); | 202 | mgr = new DataManager(); |
205 | connect( mgr, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); | 203 | connect( mgr, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); |
206 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), | 204 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), |