aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop/SettingsMenu.cpp
blob: ddea7f54fe5e8d1494610628e192f0e34e3b6689 (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
//===========================================
//  Lumina-DE source code
//  Copyright (c) 2014, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#include "SettingsMenu.h"
#include "LSession.h"

#include <LuminaOS.h>

SettingsMenu::SettingsMenu() : QMenu(){
  this->setObjectName("SettingsMenu");
  connect(this, SIGNAL(triggered(QAction*)), this, SLOT(runApp(QAction*)) );
  connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(UpdateMenu()) );
  connect(QApplication::instance(), SIGNAL(IconThemeChanged()), this, SLOT(UpdateMenu()) );
  QTimer::singleShot(100, this, SLOT(UpdateMenu()) );
}

SettingsMenu::~SettingsMenu(){

}

void SettingsMenu::UpdateMenu(){
  //Change the title/icon to account for locale/icon changes
  this->setTitle( tr("Preferences") );
  this->setIcon( LXDG::findIcon("configure","") );
  this->clear();
  //Now setup the possible configuration options
  QAction *act = new QAction(LXDG::findIcon("preferences-desktop-screensaver",""), tr("Screensaver"), this);
	act->setWhatsThis("xscreensaver-demo");
	this->addAction(act);
  act = new QAction( LXDG::findIcon("preferences-desktop-wallpaper",""), tr("Wallpaper"), this);
	act->setWhatsThis("lumina-config --page wallpaper");
	this->addAction(act);
   act = new QAction( LXDG::findIcon("preferences-other",""), tr("Display"), this);
	act->setWhatsThis("lumina-xconfig");
	this->addAction(act);
  act = new QAction( LXDG::findIcon("preferences-desktop-theme",""), tr("Theme"), this);
	act->setWhatsThis("lthemeengine");
	this->addAction(act);
  act = new QAction( LXDG::findIcon("preferences-desktop",""), tr("All Desktop Settings"), this);
	act->setWhatsThis("lumina-config");
	this->addAction(act);
  this->addSeparator();
  /*QString qtconfig = LOS::QtConfigShortcut();
  if(QFile::exists(qtconfig) && !qtconfig.isEmpty()){
    act = new QAction( LXDG::findIcon("preferences-desktop-theme",""), tr("Window Theme"), this);
	act->setWhatsThis(qtconfig);
	this->addAction(act);
  }*/
  QString CONTROLPANEL = LOS::ControlPanelShortcut();
  if(QFile::exists(CONTROLPANEL) && !CONTROLPANEL.isEmpty()){
    //Now load the info
    XDGDesktop cpan(CONTROLPANEL);
    if(cpan.isValid()){
      act = new QAction( LXDG::findIcon(cpan.icon,""), tr("Control Panel"), this);
	act->setWhatsThis("lumina-open \""+CONTROLPANEL+"\"");
	this->addAction(act);
    }
  }
  act = new QAction( LXDG::findIcon("lumina",""), tr("About Lumina"), this);
	act->setWhatsThis("lumina-info");
	this->addAction(act);
}


void SettingsMenu::runApp(QAction* act){
  LSession::LaunchApplication(act->whatsThis());
}
bgstack15