Mess around with log UI. Herp Derp.

This commit is contained in:
Petr Mrázek 2014-07-13 01:49:46 +02:00
parent 4c0dc51110
commit 977cc1cfbb
3 changed files with 103 additions and 82 deletions

View File

@ -6,14 +6,14 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>831</width> <width>825</width>
<height>596</height> <height>782</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Log</string> <string>Log</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QGridLayout" name="gridLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -26,7 +26,34 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item> <item row="2" column="1">
<widget class="QLineEdit" name="lineEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Search:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Find next</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QPlainTextEdit" name="text"> <widget class="QPlainTextEdit" name="text">
<property name="undoRedoEnabled"> <property name="undoRedoEnabled">
<bool>false</bool> <bool>false</bool>
@ -45,25 +72,51 @@
</property> </property>
</widget> </widget>
</item> </item>
<item> <item row="0" column="0" colspan="3">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QPushButton" name="btnPaste"> <widget class="QCheckBox" name="checkBox">
<property name="toolTip"> <property name="enabled">
<string>Upload the log to paste.ee - it will stay online for a month</string> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Upload Log</string> <string>Keep updating</string>
</property>
<property name="checked">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QPushButton" name="btnCopy"> <widget class="QPushButton" name="btnCopy">
<property name="toolTip"> <property name="toolTip">
<string>Copy the whole log into the clipboard</string> <string>Copy the whole log into the clipboard</string>
</property> </property>
<property name="text"> <property name="text">
<string>&amp;Copy Log</string> <string>&amp;Copy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnPaste">
<property name="toolTip">
<string>Upload the log to paste.ee - it will stay online for a month</string>
</property>
<property name="text">
<string>Upload</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -77,19 +130,6 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
</layout> </layout>

View File

@ -29,7 +29,7 @@ OtherLogsPage::OtherLogsPage(BaseInstance *instance, QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
m_watcher->setFileExpression(".*\\.log$"); m_watcher->setFileExpression("(.*\\.log(\\.[0-9]*)?$)|(crash-.*\\.txt)");
m_watcher->setRootDir(QDir::current().absoluteFilePath(m_instance->minecraftRoot())); m_watcher->setRootDir(QDir::current().absoluteFilePath(m_instance->minecraftRoot()));
connect(m_watcher, &RecursiveFileSystemWatcher::filesChanged, this, connect(m_watcher, &RecursiveFileSystemWatcher::filesChanged, this,
@ -55,7 +55,6 @@ void OtherLogsPage::populateSelectLogBox()
{ {
ui->selectLogBox->clear(); ui->selectLogBox->clear();
ui->selectLogBox->addItems(m_watcher->files()); ui->selectLogBox->addItems(m_watcher->files());
ui->selectLogBox->addItem(tr("Other"), true);
if (m_currentFile.isNull()) if (m_currentFile.isNull())
{ {
ui->selectLogBox->setCurrentIndex(-1); ui->selectLogBox->setCurrentIndex(-1);
@ -63,7 +62,8 @@ void OtherLogsPage::populateSelectLogBox()
else else
{ {
const int index = ui->selectLogBox->findText(m_currentFile); const int index = ui->selectLogBox->findText(m_currentFile);
ui->selectLogBox->setCurrentIndex(index); if(index != -1)
ui->selectLogBox->setCurrentIndex(index);
} }
} }
@ -72,15 +72,7 @@ void OtherLogsPage::on_selectLogBox_currentIndexChanged(const int index)
QString file; QString file;
if (index != -1) if (index != -1)
{ {
if (ui->selectLogBox->itemData(index).isValid()) file = ui->selectLogBox->itemText(index);
{
file = QFileDialog::getOpenFileName(
this, tr("Open log file"), m_instance->minecraftRoot(), tr("*.log;;*.txt;;*"));
}
else
{
file = ui->selectLogBox->itemText(index);
}
} }
if (file.isEmpty() || !QFile::exists(m_instance->minecraftRoot() + "/" + file)) if (file.isEmpty() || !QFile::exists(m_instance->minecraftRoot() + "/" + file))

View File

@ -6,14 +6,14 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>640</width> <width>657</width>
<height>480</height> <height>538</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -27,24 +27,14 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QPlainTextEdit" name="text"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="enabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QComboBox" name="selectLogBox"> <widget class="QComboBox" name="selectLogBox">
<property name="maximumSize"> <property name="sizePolicy">
<size> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<width>96</width> <horstretch>0</horstretch>
<height>16777215</height> <verstretch>0</verstretch>
</size> </sizepolicy>
</property> </property>
</widget> </widget>
</item> </item>
@ -56,9 +46,12 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="Line" name="line"> <widget class="QPushButton" name="btnCopy">
<property name="orientation"> <property name="toolTip">
<enum>Qt::Horizontal</enum> <string>Copy the whole log into the clipboard</string>
</property>
<property name="text">
<string>&amp;Copy</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -68,17 +61,7 @@
<string>Upload the log to paste.ee - it will stay online for a month</string> <string>Upload the log to paste.ee - it will stay online for a month</string>
</property> </property>
<property name="text"> <property name="text">
<string>Upload Log</string> <string>Upload</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCopy">
<property name="toolTip">
<string>Copy the whole log into the clipboard</string>
</property>
<property name="text">
<string>&amp;Copy Log</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -92,23 +75,29 @@
</property> </property>
</widget> </widget>
</item> </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> </layout>
</item> </item>
<item>
<widget class="QPlainTextEdit" name="text">
<property name="enabled">
<bool>false</bool>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>text</tabstop>
</tabstops>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>