#include <ui_mainwindow_noklib.h>
#include "aboutdialog.h"
#include <QAbstractButton>
+#include <QFileDialog>
#else
#include <ui_mainwindow.h>
#include <KConfigGroup>
setupObjectTreeModel(objectTreeModel, m_ui->objectTreeResults, m_ui->filterClass, m_ui->filterGC);
auto validateInputFile = [this](const QString& path, bool allowEmpty) -> bool {
+ m_ui->messages->hide();
if (path.isEmpty()) {
return allowEmpty;
}
m_ui->buttonBox->setEnabled(true);
auto validateInputAndLoadFile = [this, validateInputFile]() {
- const auto path = m_ui->openFile->text();
+ const auto path = m_ui->openFileEdit->text();
if (!validateInputFile(path, false)) {
return;
}
Q_ASSERT(!path.isEmpty());
- const auto base = m_ui->compareTo->text();
+ const auto base = m_ui->compareToEdit->text();
if (!validateInputFile(base, true)) {
return;
}
+ QApplication::setOverrideCursor(Qt::WaitCursor);
loadFile(path, base);
+ QApplication::restoreOverrideCursor();
};
connect(m_ui->buttonBox, &QDialogButtonBox::clicked, this, validateInputAndLoadFile);
+
+ connect(m_ui->openFileButton1, &QPushButton::clicked, this, &MainWindow::selectOpenFile);
+ connect(m_ui->openFileButton2, &QPushButton::clicked, this, &MainWindow::selectCompareToFile);
#endif
setupStacks();
}
#ifdef NO_K_LIB
+static void selectFile(QWidget *parent, QLineEdit *fileNameEdit)
+{
+ QString fileName = QFileDialog::getOpenFileName(parent, "Select Data File",
+ "", "GZ (*.gz);; All files (*)");
+ if (!fileName.isEmpty())
+ {
+ fileNameEdit->setText(fileName);
+ }
+}
+
+void MainWindow::selectOpenFile()
+{
+ selectFile(this, m_ui->openFileEdit);
+}
+
+void MainWindow::selectCompareToFile()
+{
+ selectFile(this, m_ui->compareToEdit);
+}
+
void MainWindow::about()
{
AboutDialog dlg(this);
<string>Open Heaptrack Data</string>
</property>
<layout class="QFormLayout" name="formLayout">
- <item row="1" column="1">
- <widget class="QLineEdit" name="openFile">
- <property name="toolTip">
- <string><qt><p>This field specifies the primary heaptrack data file. These files are called <tt>heaptrack.$APP.$PID.gz</tt>. You can produce such a file by profiling your application, e.g. via:</p>
-<pre><code>heaptrack &lt;yourapplication&gt; ...</code></pre>
-<p>Or, alternatively, you can attach to a running process via</p>
-<pre><code>heaptrack --pid $(pidof &lt;yourapplication&gt;)</code></pre></qt></string>
- </property>
- <property name="text">
- <string>heaptrack.*.*.gz (PLEASE ENTER path/to/heaptrack.$APP.$PID.gz)</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLineEdit" name="compareTo">
- <property name="toolTip">
- <string><qt>You can optionally specify a second heaptrack data file to compare to. If set, this file will be used as a base and its cost gets subtracted from the primary data costs.</qt></string>
- </property>
- <property name="text">
- <string>heaptrack.*.*.gz (PLEASE ENTER path/to/heaptrack.$APP.$PID.gz) [OPTIONAL]</string>
- </property>
- </widget>
- </item>
<item row="1" column="0">
<widget class="QLabel" name="openFileLabel">
<property name="text">
<string>Profile &Data:</string>
</property>
<property name="buddy">
- <cstring>openFile</cstring>
+ <cstring>openFileEdit</cstring>
</property>
</widget>
</item>
+ <item row="1" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_1">
+ <item>
+ <widget class="QLineEdit" name="openFileEdit">
+ <property name="toolTip">
+ <string><qt><p>This field specifies the primary heaptrack data file. These files are called <tt>heaptrack.$APP.$PID.gz</tt>. You can produce such a file by profiling your application, e.g. via:</p>
+ <pre><code>heaptrack &lt;yourapplication&gt; ...</code></pre>
+ <p>Or, alternatively, you can attach to a running process via</p>
+ <pre><code>heaptrack --pid $(pidof &lt;yourapplication&gt;)</code></pre></qt></string>
+ </property>
+ <property name="text">
+ <string>heaptrack.*.*.gz (PLEASE ENTER OR SELECT path/to/heaptrack.$APP.$PID.gz)</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="openFileButton1">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="gui.qrc">
+ <normaloff>:/icons/fileopen.png</normaloff>:/icons/fileopen.png</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
<item row="2" column="0">
<widget class="QLabel" name="compareToLabel">
<property name="text">
<string>Compare to:</string>
</property>
<property name="buddy">
- <cstring>compareTo</cstring>
+ <cstring>compareToEdit</cstring>
</property>
</widget>
</item>
+ <item row="2" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_8">
+ <item>
+ <widget class="QLineEdit" name="compareToEdit">
+ <property name="toolTip">
+ <string><qt>You can optionally specify a second heaptrack data file to compare to. If set, this file will be used as a base and its cost gets subtracted from the primary data costs.</qt></string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="openFileButton2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="icon">
+ <iconset resource="gui.qrc">
+ <normaloff>:/icons/fileopen.png</normaloff>:/icons/fileopen.png</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
</layout>
</widget>
</item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QWidget" name="widget" native="true">
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="spacing">
<number>6</number>
</property>
<container>1</container>
</customwidget>
</customwidgets>
- <resources/>
+ <resources>
+ <include location="gui.qrc"/>
+ </resources>
<connections/>
</ui>