summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLaszlo Papp <lpapp@kde.org>2012-04-08 14:54:54 +0300
committerDenis Shienkov <scapig@yandex.ru>2012-04-08 20:40:53 +0200
commit469bfac84bdd57e9bfabaaaea9715756fe57022d (patch)
tree62d697abfba0210b7aa3d5d957649245f6cf44e5 /examples
parente4d63027e9ea706e21d347ada9e16dcd51a58e21 (diff)
Add a "Quit" action for closing the terminal example
Meanwhile, it is possible to close the application with window managers in Desktop environment like KDE and so forth, it is sadly not that simple with tiling window managers, like "Ratpoison". I have been using "Ratposion" for almost 5-6 years by now. I have switched to this after KDE3 when KDE4 came out. In such window managers, you do not have a "Top Bar" with the quit and other icons, just a bare window about the content. Hence, I would like to propose having a "quit" action for the application for make our lives simpler. My workaround is sending a SIGKILL for such applications which is possible, but surely not the nicest solution. :-) The icon is adopted from the Oxygen Icons project that has also being used by many KDE applications. In fact, this icon is pretty much the defacto standard for the KDE applications. The icon size has just been chosen according to the existing icon sizes inside the "$projectroot/examples/terminal/images" folder. I am not sure we need size 128x128 in there, but I have put that size for consistency with the rest. That probably does not hurt. I do not have a rock solid vision about the placement of the action, but I have currently put this into the first menu bar entry "Calls" with a separator, of course, after the "Disconnect" action. I do not think we should establish a separate menu bar entry just for this very action. I think it is reasonable this way to have the "Quit" action in the first entry, until the need arises to change this significantly in the near future that I doubt at this point. Change-Id: I9f2639d4200e9a300deb872c8dbcf42d9dab54af Reviewed-by: Denis Shienkov <scapig@yandex.ru>
Diffstat (limited to 'examples')
-rw-r--r--examples/terminal/images/application-exit.pngbin0 -> 11200 bytes
-rw-r--r--examples/terminal/mainwindow.cpp2
-rw-r--r--examples/terminal/mainwindow.ui14
-rw-r--r--examples/terminal/terminal.qrc1
4 files changed, 17 insertions, 0 deletions
diff --git a/examples/terminal/images/application-exit.png b/examples/terminal/images/application-exit.png
new file mode 100644
index 00000000..32be6b3f
--- /dev/null
+++ b/examples/terminal/images/application-exit.png
Binary files differ
diff --git a/examples/terminal/mainwindow.cpp b/examples/terminal/mainwindow.cpp
index 0a7e6434..0e93bf7f 100644
--- a/examples/terminal/mainwindow.cpp
+++ b/examples/terminal/mainwindow.cpp
@@ -20,6 +20,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui->actionConnect->setEnabled(true);
ui->actionDisconnect->setEnabled(false);
+ ui->actionQuit->setEnabled(true);
ui->actionConfigure->setEnabled(true);
initActionsConnections();
@@ -105,6 +106,7 @@ void MainWindow::initActionsConnections()
{
connect(ui->actionConnect, SIGNAL(triggered()), this, SLOT(openSerialPort()));
connect(ui->actionDisconnect, SIGNAL(triggered()), this, SLOT(closeSerialPort()));
+ connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close()));
connect(ui->actionConfigure, SIGNAL(triggered()), settings, SLOT(show()));
connect(ui->actionClear, SIGNAL(triggered()), console, SLOT(clear()));
connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about()));
diff --git a/examples/terminal/mainwindow.ui b/examples/terminal/mainwindow.ui
index fd0c080f..452fdd53 100644
--- a/examples/terminal/mainwindow.ui
+++ b/examples/terminal/mainwindow.ui
@@ -31,6 +31,8 @@
</property>
<addaction name="actionConnect"/>
<addaction name="actionDisconnect"/>
+ <addaction name="separator"/>
+ <addaction name="actionQuit"/>
</widget>
<widget class="QMenu" name="menuTools">
<property name="title">
@@ -139,6 +141,18 @@
<string>Alt+L</string>
</property>
</action>
+ <action name="actionQuit">
+ <property name="icon">
+ <iconset resource="terminal.qrc">
+ <normaloff>:/images/application-exit.png</normaloff>:/images/application-exit.png</iconset>
+ </property>
+ <property name="text">
+ <string>&amp;Quit</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+Q</string>
+ </property>
+ </action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
diff --git a/examples/terminal/terminal.qrc b/examples/terminal/terminal.qrc
index 5ca35d4b..0b498794 100644
--- a/examples/terminal/terminal.qrc
+++ b/examples/terminal/terminal.qrc
@@ -2,6 +2,7 @@
<qresource prefix="/">
<file>images/connect.png</file>
<file>images/disconnect.png</file>
+ <file>images/application-exit.png</file>
<file>images/settings.png</file>
<file>images/clear.png</file>
</qresource>