aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-calculator
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2016-10-20 13:10:27 -0400
committerKen Moore <ken@ixsystems.com>2016-10-20 13:10:27 -0400
commitb7ee5390b1dc9cdc3135e0468ffe200b7c436a2b (patch)
treebb65ce163b22bb0afb16919d50fc49c72169773a /src-qt5/desktop-utils/lumina-calculator
parentAdd the app registration for lumina-calculator. (diff)
downloadlumina-b7ee5390b1dc9cdc3135e0468ffe200b7c436a2b.tar.gz
lumina-b7ee5390b1dc9cdc3135e0468ffe200b7c436a2b.tar.bz2
lumina-b7ee5390b1dc9cdc3135e0468ffe200b7c436a2b.zip
Hook up the Lumina theme engine into lumina-calculator for icon changes, as well as the translation loading mechanisms.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-calculator')
-rw-r--r--src-qt5/desktop-utils/lumina-calculator/main.cpp9
-rw-r--r--src-qt5/desktop-utils/lumina-calculator/mainUI.cpp8
-rw-r--r--src-qt5/desktop-utils/lumina-calculator/mainUI.h35
-rw-r--r--src-qt5/desktop-utils/lumina-calculator/mainUI.ui79
4 files changed, 91 insertions, 40 deletions
diff --git a/src-qt5/desktop-utils/lumina-calculator/main.cpp b/src-qt5/desktop-utils/lumina-calculator/main.cpp
index af252cb3..ea1ae60c 100644
--- a/src-qt5/desktop-utils/lumina-calculator/main.cpp
+++ b/src-qt5/desktop-utils/lumina-calculator/main.cpp
@@ -7,13 +7,20 @@
#include <QApplication>
#include <QDebug>
+#include <LuminaThemes.h>
+#include <LuminaUtils.h>
+
#include "mainUI.h"
int main(int argc, char *argv[]) {
+ LTHEME::LoadCustomEnvSettings();
QApplication a(argc, argv);
-
+ LUtils::LoadTranslation(&a, "l-calc");
+ //Now go ahead and setup the app
+ LuminaThemeEngine theme(&a);
//Now start the window
mainUI W;
+ QObject::connect(&theme, SIGNAL(updateIcons()), &W, SLOT(updateIcons()) );
W.show();
return a.exec();
}
diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp
index 539fbb8e..3db2e028 100644
--- a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp
@@ -37,18 +37,22 @@ mainUI::mainUI() : QMainWindow(), ui(new Ui::mainUI()){
connect(ui->button_Equal, SIGNAL (clicked()), this, SLOT (start_calc()));
this->setWindowTitle(tr("Calculator"));
- this->setWindowIcon( LXDG::findIcon("accessories-calculator","") );
+ updateIcons();
ui->line_eq->setFocus();
}
mainUI::~mainUI(){
}
+void mainUI::updateIcons(){
+ this->setWindowIcon( LXDG::findIcon("accessories-calculator","") );
+}
+
void mainUI::start_calc(){
if(ui->line_eq->text().isEmpty()){ return; } //nothing to do
double result = strToNumber(ui->line_eq->text());
if(result!=result){ return; } //bad calculation - NaN's values are special in that they don't equal itself
- QString res = "%1 \t(%2)";
+ QString res = "%1 \t= [ %2 ]";
ui->list_results->addItem(res.arg(QString::number(result), ui->line_eq->text()));
ui->list_results->scrollToItem( ui->list_results->item( ui->list_results->count()-1) );
ui->line_eq->clear();
diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.h b/src-qt5/desktop-utils/lumina-calculator/mainUI.h
index 0d99c83a..5bab1ffc 100644
--- a/src-qt5/desktop-utils/lumina-calculator/mainUI.h
+++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.h
@@ -21,25 +21,28 @@ public:
mainUI();
~mainUI();
+public slots:
+ void updateIcons();
+
private slots:
void start_calc();
- void clear_calc();
- void captureButton1();
- void captureButton2();
- void captureButton3();
- void captureButton4();
- void captureButton5();
- void captureButton6();
- void captureButton7();
- void captureButton8();
- void captureButton9();
- void captureButton0();
- void captureButtonSubtract();
- void captureButtonAdd();
- void captureButtonDivide();
- void captureButtonMultiply();
+ void clear_calc();
+ void captureButton1();
+ void captureButton2();
+ void captureButton3();
+ void captureButton4();
+ void captureButton5();
+ void captureButton6();
+ void captureButton7();
+ void captureButton8();
+ void captureButton9();
+ void captureButton0();
+ void captureButtonSubtract();
+ void captureButtonAdd();
+ void captureButtonDivide();
+ void captureButtonMultiply();
// void captureButtonEqual();
- void captureButtonDecimal();
+ void captureButtonDecimal();
private:
diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.ui b/src-qt5/desktop-utils/lumina-calculator/mainUI.ui
index 2ca316ed..0bdc4001 100644
--- a/src-qt5/desktop-utils/lumina-calculator/mainUI.ui
+++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.ui
@@ -26,10 +26,14 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
- <widget class="QWidget" name="">
+ <widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QListWidget" name="list_results"/>
+ <widget class="QListWidget" name="list_results">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
+ </widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
@@ -38,6 +42,9 @@
</item>
<item>
<widget class="QToolButton" name="tool_clear">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>C</string>
</property>
@@ -50,10 +57,13 @@
</item>
</layout>
</widget>
- <widget class="QWidget" name="">
+ <widget class="QWidget" name="layoutWidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="button_7">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>7</string>
</property>
@@ -61,6 +71,9 @@
</item>
<item row="0" column="1">
<widget class="QPushButton" name="button_8">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>8</string>
</property>
@@ -68,6 +81,9 @@
</item>
<item row="0" column="2">
<widget class="QPushButton" name="button_9">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>9</string>
</property>
@@ -75,6 +91,9 @@
</item>
<item row="0" column="3">
<widget class="QPushButton" name="button_Divide">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>/</string>
</property>
@@ -82,6 +101,9 @@
</item>
<item row="1" column="0">
<widget class="QPushButton" name="button_4">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>4</string>
</property>
@@ -89,6 +111,9 @@
</item>
<item row="1" column="1">
<widget class="QPushButton" name="button_5">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>5</string>
</property>
@@ -96,6 +121,9 @@
</item>
<item row="1" column="2">
<widget class="QPushButton" name="button_6">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>6</string>
</property>
@@ -103,6 +131,9 @@
</item>
<item row="1" column="3">
<widget class="QPushButton" name="button_Multiply">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>*</string>
</property>
@@ -110,6 +141,9 @@
</item>
<item row="2" column="0">
<widget class="QPushButton" name="button_1">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>1</string>
</property>
@@ -117,6 +151,9 @@
</item>
<item row="2" column="1">
<widget class="QPushButton" name="button_2">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>2</string>
</property>
@@ -124,6 +161,9 @@
</item>
<item row="2" column="2">
<widget class="QPushButton" name="button_3">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>3</string>
</property>
@@ -131,6 +171,9 @@
</item>
<item row="2" column="3">
<widget class="QPushButton" name="button_Subtract">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>-</string>
</property>
@@ -138,6 +181,9 @@
</item>
<item row="3" column="0">
<widget class="QPushButton" name="button_0">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>0</string>
</property>
@@ -145,6 +191,9 @@
</item>
<item row="3" column="1">
<widget class="QPushButton" name="button_Decimal">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>.</string>
</property>
@@ -152,6 +201,9 @@
</item>
<item row="3" column="2">
<widget class="QPushButton" name="button_Equal">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>=</string>
</property>
@@ -159,6 +211,9 @@
</item>
<item row="3" column="3">
<widget class="QPushButton" name="button_Add">
+ <property name="focusPolicy">
+ <enum>Qt::NoFocus</enum>
+ </property>
<property name="text">
<string>+</string>
</property>
@@ -167,24 +222,6 @@
</layout>
</widget>
</widget>
- <zorder>list_results</zorder>
- <zorder>button_7</zorder>
- <zorder>button_8</zorder>
- <zorder>button_9</zorder>
- <zorder>button_Divide</zorder>
- <zorder>button_4</zorder>
- <zorder>button_5</zorder>
- <zorder>button_6</zorder>
- <zorder>button_Multiply</zorder>
- <zorder>button_1</zorder>
- <zorder>button_2</zorder>
- <zorder>button_3</zorder>
- <zorder>button_Subtract</zorder>
- <zorder>button_0</zorder>
- <zorder>button_Decimal</zorder>
- <zorder>button_Equal</zorder>
- <zorder>button_Add</zorder>
- <zorder>line_eq</zorder>
</widget>
</widget>
<resources/>
bgstack15