aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/logview/LogViewWindow.h
diff options
context:
space:
mode:
authorGravatar Chris MacLeod2023-08-05 04:39:01 -0400
committerGravatar GitHub2023-08-05 10:39:01 +0200
commit2b021749ce4dc3ec8e160a5800e323f7a45047db (patch)
treef81f7365808ca2c02efb847d7a3b61aad901ea4b /src/modules/logview/LogViewWindow.h
parentkernel: We should read the default config on startup (bis) (#2548) (diff)
downloadKVIrc-2b021749ce4dc3ec8e160a5800e323f7a45047db.tar.gz
KVIrc-2b021749ce4dc3ec8e160a5800e323f7a45047db.tar.bz2
KVIrc-2b021749ce4dc3ec8e160a5800e323f7a45047db.zip
Batch export logs (#2485)
* Implement most basic functional batch export For the future: * The loop still needs to be made asynchronous so the process doesn't hang. * Ideally, there should be some sort of progress window. * There is redundant code that should be reduced. * Make batch export asynchronous Reminder: The comment about overwrite protection no longer applies Todo: Progress dialog * Avoid possible dangling pointer, improve type safety and const correctness in the process In reality, the log exporting code has no reason to be in the GUI class to begin with. `exportLog` makes sense as a Qt slot, but `createLog` should be a member function of the `LogFile` class and operate on `this` rather than a `LogFile` argument. A future commit should amend this, but for now I will avoid changing anything unnecessary until a working progress dialog is in place and I have tested the finished feature thoroughly. * Add progress dialog * Make LogViewWindow::createLog a member function of LogFile * Reduce memory usage by sharing `LogFile`s with the GUI thread * Correct progress dialog modality * Collect log files directly instead of reiterating through view items later Also adds a little documentation * Fix batch export for paths with reserved characters * avoid sigsegv * fix tags removal before nickname in html export * Fix directory selection and output path for icons in html export --------- Co-authored-by: ctrlaltca <ctrlaltca@gmail.com>
Diffstat (limited to 'src/modules/logview/LogViewWindow.h')
-rw-r--r--src/modules/logview/LogViewWindow.h19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/modules/logview/LogViewWindow.h b/src/modules/logview/LogViewWindow.h
index b90866b39..fb479a726 100644
--- a/src/modules/logview/LogViewWindow.h
+++ b/src/modules/logview/LogViewWindow.h
@@ -36,6 +36,8 @@
#include "KviPointerList.h"
#include <QTreeWidget>
+#include <vector>
+#include <memory>
class KviLogViewWidget;
class LogListViewItem;
@@ -52,7 +54,7 @@ class LogViewListView : public QTreeWidget
Q_OBJECT
public:
LogViewListView(QWidget *);
- ~LogViewListView(){};
+ ~LogViewListView() {};
protected:
void mousePressEvent(QMouseEvent * pEvent) override;
@@ -68,7 +70,8 @@ public:
~LogViewWindow();
protected:
- KviPointerList<LogFile> m_logList;
+ std::vector<std::shared_ptr<LogFile>> m_logList;
+ std::vector<std::shared_ptr<LogFile>>::const_iterator m_currentLog;
LogViewListView * m_pListView;
@@ -104,18 +107,8 @@ protected:
QTimer * m_pTimer;
QMenu * m_pExportLogPopup;
-public:
- /**
- * \brief Exports the log and creates the file in the selected format
- * \param pLog The log file associated with the item selected in the popup
- * \param iId The id of the item in the popup
- * \param pszFile The buffer to store the exported log name
- * \return void
- */
- void createLog(LogFile * pLog, int iId, QString * pszFile = nullptr);
-
protected:
- void exportLog(int iId);
+ void exportLog(LogFile::ExportType exportType);
void recurseDirectory(const QString & szDir);
void setupItemList();