From a3a66f9dda3425ffb6fd51f4d07fd4ecb7e61884 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 12 Aug 2015 15:34:47 -0400 Subject: Add an extension to the Lumina theme engine/class for specifying a mouse cursor theme. This is integrated into lumina-config as well, but still have 2 problems with it: 1) The active re-loading of the new cursors does not work yet (Qt issues I am still working on) 2) The X11 Cursor file to use for the sample image cannot be loaded by Qt (need to write my own format conversion routine) --- lumina-config/mainUI.cpp | 26 ++++++++++++++++++++++-- lumina-config/mainUI.h | 1 + lumina-config/mainUI.ui | 53 +++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 73 insertions(+), 7 deletions(-) (limited to 'lumina-config') diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp index 5b111cf1..6bd6ba07 100644 --- a/lumina-config/mainUI.cpp +++ b/lumina-config/mainUI.cpp @@ -181,6 +181,7 @@ void MainUI::setupConnections(){ connect(ui->combo_session_wfocus, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); connect(ui->combo_session_wloc, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); connect(ui->combo_session_wtheme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionthemechanged()) ); + connect(ui->combo_session_cursortheme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionCursorChanged()) ); connect(ui->check_session_numlock, SIGNAL(stateChanged(int)), this, SLOT(sessionoptchanged()) ); connect(ui->check_session_playloginaudio, SIGNAL(stateChanged(int)), this, SLOT(sessionoptchanged()) ); connect(ui->check_session_playlogoutaudio, SIGNAL(stateChanged(int)), this, SLOT(sessionoptchanged()) ); @@ -238,6 +239,12 @@ void MainUI::setupMenus(){ ui->combo_session_datetimeorder->addItem( tr("Time first then Date"), "timedate"); ui->combo_session_datetimeorder->addItem( tr("Date first then Time"), "datetime"); + //Available Cursor Themes + ui->combo_session_cursortheme->clear(); + ui->combo_session_cursortheme->addItems( LTHEME::availableSystemCursors() ); + //int cur = ui->combo_session_cursortheme->findText( LTHEME::currentCursor() ); + //if(cur>=0){ ui->combo_session_cursortheme->setCurrentIndex(cur); } + //Available Time zones ui->combo_session_timezone->clear(); QList TZList = QTimeZone::availableTimeZoneIds(); @@ -1664,9 +1671,13 @@ void MainUI::loadSessionSettings(){ // - Font Size ui->spin_session_fontsize->setValue( current[4].section("p",0,0).toInt() ); + int cur = ui->combo_session_cursortheme->findText( LTHEME::currentCursor() ); + if(cur>=0){ ui->combo_session_cursortheme->setCurrentIndex(cur); } + //sessionstartchanged(); //make sure to update buttons sessionLoadTimeSample(); sessionLoadDateSample(); + sessionCursorChanged(); } void MainUI::saveSessionSettings(){ @@ -1771,7 +1782,6 @@ void MainUI::saveSessionSettings(){ sessionsettings->setValue("InitLocale/LC_CTYPE", ui->combo_locale_ctype->currentData().toString() ); - //Now do the theme options QString themefile = ui->combo_session_themefile->itemData( ui->combo_session_themefile->currentIndex() ).toString(); QString colorfile = ui->combo_session_colorfile->itemData( ui->combo_session_colorfile->currentIndex() ).toString(); @@ -1780,6 +1790,7 @@ void MainUI::saveSessionSettings(){ QString fontsize = QString::number(ui->spin_session_fontsize->value())+"pt"; //qDebug() << "Saving theme options:" << themefile << colorfile << iconset << font << fontsize; LTHEME::setCurrentSettings( themefile, colorfile, iconset, font, fontsize); + LTHEME::setCursorTheme(ui->combo_session_cursortheme->currentText()); if(newstartapps){ loadSessionSettings(); } //make sure to re-load the session settings to catch the new files } @@ -1853,6 +1864,18 @@ void MainUI::sessionthemechanged(){ sessionoptchanged(); } +void MainUI::sessionCursorChanged(){ + //Update the Cursor Theme preview + QStringList info = LTHEME::cursorInformation(ui->combo_session_cursortheme->currentText()); + // - info format: [name, comment. sample file] + qDebug() << "Cursor Information:" << ui->combo_session_cursortheme->currentText() << info; + QPixmap img(info[2]); + qDebug() << "Image Data:" << img.isNull() << img.size(); + ui->label_cursor_sample->setPixmap( img.scaledToHeight(ui->label_cursor_sample->height(), Qt::SmoothTransformation) ); + ui->label_cursor_sample->setToolTip(info[1]); + ui->combo_session_cursortheme->setToolTip(info[1]); + sessionoptchanged(); +} /*void MainUI::sessionstartchanged(){ ui->tool_session_rmapp->setEnabled( ui->list_session_start->currentRow()>=0 ); }*/ @@ -2006,4 +2029,3 @@ void MainUI::sessionShowDateCodes(){ msg << tr("Text may be contained within single-quotes to ignore replacements"); QMessageBox::information(this, tr("Date Codes"), msg.join("\n") ); } - diff --git a/lumina-config/mainUI.h b/lumina-config/mainUI.h index ee5b5feb..1810c7b6 100644 --- a/lumina-config/mainUI.h +++ b/lumina-config/mainUI.h @@ -151,6 +151,7 @@ private slots: void addsessionstartfile(); void sessionoptchanged(); void sessionthemechanged(); + void sessionCursorChanged(); //void sessionstartchanged(); void sessionEditColor(); void sessionEditTheme(); diff --git a/lumina-config/mainUI.ui b/lumina-config/mainUI.ui index eee44aa5..aa7024d3 100644 --- a/lumina-config/mainUI.ui +++ b/lumina-config/mainUI.ui @@ -109,7 +109,7 @@ QFrame::StyledPanel - 4 + 0 @@ -370,6 +370,49 @@ + + + + Mouse Cursors: + + + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + + + + + + true + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + @@ -570,8 +613,8 @@ 0 0 - 27 - 16 + 98 + 28 @@ -1447,8 +1490,8 @@ 0 0 - 518 - 139 + 117 + 28 -- cgit