gui: mainwindow: Add button to save log of failed paths

Este commit está contenido en:
Albert S. 2022-06-23 15:27:13 +02:00
padre 780318db6d
commit 9c41d531b0
Se han modificado 3 ficheros con 151 adiciones y 13 borrados

Ver fichero

@ -82,6 +82,12 @@ MainWindow::MainWindow(QWidget *parent, QString socketPath)
ui->spinPreviewPage->setValue(1);
ui->spinPreviewPage->setMinimum(1);
ui->btnOpenFailed->setVisible(false);
auto policy = ui->btnOpenFailed->sizePolicy();
policy.setRetainSizeWhenHidden(true);
ui->btnOpenFailed->setSizePolicy(policy);
}
void MainWindow::addPathToIndex()
@ -210,6 +216,32 @@ void MainWindow::connectSignals()
connect(this, &MainWindow::beginIndexSync, indexSyncer, &IndexSyncer::sync);
connect(&this->progressDialog, &QProgressDialog::canceled, indexSyncer, &IndexSyncer::cancel);
connect(ui->btnSaveSettings, &QPushButton::clicked, this, &MainWindow::saveSettings);
connect(ui->btnOpenFailed, &QPushButton::clicked, this, &MainWindow::exportFailedPaths);
}
void MainWindow::exportFailedPaths()
{
QString filename =
QString("/tmp/looqs_indexresult_failed_%1").arg(QDateTime::currentDateTime().toString("yyyy-MM-dd_hhmmss"));
QFile outFile(filename);
if(!outFile.open(QIODevice::WriteOnly | QIODevice::Text))
{
QMessageBox::critical(this, "Failed to write log file", "An error occured while trying to create log file");
return;
}
QTextStream stream(&outFile);
IndexResult result = this->indexer->getResult();
stream << "Failed to index the following paths:\n";
for(FileScanResult &fsr : result.failedResults())
{
stream << fsr.first << " " << SaveFileResultToString(fsr.second) << '\n';
}
QDesktopServices::openUrl(filename);
}
void MainWindow::startIndexSync()
@ -254,6 +286,7 @@ void MainWindow::startIndexing()
ui->txtSearch->setEnabled(false);
ui->previewProcessBar->setValue(0);
ui->previewProcessBar->setVisible(true);
ui->btnOpenFailed->setVisible(false);
QVector<QString> paths;
QStringList pathSettingsValue;
@ -289,6 +322,10 @@ void MainWindow::finishIndexing()
ui->settingsTab->setEnabled(true);
ui->txtPathScanAdd->setEnabled(true);
ui->txtSearch->setEnabled(true);
if(result.erroredPaths > 0)
{
ui->btnOpenFailed->setVisible(true);
}
}
void MainWindow::comboScaleChanged(int i)

Ver fichero

@ -75,6 +75,7 @@ class MainWindow : public QMainWindow
void addPathToIndex();
void startIndexSync();
void saveSettings();
void exportFailedPaths();
signals:
void startIpcPreviews(RenderConfig config, const QVector<RenderTarget> &targets);

Ver fichero

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1280</width>
<height>736</height>
<height>855</height>
</rect>
</property>
<property name="windowTitle">
@ -27,7 +27,7 @@
<enum>QTabWidget::South</enum>
</property>
<property name="currentIndex">
<number>3</number>
<number>2</number>
</property>
<widget class="QWidget" name="resultsTab">
<attribute name="title">
@ -82,7 +82,7 @@
<x>0</x>
<y>0</y>
<width>1244</width>
<height>446</height>
<height>565</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout"/>
@ -184,6 +184,16 @@
<string>Index</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="6" column="0">
<widget class="QLineEdit" name="txtIgnorePatterns"/>
</item>
<item row="11" column="0">
<widget class="QPushButton" name="btnStartIndexing">
<property name="text">
<string>Start indexing</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBoxPaths">
<property name="title">
@ -243,6 +253,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="lblPathsFound">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Paths found:</string>
</property>
@ -250,17 +266,42 @@
</item>
<item>
<widget class="QLabel" name="lblPathsFoundValue">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="lblAdded">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>50</weight>
@ -274,17 +315,42 @@
</item>
<item>
<widget class="QLabel" name="lblAddedValue">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="lblSkipped">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>50</weight>
@ -298,17 +364,42 @@
</item>
<item>
<widget class="QLabel" name="lblSkippedValue">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="lblFailed">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>50</weight>
@ -322,26 +413,35 @@
</item>
<item>
<widget class="QLabel" name="lblFailedValue">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnOpenFailed">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Open log of failed paths</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="6" column="0">
<widget class="QLineEdit" name="txtIgnorePatterns"/>
</item>
<item row="10" column="0">
<widget class="QPushButton" name="btnStartIndexing">
<property name="text">
<string>Start indexing</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="settingsTab">