summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLubos Dolezel <lubos@dolezel.info>2015-06-04 22:49:19 +0200
committerLubos Dolezel <lubos@dolezel.info>2015-06-04 22:49:19 +0200
commit159cc7d76cb74cda45b1419513ed6f9ef39ce9b9 (patch)
treeee37506de4f9ce1922e580c596a5ae80aae69ad8 /src/gui
parent3c14ccbee23c4ea8090252136982c9926757e629 (diff)
downloadtwinkle-159cc7d76cb74cda45b1419513ed6f9ef39ce9b9.tar
twinkle-159cc7d76cb74cda45b1419513ed6f9ef39ce9b9.tar.gz
twinkle-159cc7d76cb74cda45b1419513ed6f9ef39ce9b9.tar.lz
twinkle-159cc7d76cb74cda45b1419513ed6f9ef39ce9b9.tar.xz
twinkle-159cc7d76cb74cda45b1419513ed6f9ef39ce9b9.zip
Fix logview crash
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/logviewform.cpp8
-rw-r--r--src/gui/logviewform.h1
-rw-r--r--src/gui/logviewform.ui209
3 files changed, 120 insertions, 98 deletions
diff --git a/src/gui/logviewform.cpp b/src/gui/logviewform.cpp
index 110d645..eafeb91 100644
--- a/src/gui/logviewform.cpp
+++ b/src/gui/logviewform.cpp
@@ -1,6 +1,7 @@
#include "logviewform.h"
#include <QScrollBar>
+#include <QTimer>
#include "audits/memman.h"
#include "log.h"
@@ -35,6 +36,7 @@ void LogViewForm::scrollToBottom()
{
QScrollBar* vsb = logTextEdit->verticalScrollBar();
vsb->setValue(vsb->maximum());
+ logTextEdit->update();
}
void LogViewForm::show()
@@ -56,14 +58,16 @@ void LogViewForm::show()
log_file->enable_inform_user(true);
QDialog::show();
- scrollToBottom();
+
+ // Couldn't get it to scroll AND show contents(!) without this hack
+ QTimer::singleShot(50, this, SLOT(scrollToBottom()));
raise();
}
void LogViewForm::closeEvent(QCloseEvent* ev)
{
log_file->enable_inform_user(false);
- logTextEdit->clear();
+ // logTextEdit->clear(); // causes crashes with Qt5
if (logstream) {
MEMMAN_DELETE(logstream);
diff --git a/src/gui/logviewform.h b/src/gui/logviewform.h
index ab4ec0b..fda94c3 100644
--- a/src/gui/logviewform.h
+++ b/src/gui/logviewform.h
@@ -16,6 +16,7 @@ private:
QTextStream* logstream;
bool isOnBottom() const;
+public slots:
void scrollToBottom();
public:
diff --git a/src/gui/logviewform.ui b/src/gui/logviewform.ui
index 6c90cc7..a3f783e 100644
--- a/src/gui/logviewform.ui
+++ b/src/gui/logviewform.ui
@@ -1,98 +1,115 @@
<?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>
- </property>
- <property name="windowTitle">
- <string>Twinkle - Log</string>
- </property>
- <layout class="QGridLayout">
- <item row="0" column="0" rowspan="1" colspan="3">
- <widget class="QPlainTextEdit" name="logTextEdit">
- <property name="lineWrapMode">
- <enum>QPlainTextEdit::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>
- </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>
- </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>
- </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>
- </item>
- </layout>
- </widget>
- <layoutdefault spacing="6" margin="11"/>
- <pixmapfunction></pixmapfunction>
- <tabstops>
- <tabstop>logTextEdit</tabstop>
- <tabstop>clearPushButton</tabstop>
- <tabstop>closePushButton</tabstop>
- </tabstops>
- <includes>
- <include location="local">qfile.h</include>
- </includes>
- <connections>
- <connection>
- <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>
- </connection>
- </connections>
+<ui version="4.0">
+ <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>
+ </property>
+ <property name="windowTitle">
+ <string>Twinkle - Log</string>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0" colspan="3">
+ <widget class="QPlainTextEdit" name="logTextEdit">
+ <property name="whatsThis">
+ <string>Contents of the current log file (~/.twinkle/twinkle.log)</string>
+ </property>
+ <property name="lineWrapMode">
+ <enum>QPlainTextEdit::NoWrap</enum>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </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>
+ </item>
+ <item row="1" column="0">
+ <spacer name="spacer23">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>360</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="1">
+ <widget class="QPushButton" name="clearPushButton">
+ <property name="whatsThis">
+ <string>Clear the log window. This does &lt;b&gt;not&lt;/b&gt; clear the log file itself.</string>
+ </property>
+ <property name="text">
+ <string>C&amp;lear</string>
+ </property>
+ <property name="shortcut">
+ <string>Alt+L</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <tabstops>
+ <tabstop>logTextEdit</tabstop>
+ <tabstop>clearPushButton</tabstop>
+ <tabstop>closePushButton</tabstop>
+ </tabstops>
+ <includes>
+ <include location="local">qfile.h</include>
+ </includes>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>closePushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>LogViewForm</receiver>
+ <slot>close()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>clearPushButton</sender>
+ <signal>clicked()</signal>
+ <receiver>LogViewForm</receiver>
+ <slot>clear()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>20</x>
+ <y>20</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>