aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lumina-config/mainUI.cpp38
-rw-r--r--lumina-config/mainUI.h1
-rw-r--r--lumina-config/mainUI.ui46
3 files changed, 75 insertions, 10 deletions
diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp
index d2fc0215..c1f5b222 100644
--- a/lumina-config/mainUI.cpp
+++ b/lumina-config/mainUI.cpp
@@ -8,6 +8,7 @@
#include "ui_mainUI.h" //the designer *.ui file
#include <LuminaOS.h>
+#include <QImageReader>
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){
ui->setupUi(this); //load the designer file
@@ -211,6 +212,7 @@ void MainUI::setupConnections(){
connect(ui->font_session_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) );
connect(ui->tool_session_newcolor, SIGNAL(clicked()), this, SLOT(sessionEditColor()) );
connect(ui->tool_session_newtheme, SIGNAL(clicked()), this, SLOT(sessionEditTheme()) );
+ connect(ui->push_session_setUserIcon, SIGNAL(clicked()), this, SLOT(sessionChangeUserIcon()) );
}
void MainUI::setupMenus(){
@@ -1669,7 +1671,7 @@ void MainUI::loadSessionSettings(){
ui->check_session_numlock->setChecked( sessionsettings->value("EnableNumlock", true).toBool() );
ui->check_session_playloginaudio->setChecked( sessionsettings->value("PlayStartupAudio",true).toBool() );
ui->check_session_playlogoutaudio->setChecked( sessionsettings->value("PlayLogoutAudio",true).toBool() );
-
+ ui->push_session_setUserIcon->setIcon( LXDG::findIcon(QDir::homePath()+"/.loginIcon.png", "user-identity") );
//Now do the session theme options
ui->combo_session_themefile->clear();
ui->combo_session_colorfile->clear();
@@ -1884,4 +1886,36 @@ void MainUI::sessionEditTheme(){
ui->combo_session_themefile->addItem(tmp[i].section("::::",0,0)+" ("+tr("System")+")", tmp[i].section("::::",1,1));
if(tmp[i].section("::::",1,1)==dlg.themepath){ ui->combo_session_themefile->setCurrentIndex(ui->combo_session_themefile->count()-1); }
}
-} \ No newline at end of file
+}
+
+void MainUI::sessionChangeUserIcon(){
+ //Prompt for a new image file
+ QStringList imgformats;
+ QList<QByteArray> fmts = QImageReader::supportedImageFormats();
+ for(int i=0; i<fmts.length(); i++){
+ imgformats << "*."+QString(fmts[i]);
+ }
+ QString filepath = QFileDialog::getOpenFileName(this, tr("Select an image"), QDir::homePath(), \
+ tr("Images")+" ("+imgformats.join(" ")+")");
+ if(filepath.isEmpty()){
+ //User cancelled the operation
+ if(QFile::exists(QDir::homePath()+"/.loginIcon.png")){
+ if(QMessageBox::Yes == QMessageBox::question(this,tr("Reset User Image"), tr("Would you like to reset the user image to the system default?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){
+ QFile::remove(QDir::homePath()+"/.loginIcon.png");
+ }
+ }
+ }else{
+ QPixmap pix(filepath);
+ //Now scale it down if necessary
+ if(pix.width() > 64 || pix.height()>64){
+ pix = pix.scaled(64,64,Qt::KeepAspectRatio, Qt::SmoothTransformation);
+ }
+ //Now save that to the icon file (will automatically convert it to a PNG file format)
+ pix.save(QDir::homePath()+"/.loginIcon.png");
+ //Now touch the settings file so that it re-loads the panel
+ QProcess::startDetached("touch \""+settings->fileName()+"\"");
+ }
+ //Now re-load the icon in the UI
+ ui->push_session_setUserIcon->setIcon( LXDG::findIcon(QDir::homePath()+"/.loginIcon.png", "user-identity") );
+}
+ \ No newline at end of file
diff --git a/lumina-config/mainUI.h b/lumina-config/mainUI.h
index 227f4aef..4c13f978 100644
--- a/lumina-config/mainUI.h
+++ b/lumina-config/mainUI.h
@@ -160,6 +160,7 @@ private slots:
void sessionstartchanged();
void sessionEditColor();
void sessionEditTheme();
+ void sessionChangeUserIcon();
};
#endif
diff --git a/lumina-config/mainUI.ui b/lumina-config/mainUI.ui
index 2622f9c0..6486ed6c 100644
--- a/lumina-config/mainUI.ui
+++ b/lumina-config/mainUI.ui
@@ -106,7 +106,7 @@
<enum>QFrame::StyledPanel</enum>
</property>
<property name="currentIndex">
- <number>1</number>
+ <number>5</number>
</property>
<widget class="QWidget" name="page_desktop">
<layout class="QVBoxLayout" name="verticalLayout_3">
@@ -483,8 +483,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>272</width>
- <height>184</height>
+ <width>175</width>
+ <height>113</height>
</rect>
</property>
<attribute name="label">
@@ -720,8 +720,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>272</width>
- <height>184</height>
+ <width>175</width>
+ <height>113</height>
</rect>
</property>
<attribute name="label">
@@ -1232,7 +1232,7 @@
<string/>
</property>
<property name="currentIndex">
- <number>0</number>
+ <number>1</number>
</property>
<widget class="QWidget" name="tab_theme">
<attribute name="title">
@@ -1368,6 +1368,36 @@
</widget>
</item>
<item>
+ <layout class="QHBoxLayout" name="horizontalLayout_14">
+ <item>
+ <widget class="QPushButton" name="push_session_setUserIcon">
+ <property name="text">
+ <string>Change User Icon</string>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_16">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -1519,8 +1549,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>117</width>
- <height>16</height>
+ <width>501</width>
+ <height>70</height>
</rect>
</property>
<property name="sizePolicy">
bgstack15