diff --git a/loganalyzer.pro b/loganalyzer.pro index 094d0e9..26a422b 100644 --- a/loganalyzer.pro +++ b/loganalyzer.pro @@ -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 diff --git a/widgets/databasewidget.ui b/widgets/databasewidget.ui index d9e9e4f..c7cb6e6 100644 --- a/widgets/databasewidget.ui +++ b/widgets/databasewidget.ui @@ -20,10 +20,22 @@ - 0 + 1 - + + + 0 + + + 0 + + + 0 + + + 0 + @@ -44,6 +56,18 @@ + + 0 + + + 0 + + + 0 + + + 0 + @@ -55,6 +79,9 @@ <b>Hostname:</b> + + lineEditHostname + @@ -62,6 +89,9 @@ <b>Username:</b> + + lineEditUsername + @@ -69,6 +99,9 @@ <b>Password:</b> + + lineEditPassword + @@ -76,6 +109,9 @@ <b>Database:</b> + + lineEditDatabase + @@ -102,6 +138,13 @@ 1 + + comboBox + lineEditHostname + lineEditUsername + lineEditPassword + lineEditDatabase + diff --git a/widgets/fileselectionwidget.h b/widgets/fileselectionwidget.h index 320fbfa..2f63149 100644 --- a/widgets/fileselectionwidget.h +++ b/widgets/fileselectionwidget.h @@ -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 { diff --git a/widgets/fileselectionwidget.ui b/widgets/fileselectionwidget.ui index bf2b6e5..e2abf64 100644 --- a/widgets/fileselectionwidget.ui +++ b/widgets/fileselectionwidget.ui @@ -14,6 +14,18 @@ Form + + 0 + + + 0 + + + 0 + + + 0 + diff --git a/wizard/importtypepage.ui b/wizard/importtypepage.ui index 7ecc5f9..3f2040b 100644 --- a/wizard/importtypepage.ui +++ b/wizard/importtypepage.ui @@ -19,7 +19,7 @@ Please select which type of log files you would like to import. - + @@ -37,6 +37,19 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + diff --git a/wizard/localimportpage.cpp b/wizard/localimportpage.cpp index 52a6cd3..36e8ae0 100644 --- a/wizard/localimportpage.cpp +++ b/wizard/localimportpage.cpp @@ -1,64 +1,33 @@ #include "localimportpage.h" +#include "ui_localimportpage.h" -#include -#include -#include #include -#include -#include -#include -#include +#include #include #include #include "importwizard.h" LocalImportPage::LocalImportPage(QWidget *parent) : - QWizardPage(parent) + QWizardPage(parent), + m_ui(std::make_unique()) { - 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 diff --git a/wizard/localimportpage.h b/wizard/localimportpage.h index cd1718f..c456818 100644 --- a/wizard/localimportpage.h +++ b/wizard/localimportpage.h @@ -2,13 +2,12 @@ #include +#include + #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 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; }; diff --git a/wizard/localimportpage.ui b/wizard/localimportpage.ui new file mode 100644 index 0000000..dd25413 --- /dev/null +++ b/wizard/localimportpage.ui @@ -0,0 +1,80 @@ + + + LocalImportPage + + + + 0 + 0 + 400 + 300 + + + + WizardPage + + + Local Import + + + TODO... + + + + + + + + + + Host: + + + lineEditHost + + + + + + + + + + Date: + + + dateEdit + + + + + + + + + + Timestamp: + + + comboBoxTimestamp + + + + + + + + + + + + + + + + + + + + + diff --git a/wizard/remoteimportscanpage.cpp b/wizard/remoteimportscanpage.cpp index 6c0b981..088a14c 100644 --- a/wizard/remoteimportscanpage.cpp +++ b/wizard/remoteimportscanpage.cpp @@ -52,7 +52,7 @@ void RemoteImportScanPage::initializePage() m_logView->clear(); - m_thread = std::make_unique(field("folder").toString(), this); + m_thread = std::make_unique(wizard()->property("folder").toString(), this); connect(m_thread.get(), &RemoteScannerThread::progressUpdate, this, &RemoteImportScanPage::progressUpdate); connect(m_thread.get(), &RemoteScannerThread::logMessage, this, &RemoteImportScanPage::logMessage);