Converted LocalImportPage to designer file
This commit is contained in:
@@ -76,7 +76,8 @@ FORMS += \
|
||||
wizard/databasepage.ui \
|
||||
dialogs/graphdialog.ui \
|
||||
wizard/tablespage.ui \
|
||||
wizard/importtypepage.ui
|
||||
wizard/importtypepage.ui \
|
||||
wizard/localimportpage.ui
|
||||
|
||||
RESOURCES += \
|
||||
resources.qrc
|
||||
|
@@ -20,10 +20,22 @@
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="FileSelectionWidget" name="fileSelectionWidget" native="true"/>
|
||||
</item>
|
||||
@@ -44,6 +56,18 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="lineEditUsername"/>
|
||||
</item>
|
||||
@@ -55,6 +79,9 @@
|
||||
<property name="text">
|
||||
<string><b>Hostname:</b></string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditHostname</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
@@ -62,6 +89,9 @@
|
||||
<property name="text">
|
||||
<string><b>Username:</b></string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditUsername</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
@@ -69,6 +99,9 @@
|
||||
<property name="text">
|
||||
<string><b>Password:</b></string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditPassword</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
@@ -76,6 +109,9 @@
|
||||
<property name="text">
|
||||
<string><b>Database:</b></string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditDatabase</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
@@ -102,6 +138,13 @@
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>comboBox</tabstop>
|
||||
<tabstop>lineEditHostname</tabstop>
|
||||
<tabstop>lineEditUsername</tabstop>
|
||||
<tabstop>lineEditPassword</tabstop>
|
||||
<tabstop>lineEditDatabase</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
|
@@ -9,6 +9,7 @@ namespace Ui { class FileSelectionWidget; }
|
||||
class FileSelectionWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged USER true)
|
||||
|
||||
public:
|
||||
enum class Mode {
|
||||
|
@@ -14,6 +14,18 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
|
@@ -19,7 +19,7 @@
|
||||
<property name="subTitle">
|
||||
<string>Please select which type of log files you would like to import.</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1,0,1">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonLocal">
|
||||
<property name="text">
|
||||
@@ -37,6 +37,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="FileSelectionWidget" name="fileSelectionWidget" native="true"/>
|
||||
</item>
|
||||
|
@@ -1,64 +1,33 @@
|
||||
#include "localimportpage.h"
|
||||
#include "ui_localimportpage.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QFormLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QHostInfo>
|
||||
#include <QDateEdit>
|
||||
#include <QComboBox>
|
||||
#include <QListView>
|
||||
#include <QLabel>
|
||||
#include <QDate>
|
||||
#include <QMessageBox>
|
||||
#include <QStringBuilder>
|
||||
|
||||
#include "importwizard.h"
|
||||
|
||||
LocalImportPage::LocalImportPage(QWidget *parent) :
|
||||
QWizardPage(parent)
|
||||
QWizardPage(parent),
|
||||
m_ui(std::make_unique<Ui::LocalImportPage>())
|
||||
{
|
||||
setTitle(tr("Local Import"));
|
||||
setSubTitle(tr("TODO..."));
|
||||
m_ui->setupUi(this);
|
||||
|
||||
setCommitPage(true);
|
||||
|
||||
m_ui->lineEditHost->setText(QHostInfo::localHostName());
|
||||
m_ui->dateEdit->setDate(QDate::currentDate());
|
||||
m_ui->comboBoxTimestamp->addItem(tr("Without milliseconds"), "HH:mm:ss");
|
||||
m_ui->comboBoxTimestamp->addItem(tr("With milliseconds"), "HH:mm:ss.zzz");
|
||||
|
||||
m_ui->listView->setModel(&m_model);
|
||||
|
||||
connect(&m_model, &ChecklistModel::dataChanged, this, &LocalImportPage::updateSummary);
|
||||
|
||||
auto layout = new QVBoxLayout;
|
||||
|
||||
{
|
||||
auto hboxLayout = new QHBoxLayout;
|
||||
|
||||
{
|
||||
auto formLayout = new QFormLayout;
|
||||
|
||||
m_lineEditHost = new QLineEdit(QHostInfo::localHostName());
|
||||
formLayout->addRow(tr("Host:"), m_lineEditHost);
|
||||
|
||||
m_dateEdit = new QDateEdit(QDate::currentDate());
|
||||
formLayout->addRow(tr("Date:"), m_dateEdit);
|
||||
|
||||
m_comboBox = new QComboBox;
|
||||
m_comboBox->addItem(tr("Without milliseconds"), "HH:mm:ss");
|
||||
m_comboBox->addItem(tr("With milliseconds"), "HH:mm:ss.zzz");
|
||||
formLayout->addRow(tr("Timestamp:"), m_comboBox);
|
||||
|
||||
hboxLayout->addLayout(formLayout);
|
||||
}
|
||||
|
||||
{
|
||||
auto view = new QListView;
|
||||
view->setModel(&m_model);
|
||||
hboxLayout->addWidget(view, 1);
|
||||
}
|
||||
|
||||
layout->addLayout(hboxLayout, 1);
|
||||
}
|
||||
|
||||
m_labelSummary = new QLabel;
|
||||
layout->addWidget(m_labelSummary);
|
||||
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
LocalImportPage::~LocalImportPage() = default;
|
||||
|
||||
int LocalImportPage::nextId() const
|
||||
{
|
||||
return int(ImportWizard::Pages::ImportProgress);
|
||||
@@ -99,14 +68,14 @@ bool LocalImportPage::validatePage()
|
||||
|
||||
const auto logfile = dates.values().first();
|
||||
dates.clear();
|
||||
dates.insert(m_dateEdit->date(), logfile);
|
||||
dates.insert(m_ui->dateEdit->date(), logfile);
|
||||
}
|
||||
|
||||
result.clear();
|
||||
result.insert(m_lineEditHost->text(), host);
|
||||
result.insert(m_ui->lineEditHost->text(), host);
|
||||
|
||||
wizard()->setProperty("result", QVariant::fromValue(result));
|
||||
wizard()->setProperty("timeFormat", m_comboBox->currentData().toString());
|
||||
wizard()->setProperty("timeFormat", m_ui->comboBoxTimestamp->currentData().toString());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -139,7 +108,7 @@ void LocalImportPage::updateSummary()
|
||||
}
|
||||
}
|
||||
|
||||
m_labelSummary->setText(tr("Filters match %0 files (%1B)").arg(logFiles).arg(sizeStr));
|
||||
m_ui->labelSummary->setText(tr("Filters match %0 files (%1B)").arg(logFiles).arg(sizeStr));
|
||||
}
|
||||
|
||||
ScanResult LocalImportPage::filterResult(ScanResult result) const
|
||||
|
@@ -2,13 +2,12 @@
|
||||
|
||||
#include <QWizardPage>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "models/checklistmodel.h"
|
||||
#include "common.h"
|
||||
|
||||
class QLineEdit;
|
||||
class QDateEdit;
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
namespace Ui { class LocalImportPage; }
|
||||
|
||||
class LocalImportPage : public QWizardPage
|
||||
{
|
||||
@@ -16,6 +15,7 @@ class LocalImportPage : public QWizardPage
|
||||
|
||||
public:
|
||||
explicit LocalImportPage(QWidget *parent = nullptr);
|
||||
~LocalImportPage() override;
|
||||
|
||||
int nextId() const override;
|
||||
|
||||
@@ -26,14 +26,11 @@ private slots:
|
||||
void updateSummary();
|
||||
|
||||
private:
|
||||
const std::unique_ptr<Ui::LocalImportPage> m_ui;
|
||||
|
||||
ScanResult filterResult(ScanResult result) const;
|
||||
|
||||
ScanResult m_result;
|
||||
|
||||
ChecklistModel m_model;
|
||||
|
||||
QLineEdit *m_lineEditHost;
|
||||
QDateEdit *m_dateEdit;
|
||||
QComboBox *m_comboBox;
|
||||
QLabel *m_labelSummary;
|
||||
};
|
||||
|
80
wizard/localimportpage.ui
Normal file
80
wizard/localimportpage.ui
Normal file
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LocalImportPage</class>
|
||||
<widget class="QWizardPage" name="LocalImportPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>WizardPage</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Local Import</string>
|
||||
</property>
|
||||
<property name="subTitle">
|
||||
<string>TODO...</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,0">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelHost">
|
||||
<property name="text">
|
||||
<string>Host:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditHost</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="lineEditHost"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelDate">
|
||||
<property name="text">
|
||||
<string>Date:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>dateEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDateEdit" name="dateEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelTimestamp">
|
||||
<property name="text">
|
||||
<string>Timestamp:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>comboBoxTimestamp</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxTimestamp"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListView" name="listView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelSummary"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -52,7 +52,7 @@ void RemoteImportScanPage::initializePage()
|
||||
|
||||
m_logView->clear();
|
||||
|
||||
m_thread = std::make_unique<RemoteScannerThread>(field("folder").toString(), this);
|
||||
m_thread = std::make_unique<RemoteScannerThread>(wizard()->property("folder").toString(), this);
|
||||
|
||||
connect(m_thread.get(), &RemoteScannerThread::progressUpdate, this, &RemoteImportScanPage::progressUpdate);
|
||||
connect(m_thread.get(), &RemoteScannerThread::logMessage, this, &RemoteImportScanPage::logMessage);
|
||||
|
Reference in New Issue
Block a user