aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils')
-rw-r--r--src-qt5/desktop-utils/lumina-calculator/mainUI.cpp43
-rw-r--r--src-qt5/desktop-utils/lumina-calculator/mainUI.h19
-rw-r--r--src-qt5/desktop-utils/lumina-calculator/mainUI.ui192
3 files changed, 224 insertions, 30 deletions
diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp
index 18d2cfdd..f759f5c6 100644
--- a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp
@@ -16,13 +16,30 @@
mainUI::mainUI() : QMainWindow(), ui(new Ui::mainUI()){
ui->setupUi(this);
- connect(ui->tool_start, SIGNAL(clicked()), this, SLOT(start_calc()) );
+ connect(ui->tool_clear, SIGNAL(clicked()), this, SLOT(clear_calc()) );
connect(ui->line_eq, SIGNAL(returnPressed()), this, SLOT(start_calc()) );
+ connect (ui->button_1, SIGNAL (clicked()), this, SLOT (captureButton1()));
+ connect (ui->button_2, SIGNAL (clicked()), this, SLOT (captureButton2()));
+ connect (ui->button_3, SIGNAL (clicked()), this, SLOT (captureButton3()));
+ connect (ui->button_4, SIGNAL (clicked()), this, SLOT (captureButton4()));
+ connect (ui->button_5, SIGNAL (clicked()), this, SLOT (captureButton5()));
+ connect (ui->button_6, SIGNAL (clicked()), this, SLOT (captureButton6()));
+ connect (ui->button_7, SIGNAL (clicked()), this, SLOT (captureButton7()));
+ connect (ui->button_8, SIGNAL (clicked()), this, SLOT (captureButton8()));
+ connect (ui->button_9, SIGNAL (clicked()), this, SLOT (captureButton9()));
+ connect (ui->button_0, SIGNAL (clicked()), this, SLOT (captureButton0()));
+ connect (ui->button_Subtract, SIGNAL (clicked()), this, SLOT (captureButtonSubtract()));
+ connect (ui->button_Add, SIGNAL (clicked()), this, SLOT (captureButtonAdd()));
+ connect (ui->button_Divide, SIGNAL (clicked()), this, SLOT (captureButtonDivide()));
+ connect (ui->button_Multiply, SIGNAL (clicked()), this, SLOT (captureButtonMultiply()));
+ connect (ui->button_Decimal, SIGNAL (clicked()), this, SLOT (captureButtonDecimal()));
+ connect (ui->button_Equal, SIGNAL (clicked()), this, SLOT (start_calc()));
+
+
ui->line_eq->setFocus();
}
mainUI::~mainUI(){
-
}
void mainUI::start_calc(){
@@ -35,6 +52,28 @@ void mainUI::start_calc(){
ui->line_eq->clear();
}
+void mainUI::clear_calc(){
+ ui->line_eq->clear();
+ ui->line_eq->setFocus();
+}
+
+void mainUI::captureButton1(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_1->text()); }
+void mainUI::captureButton2(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_2->text()); }
+void mainUI::captureButton3(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_3->text()); }
+void mainUI::captureButton4(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_4->text()); }
+void mainUI::captureButton5(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_5->text()); }
+void mainUI::captureButton6(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_6->text()); }
+void mainUI::captureButton7(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_7->text()); }
+void mainUI::captureButton8(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_8->text()); }
+void mainUI::captureButton9(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_9->text()); }
+void mainUI::captureButton0(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_0->text()); }
+void mainUI::captureButtonSubtract(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_Subtract->text()); }
+void mainUI::captureButtonAdd(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_Add->text()); }
+void mainUI::captureButtonDivide(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_Divide->text()); }
+void mainUI::captureButtonMultiply(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_Multiply->text()); }
+//void mainUI::captureButtonEqual(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_Equal->text()); }
+void mainUI::captureButtonDecimal(){ ui->line_eq->setText(ui->line_eq->text() += ui->button_Decimal->text()); }
+
double mainUI::performOperation(double LHS, double RHS, QChar symbol){
if(symbol== '+'){ return (LHS+RHS); }
else if(symbol== '-'){ return (LHS-RHS); }
diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.h b/src-qt5/desktop-utils/lumina-calculator/mainUI.h
index 96414252..0d99c83a 100644
--- a/src-qt5/desktop-utils/lumina-calculator/mainUI.h
+++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.h
@@ -23,10 +23,27 @@ public:
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 captureButtonEqual();
+ void captureButtonDecimal();
+
private:
Ui::mainUI *ui;
-
double performOperation(double LHS, double RHS, QChar symbol);
double strToNumber(QString str); //this is highly-recursive
};
diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.ui b/src-qt5/desktop-utils/lumina-calculator/mainUI.ui
index 0e52f4db..2ca316ed 100644
--- a/src-qt5/desktop-utils/lumina-calculator/mainUI.ui
+++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.ui
@@ -6,48 +6,186 @@
<rect>
<x>0</x>
<y>0</y>
- <width>245</width>
- <height>149</height>
+ <width>255</width>
+ <height>376</height>
</rect>
</property>
<property name="windowTitle">
<string>Calculator</string>
</property>
<widget class="QWidget" name="centralwidget">
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QListWidget" name="list_results"/>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <widget class="QSplitter" name="splitter">
+ <property name="geometry">
+ <rect>
+ <x>9</x>
+ <y>9</y>
+ <width>241</width>
+ <height>361</height>
+ </rect>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="QWidget" name="">
+ <layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QLineEdit" name="line_eq"/>
+ <widget class="QListWidget" name="list_results"/>
</item>
<item>
- <widget class="QToolButton" name="tool_start">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLineEdit" name="line_eq"/>
+ </item>
+ <item>
+ <widget class="QToolButton" name="tool_clear">
+ <property name="text">
+ <string>C</string>
+ </property>
+ <property name="autoRaise">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QPushButton" name="button_7">
+ <property name="text">
+ <string>7</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QPushButton" name="button_8">
+ <property name="text">
+ <string>8</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QPushButton" name="button_9">
+ <property name="text">
+ <string>9</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <widget class="QPushButton" name="button_Divide">
+ <property name="text">
+ <string>/</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QPushButton" name="button_4">
+ <property name="text">
+ <string>4</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QPushButton" name="button_5">
+ <property name="text">
+ <string>5</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QPushButton" name="button_6">
+ <property name="text">
+ <string>6</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
+ <widget class="QPushButton" name="button_Multiply">
+ <property name="text">
+ <string>*</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QPushButton" name="button_1">
+ <property name="text">
+ <string>1</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QPushButton" name="button_2">
+ <property name="text">
+ <string>2</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QPushButton" name="button_3">
+ <property name="text">
+ <string>3</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3">
+ <widget class="QPushButton" name="button_Subtract">
+ <property name="text">
+ <string>-</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QPushButton" name="button_0">
+ <property name="text">
+ <string>0</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QPushButton" name="button_Decimal">
+ <property name="text">
+ <string>.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="QPushButton" name="button_Equal">
+ <property name="text">
+ <string>=</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="3">
+ <widget class="QPushButton" name="button_Add">
<property name="text">
- <string>...</string>
+ <string>+</string>
</property>
</widget>
</item>
</layout>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </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 class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
bgstack15