summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorMichal Kubecek <mkubecek@suse.cz>2015-04-17 09:06:09 +0200
committerMichal Kubecek <mkubecek@suse.cz>2015-04-17 10:59:21 +0200
commitb557bdf3921cb329a000ff759a169b08c93abff4 (patch)
treede6359d9bca627182b25b4da51128a239d54952e /src/gui
parentb11c217b0ad0f14ae9ca8a322869af5d3f173a13 (diff)
downloadtwinkle-b557bdf3921cb329a000ff759a169b08c93abff4.tar
twinkle-b557bdf3921cb329a000ff759a169b08c93abff4.tar.gz
twinkle-b557bdf3921cb329a000ff759a169b08c93abff4.tar.lz
twinkle-b557bdf3921cb329a000ff759a169b08c93abff4.tar.xz
twinkle-b557bdf3921cb329a000ff759a169b08c93abff4.zip
automatic conversion of logviewform.ui
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/logviewform.cpp93
-rw-r--r--src/gui/logviewform.h30
-rw-r--r--src/gui/logviewform.ui203
-rw-r--r--src/gui/logviewform.ui.h101
-rw-r--r--src/gui/twinkle.pro6
5 files changed, 218 insertions, 215 deletions
diff --git a/src/gui/logviewform.cpp b/src/gui/logviewform.cpp
new file mode 100644
index 0000000..0b0c28b
--- /dev/null
+++ b/src/gui/logviewform.cpp
@@ -0,0 +1,93 @@
+#include "logviewform.h"
+
+#include "audits/memman.h"
+#include "log.h"
+
+/*
+ * Constructs a LogViewForm which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ *
+ * The dialog will by default be modeless, unless you set 'modal' to
+ * true to construct a modal dialog.
+ */
+LogViewForm::LogViewForm(QWidget* parent)
+ : QDialog(parent)
+{
+ setupUi(this);
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+LogViewForm::~LogViewForm()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+void LogViewForm::show()
+{
+ if (isShown()) {
+ raise();
+ return;
+ }
+
+ QString fname = log_file->get_filename().c_str();
+ logfile = new QFile(fname);
+ MEMMAN_NEW(logfile);
+ logstream = NULL;
+ if (logfile->open(QIODevice::ReadOnly)) {
+ logstream = new Q3TextStream(logfile);
+ MEMMAN_NEW(logstream);
+ logTextEdit->setText(logstream->read());
+
+ // Set cursor position at the end of text
+ logTextEdit->scrollToBottom();
+ }
+
+ log_file->enable_inform_user(true);
+
+ QDialog::show();
+ raise();
+}
+
+void LogViewForm::closeEvent(QCloseEvent* ev)
+{
+ log_file->enable_inform_user(false);
+ logTextEdit->clear();
+
+ if (logstream) {
+ MEMMAN_DELETE(logstream);
+ delete logstream;
+ logstream = NULL;
+ }
+
+ logfile->close();
+ MEMMAN_DELETE(logfile);
+ delete logfile;
+ logfile = NULL;
+
+ QDialog::closeEvent(ev);
+}
+
+void LogViewForm::update(bool log_zapped)
+{
+ if (!isShown()) return;
+
+ if (log_zapped) {
+ close();
+ show();
+ return;
+ }
+
+ if (logstream) {
+ QString s = logstream->read();
+ if (!s.isNull() && !s.isEmpty()) {
+ logTextEdit->append(s);
+ }
+ }
+}
+
+void LogViewForm::clear()
+{
+ logTextEdit->clear();
+}
diff --git a/src/gui/logviewform.h b/src/gui/logviewform.h
new file mode 100644
index 0000000..821f15e
--- /dev/null
+++ b/src/gui/logviewform.h
@@ -0,0 +1,30 @@
+#ifndef LOGVIEWFORM_H
+#define LOGVIEWFORM_H
+
+#include <QDialog>
+#include <QCloseEvent>
+#include <Q3TextStream>
+
+#include "ui_logviewform.h"
+
+class LogViewForm : public QDialog, protected Ui::LogViewForm
+{
+ Q_OBJECT
+
+private:
+ QFile* logfile;
+ Q3TextStream* logstream;
+
+public:
+ LogViewForm(QWidget* parent = 0);
+ ~LogViewForm();
+
+public slots:
+ void show();
+ void closeEvent(QCloseEvent* ev);
+ void update(bool log_zapped);
+ void clear();
+
+};
+
+#endif // LOGVIEWFORM_H
diff --git a/src/gui/logviewform.ui b/src/gui/logviewform.ui
index c99d24c..496c529 100644
--- a/src/gui/logviewform.ui
+++ b/src/gui/logviewform.ui
@@ -1,123 +1,102 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>LogViewForm</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>LogViewForm</cstring>
- </property>
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0" stdsetdef="1">
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>LogViewForm</class>
+ <widget class="QDialog" name="LogViewForm">
<property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>599</width>
- <height>472</height>
- </rect>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>599</width>
+ <height>472</height>
+ </rect>
</property>
- <property name="caption">
- <string>Twinkle - Log</string>
+ <property name="windowTitle">
+ <string>Twinkle - Log</string>
</property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QTextEdit" row="0" column="0" rowspan="1" colspan="3">
- <property name="name">
- <cstring>logTextEdit</cstring>
- </property>
- <property name="textFormat">
- <enum>PlainText</enum>
- </property>
- <property name="wordWrap">
- <enum>NoWrap</enum>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- <property name="whatsThis" stdset="0">
- <string>Contents of the current log file (~/.twinkle/twinkle.log)</string>
- </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0" rowspan="1" colspan="3">
+ <widget class="Q3TextEdit" name="logTextEdit">
+ <property name="textFormat">
+ <enum>Qt::PlainText</enum>
+ </property>
+ <property name="wordWrap">
+ <enum>Q3TextEdit::NoWrap</enum>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Contents of the current log file (~/.twinkle/twinkle.log)</string>
+ </property>
</widget>
- <widget class="QPushButton" row="1" column="2">
- <property name="name">
- <cstring>closePushButton</cstring>
- </property>
- <property name="text">
- <string>&amp;Close</string>
- </property>
- <property name="accel">
- <string>Alt+C</string>
- </property>
+ </item>
+ <item row="1" column="2">
+ <widget class="QPushButton" name="closePushButton">
+ <property name="text">
+ <string>&amp;Close</string>
+ </property>
+ <property name="shortcut">
+ <string>Alt+C</string>
+ </property>
</widget>
- <spacer row="1" column="0">
- <property name="name">
- <cstring>spacer23</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>360</width>
- <height>20</height>
- </size>
- </property>
+ </item>
+ <item row="1" column="0">
+ <spacer name="spacer23">
+ <property name="sizeHint">
+ <size>
+ <width>360</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
</spacer>
- <widget class="QPushButton" row="1" column="1">
- <property name="name">
- <cstring>clearPushButton</cstring>
- </property>
- <property name="text">
- <string>C&amp;lear</string>
- </property>
- <property name="accel">
- <string>Alt+L</string>
- </property>
- <property name="whatsThis" stdset="0">
- <string>Clear the log window. This does &lt;b&gt;not&lt;/b&gt; clear the log file itself.</string>
- </property>
+ </item>
+ <item row="1" column="1">
+ <widget class="QPushButton" name="clearPushButton">
+ <property name="text">
+ <string>C&amp;lear</string>
+ </property>
+ <property name="shortcut">
+ <string>Alt+L</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Clear the log window. This does &lt;b&gt;not&lt;/b&gt; clear the log file itself.</string>
+ </property>
</widget>
- </grid>
-</widget>
-<connections>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <tabstops>
+ <tabstop>logTextEdit</tabstop>
+ <tabstop>clearPushButton</tabstop>
+ <tabstop>closePushButton</tabstop>
+ </tabstops>
+ <includes>
+ <include location="local">qfile.h</include>
+ <include location="local">q3textstream.h</include>
+ </includes>
+ <connections>
<connection>
- <sender>closePushButton</sender>
- <signal>clicked()</signal>
- <receiver>LogViewForm</receiver>
- <slot>close()</slot>
+ <sender>closePushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>LogViewForm</receiver>
+ <slot>close()</slot>
</connection>
<connection>
- <sender>clearPushButton</sender>
- <signal>clicked()</signal>
- <receiver>LogViewForm</receiver>
- <slot>clear()</slot>
+ <sender>clearPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>LogViewForm</receiver>
+ <slot>clear()</slot>
</connection>
-</connections>
-<tabstops>
- <tabstop>logTextEdit</tabstop>
- <tabstop>clearPushButton</tabstop>
- <tabstop>closePushButton</tabstop>
-</tabstops>
-<includes>
- <include location="local" impldecl="in declaration">qfile.h</include>
- <include location="local" impldecl="in declaration">qtextstream.h</include>
- <include location="local" impldecl="in implementation">log.h</include>
- <include location="local" impldecl="in implementation">qdialog.h</include>
- <include location="local" impldecl="in implementation">qstring.h</include>
- <include location="local" impldecl="in implementation">audits/memman.h</include>
- <include location="local" impldecl="in implementation">logviewform.ui.h</include>
-</includes>
-<variables>
- <variable access="private">QFile *logfile;</variable>
- <variable access="private">QTextStream *logstream;</variable>
-</variables>
-<slots>
- <slot>show()</slot>
- <slot>closeEvent( QCloseEvent * ev )</slot>
- <slot>update( bool log_zapped )</slot>
- <slot>clear()</slot>
-</slots>
-<pixmapinproject/>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+ </connections>
+</ui>
diff --git a/src/gui/logviewform.ui.h b/src/gui/logviewform.ui.h
deleted file mode 100644
index 6563015..0000000
--- a/src/gui/logviewform.ui.h
+++ /dev/null
@@ -1,101 +0,0 @@
-//Added by qt3to4:
-#include <Q3TextStream>
-#include <QCloseEvent>
-/****************************************************************************
-** ui.h extension file, included from the uic-generated form implementation.
-**
-** If you want to add, delete, or rename functions or slots, use
-** Qt Designer to update this file, preserving your code.
-**
-** You should not define a constructor or destructor in this file.
-** Instead, write your code in functions called init() and destroy().
-** These will automatically be called by the form's constructor and
-** destructor.
-*****************************************************************************/
-
-/*
- Copyright (C) 2005-2009 Michel de Boer <michel@twinklephone.com>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-void LogViewForm::show()
-{
- if (isShown()) {
- raise();
- return;
- }
-
- QString fname = log_file->get_filename().c_str();
- logfile = new QFile(fname);
- MEMMAN_NEW(logfile);
- logstream = NULL;
- if (logfile->open(QIODevice::ReadOnly)) {
- logstream = new Q3TextStream(logfile);
- MEMMAN_NEW(logstream);
- logTextEdit->setText(logstream->read());
-
- // Set cursor position at the end of text
- logTextEdit->scrollToBottom();
- }
-
- log_file->enable_inform_user(true);
-
- QDialog::show();
- raise();
-}
-
-void LogViewForm::closeEvent( QCloseEvent *ev )
-{
- log_file->enable_inform_user(false);
- logTextEdit->clear();
-
- if (logstream) {
- MEMMAN_DELETE(logstream);
- delete logstream;
- logstream = NULL;
- }
-
- logfile->close();
- MEMMAN_DELETE(logfile);
- delete logfile;
- logfile = NULL;
-
- QDialog::closeEvent(ev);
-}
-
-void LogViewForm::update(bool log_zapped)
-{
- if (!isShown()) return;
-
- if (log_zapped) {
- close();
- show();
- return;
- }
-
- if (logstream) {
- QString s = logstream->read();
- if (!s.isNull() && !s.isEmpty()) {
- logTextEdit->append(s);
- }
- }
-}
-
-void LogViewForm::clear()
-{
- logTextEdit->clear();
-}
-
diff --git a/src/gui/twinkle.pro b/src/gui/twinkle.pro
index 78e8a8e..6c7e7f6 100644
--- a/src/gui/twinkle.pro
+++ b/src/gui/twinkle.pro
@@ -12,6 +12,7 @@ INCLUDEPATH += ..
HEADERS += gui.h \
dtmfform.h \
deregisterform.h \
+ logviewform.h \
historylistview.h \
freedesksystray.h \
twinklesystray.h \
@@ -30,6 +31,7 @@ SOURCES += main.cpp \
gui.cpp \
dtmfform.cpp \
deregisterform.cpp \
+ logviewform.cpp \
historylistview.cpp \
freedesksystray.cpp \
twinklesystray.cpp \
@@ -41,7 +43,8 @@ SOURCES += main.cpp \
twinkleapplication.cpp
FORMS = dtmfform.ui \
- deregisterform.ui
+ deregisterform.ui \
+ logviewform.ui
#The following line was changed from FORMS to FORMS3 by qt3to4
FORMS3 = mphoneform.ui \
@@ -56,7 +59,6 @@ FORMS3 = mphoneform.ui \
getprofilenameform.ui \
transferform.ui \
syssettingsform.ui \
- logviewform.ui \
wizardform.ui \
getaddressform.ui \
historyform.ui \