1 //===========================================
2 //  Lumina-DE source code
3 //  Copyright (c) 2014, Ken Moore
4 //  Available under the 3-clause BSD license
5 //  See the LICENSE file for full details
6 //===========================================
7 #include "LPlugins.h"
8 
9 #include <LUtils.h>
10 
LPlugins()11 LPlugins::LPlugins(){
12   LoadPanelPlugins();
13   LoadDesktopPlugins();
14   LoadMenuPlugins();
15   LoadColorItems();
16 }
17 
~LPlugins()18 LPlugins::~LPlugins(){
19 }
20 
21 //Plugin lists
panelPlugins()22 QStringList LPlugins::panelPlugins(){
23   QStringList pan = PANEL.keys();
24     pan.sort();
25   return pan;
26 }
desktopPlugins()27 QStringList LPlugins::desktopPlugins(){
28   QStringList desk = DESKTOP.keys();
29 	desk.sort();
30   return desk;
31 }
menuPlugins()32 QStringList LPlugins::menuPlugins(){
33     QStringList men = MENU.keys();
34 	men.sort();
35   return men;
36 }
colorItems()37 QStringList LPlugins::colorItems(){
38   return COLORS.keys();
39 }
40 //Information on individual plugins
panelPluginInfo(QString plug)41 LPI LPlugins::panelPluginInfo(QString plug){
42   if(PANEL.contains(plug)){ return PANEL[plug]; }
43   else{ return LPI(); }
44 }
desktopPluginInfo(QString plug)45 LPI LPlugins::desktopPluginInfo(QString plug){
46   if(DESKTOP.contains(plug)){ return DESKTOP[plug]; }
47   else{ return LPI(); }
48 }
menuPluginInfo(QString plug)49 LPI LPlugins::menuPluginInfo(QString plug){
50   if(MENU.contains(plug)){ return MENU[plug]; }
51   else{ return LPI(); }
52 }
colorInfo(QString item)53 LPI LPlugins::colorInfo(QString item){
54   if(COLORS.contains(item)){ return COLORS[item]; }
55   else{ return LPI(); }
56 }
57 
58 //===================
59 //             PLUGINS
60 //===================
61 //   PANEL PLUGINS
LoadPanelPlugins()62 void LPlugins::LoadPanelPlugins(){
63   PANEL.clear();
64   //User Button
65   LPI info;
66     info.name = QObject::tr("User Menu");
67     info.description = QObject::tr("Start menu alternative focusing on the user's files, directories, and favorites.");
68     info.ID = "userbutton";
69     info.icon = "user-identity";
70   PANEL.insert(info.ID, info);
71    //Application Menu
72   info = LPI(); //clear it
73     info.name = QObject::tr("Application Menu");
74     info.description = QObject::tr("Start menu alternative which focuses on launching applications.");
75     info.ID = "appmenu";
76     info.icon = "format-list-unordered";
77   PANEL.insert(info.ID, info);
78   //Desktop Bar
79   info = LPI(); //clear it
80     info.name = QObject::tr("Desktop Bar");
81     info.description = QObject::tr("This provides shortcuts to everything in the desktop folder - allowing easy access to all your favorite files/applications.");
82     info.ID = "desktopbar";
83     info.icon = "user-desktop";
84   PANEL.insert(info.ID, info);
85   //Spacer
86   info = LPI(); //clear it
87     info.name = QObject::tr("Spacer");
88     info.description = QObject::tr("Invisible spacer to separate plugins.");
89     info.ID = "spacer";
90     info.icon = "transform-move";
91   PANEL.insert(info.ID, info);
92   //Line
93   info = LPI(); //clear it
94     info.name = QObject::tr("Line");
95     info.description = QObject::tr("Simple line to provide visual separation between items.");
96     info.ID = "line";
97     info.icon = "insert-horizontal-rule";
98   PANEL.insert(info.ID, info);
99   //Desktop Switcher
100   info = LPI(); //clear it
101     info.name = QObject::tr("Workspace Switcher");
102     info.description = QObject::tr("Controls for switching between the various virtual desktops.");
103     info.ID = "desktopswitcher";
104     info.icon = "format-view-carousel";
105   PANEL.insert(info.ID, info);
106   //Battery
107   info = LPI(); //clear it
108     info.name = QObject::tr("Battery Monitor");
109     info.description = QObject::tr("Keep track of your battery status.");
110     info.ID = "battery";
111     info.icon = "battery-charging";
112   PANEL.insert(info.ID, info);
113   //Clock
114   info = LPI(); //clear it
115     info.name = QObject::tr("Time/Date");
116     info.description = QObject::tr("View the current time and date.");
117     info.ID = "clock";
118     info.icon = "preferences-system-time";
119   PANEL.insert(info.ID, info);
120   //System Dachboard plugin
121   info = LPI(); //clear it
122     info.name = QObject::tr("System Dashboard");
123     info.description = QObject::tr("View or change system settings (audio volume, screen brightness, battery life, virtual desktops).");
124     info.ID = "systemdashboard";
125     info.icon = "arrow-down-drop-circle";
126   PANEL.insert(info.ID, info);
127   //Task Manager
128   info = LPI(); //clear it
129     info.name = QObject::tr("Task Manager");
130     info.description = QObject::tr("View and control any running application windows (group similar windows under a single button).");
131     info.ID = "taskmanager";
132     info.icon = "preferences-system-windows";
133   PANEL.insert(info.ID, info);
134   //Task Manager
135   info = LPI(); //clear it
136     info.name = QObject::tr("Task Manager (No Groups)");
137     info.description = QObject::tr("View and control any running application windows (every individual window has a button)");
138     info.ID = "taskmanager-nogroups";
139     info.icon = "preferences-system-windows";
140   PANEL.insert(info.ID, info);
141   //System Tray
142   info = LPI(); //clear it
143     info.name = QObject::tr("System Tray");
144     info.description = QObject::tr("Display area for dockable system applications");
145     info.ID = "systemtray";
146     info.icon = "preferences-system-windows-actions";
147   PANEL.insert(info.ID, info);
148   //Home Button
149   info = LPI(); //clear it
150     info.name = QObject::tr("Show Desktop");
151     info.description = QObject::tr("Hide all open windows and show the desktop");
152     info.ID = "homebutton";
153     info.icon = "user-desktop";
154   PANEL.insert(info.ID, info);
155   //Start Menu
156   info = LPI(); //clear it
157     info.name = QObject::tr("Start Menu");
158     info.description = QObject::tr("Unified system access and application launch menu.");
159     info.ID = "systemstart";
160     info.icon = "Lumina-DE";
161   PANEL.insert(info.ID, info);
162   //Application Launcher
163   info = LPI(); //clear it
164     info.name = QObject::tr("Application Launcher");
165     info.description = QObject::tr("Pin an application shortcut directly to the panel");
166     info.ID = "applauncher";
167     info.icon = "quickopen";
168   PANEL.insert(info.ID, info);
169   //Audio Player Plugin
170   info = LPI(); //clear it
171     info.name = QObject::tr("Audio Player");
172     info.description = QObject::tr("Play through lists of audio files");
173     info.ID = "audioplayer";
174     info.icon = "media-playback-start";
175   PANEL.insert(info.ID, info);
176   //JSON Menu Scripts
177   info = LPI(); //clear it
178     info.name = QObject::tr("Menu Script");
179     info.description = QObject::tr("Run an external script to generate a user defined menu");
180     info.ID = "jsonmenu";
181     info.icon = "text-x-script";
182   PANEL.insert(info.ID, info);
183 }
184 
185 // DESKTOP PLUGINS
LoadDesktopPlugins()186 void LPlugins::LoadDesktopPlugins(){
187   DESKTOP.clear();
188   //Calendar Plugin
189   LPI info;
190     info.name = QObject::tr("Calendar");
191     info.description = QObject::tr("Display a calendar on the desktop");
192     info.ID = "calendar";
193     info.icon = "view-calendar";
194   DESKTOP.insert(info.ID, info);
195   //Application Launcher Plugin
196   info = LPI(); //clear it
197     info.name = QObject::tr("Application Launcher");
198     info.description = QObject::tr("Desktop button for launching an application");
199     info.ID = "applauncher";
200     info.icon = "quickopen";
201   DESKTOP.insert(info.ID, info);
202   //Desktop View Plugin
203   info = LPI(); //clear it
204     info.name = QObject::tr("Desktop Icons View");
205     info.description = QObject::tr("Configurable area for automatically showing desktop icons");
206     info.ID = "desktopview";
207     info.icon = "preferences-desktop-icons";
208   DESKTOP.insert(info.ID, info);
209   //Notepad Plugin
210   info = LPI(); //clear it
211     info.name = QObject::tr("Note Pad");
212     info.description = QObject::tr("Keep simple text notes on your desktop");
213     info.ID = "notepad";
214     info.icon = "text-enriched";
215   DESKTOP.insert(info.ID, info);
216   //Audio Player Plugin
217   info = LPI(); //clear it
218     info.name = QObject::tr("Audio Player");
219     info.description = QObject::tr("Play through lists of audio files");
220     info.ID = "audioplayer";
221     info.icon = "media-playback-start";
222   DESKTOP.insert(info.ID, info);
223   //System Monitor Plugin
224   info = LPI(); //clear it
225     info.name = QObject::tr("System Monitor");
226     info.description = QObject::tr("Keep track of system statistics such as CPU/Memory usage and CPU temperatures.");
227     info.ID = "systemmonitor";
228     info.icon = "cpu";
229   DESKTOP.insert(info.ID, info);
230   //RSS Reader Plugin
231   info = LPI(); //clear it
232     info.name = QObject::tr("RSS Reader");
233     info.description = QObject::tr("Monitor RSS Feeds (Requires internet connection)");
234     info.ID = "rssreader";
235     info.icon = "application-rss+xml";
236   DESKTOP.insert(info.ID, info);
237   //Available QtQuick scripts
238   /*QStringList quickID = LUtils::listQuickPlugins();
239   for(int i=0; i<quickID.length(); i++){
240     QStringList quickinfo = LUtils::infoQuickPlugin(quickID[i]); //Returns: [name, description, icon]
241     if(quickinfo.length() < 3){ continue; } //invalid file (unreadable/other)
242     info = LPI();
243       info.name = quickinfo[0];
244       info.description = quickinfo[1];
245       info.ID = "quick-"+quickID[i]; //the "quick-" prefix is required for the desktop plugin syntax
246       info.icon = quickinfo[2];
247     DESKTOP.insert(info.ID, info);
248   }*/
249 }
250 
251 //    MENU PLUGINS
LoadMenuPlugins()252 void LPlugins::LoadMenuPlugins(){
253   MENU.clear();
254   //Terminal
255   LPI info;
256     info.name = QObject::tr("Terminal");
257     info.description = QObject::tr("Start the default system terminal.");
258     info.ID = "terminal";
259     info.icon = "utilities-terminal";
260   MENU.insert(info.ID, info);
261   //File Manager
262   info = LPI(); //clear it
263     info.name = QObject::tr("Browse Files");
264     info.description = QObject::tr("Browse the system with the default file manager.");
265     info.ID = "filemanager";
266     info.icon = "Insight-FileManager";
267   MENU.insert(info.ID, info);
268   //Applications
269   info = LPI(); //clear it
270     info.name = QObject::tr("Applications");
271     info.description = QObject::tr("Show the system applications menu.");
272     info.ID = "applications";
273     info.icon = "system-run";
274   MENU.insert(info.ID, info);
275   //Line seperator
276   info = LPI(); //clear it
277     info.name = QObject::tr("Separator");
278     info.description = QObject::tr("Static horizontal line.");
279     info.ID = "line";
280     info.icon = "insert-horizontal-rule";
281   MENU.insert(info.ID, info);
282   //Settings
283   info = LPI(); //clear it
284     info.name = QObject::tr("Preferences");
285     info.description = QObject::tr("Show the desktop settings menu.");
286     info.ID = "settings";
287     info.icon = "configure";
288   MENU.insert(info.ID, info);
289   //Window List
290   info = LPI(); //clear it
291     info.name = QObject::tr("Task Manager");
292     info.description = QObject::tr("List the open, minimized, active, and urgent application windows");
293     info.ID = "windowlist";
294     info.icon = "preferences-system-windows";
295   MENU.insert(info.ID, info);
296   //Custom Apps
297   info = LPI(); //clear it
298     info.name = QObject::tr("Custom App");
299     info.description = QObject::tr("Start a custom application");
300     info.ID = "app";
301     info.icon = "application-x-desktop";
302   MENU.insert(info.ID, info);
303   //JSON Menu Scripts
304   info = LPI(); //clear it
305     info.name = QObject::tr("Menu Script");
306     info.description = QObject::tr("Run an external script to generate a user defined menu");
307     info.ID = "jsonmenu";
308     info.icon = "text-x-script";
309   MENU.insert(info.ID, info);
310   //Lock Screen item
311   info = LPI(); //clear it
312     info.name = QObject::tr("Lock Session");
313     info.description = QObject::tr("Lock the current desktop session");
314     info.ID = "lockdesktop";
315     info.icon = "system-lock-screen";
316   MENU.insert(info.ID, info);
317 }
318 
LoadColorItems()319 void LPlugins::LoadColorItems(){
320   COLORS.clear();
321   //Text Color
322   LPI info;
323     info.name = QObject::tr("Text");
324     info.description = QObject::tr("Color to use for all visible text.");
325     info.ID = "TEXTCOLOR";
326   COLORS.insert(info.ID, info);
327   //Text Color (Disabled)
328   info = LPI(); //clear it
329     info.name = QObject::tr("Text (Disabled)");
330     info.description = QObject::tr("Text color for disabled or inactive items.");
331     info.ID = "TEXTDISABLECOLOR";
332   COLORS.insert(info.ID, info);
333   //Text Color (Highlighted)
334   info = LPI(); //clear it
335     info.name = QObject::tr("Text (Highlighted)");
336     info.description = QObject::tr("Text color when selection is highlighted.");
337     info.ID = "TEXTHIGHLIGHTCOLOR";
338   COLORS.insert(info.ID, info);
339   //Base Color (Normal)
340   info = LPI(); //clear it
341     info.name = QObject::tr("Base Window Color");
342     info.description = QObject::tr("Main background color for the window/dialog.");
343     info.ID = "BASECOLOR";
344   COLORS.insert(info.ID, info);
345   //Base Color (Alternate)
346   info = LPI(); //clear it
347     info.name = QObject::tr("Base Window Color (Alternate)");
348     info.description = QObject::tr("Main background color for widgets that list or display collections of items.");
349     info.ID = "ALTBASECOLOR";
350   COLORS.insert(info.ID, info);
351   //Primary Color (Normal)
352   info = LPI(); //clear it
353     info.name = QObject::tr("Primary Color");
354     info.description = QObject::tr("Dominant color for the theme.");
355     info.ID = "PRIMARYCOLOR";
356   COLORS.insert(info.ID, info);
357   //Primary Color (Disabled)
358   info = LPI(); //clear it
359     info.name = QObject::tr("Primary Color (Disabled)");
360     info.description = QObject::tr("Dominant color for the theme (more subdued).");
361     info.ID = "PRIMARYDISABLECOLOR";
362   COLORS.insert(info.ID, info);
363   //Secondary Color (Normal)
364   info = LPI(); //clear it
365     info.name = QObject::tr("Secondary Color");
366     info.description = QObject::tr("Alternate color for the theme.");
367     info.ID = "SECONDARYCOLOR";
368   COLORS.insert(info.ID, info);
369   //Secondary Color (Disabled)
370   info = LPI(); //clear it
371     info.name = QObject::tr("Secondary Color (Disabled)");
372     info.description = QObject::tr("Alternate color for the theme (more subdued).");
373     info.ID = "SECONDARYDISABLECOLOR";
374   COLORS.insert(info.ID, info);
375   //Accent Color (Normal)
376   info = LPI(); //clear it
377     info.name = QObject::tr("Accent Color");
378     info.description = QObject::tr("Color used for borders or other accents.");
379     info.ID = "ACCENTCOLOR";
380   COLORS.insert(info.ID, info);
381   //Accent Color (Disabled)
382   info = LPI(); //clear it
383     info.name = QObject::tr("Accent Color (Disabled)");
384     info.description = QObject::tr("Color used for borders or other accents (more subdued).");
385     info.ID = "ACCENTDISABLECOLOR";
386   COLORS.insert(info.ID, info);
387   //Highlight Color (Normal)
388   info = LPI(); //clear it
389     info.name = QObject::tr("Highlight Color");
390     info.description = QObject::tr("Color used for highlighting an item.");
391     info.ID = "HIGHLIGHTCOLOR";
392   COLORS.insert(info.ID, info);
393   //Highlight Color (Disabled)
394   info = LPI(); //clear it
395     info.name = QObject::tr("Highlight Color (Disabled)");
396     info.description = QObject::tr("Color used for highlighting an item (more subdued).");
397     info.ID = "HIGHLIGHTDISABLECOLOR";
398   COLORS.insert(info.ID, info);
399 }
400