diff options
| author | 2023-08-05 04:39:01 -0400 | |
|---|---|---|
| committer | 2023-08-05 10:39:01 +0200 | |
| commit | 2b021749ce4dc3ec8e160a5800e323f7a45047db (patch) | |
| tree | f81f7365808ca2c02efb847d7a3b61aad901ea4b /src/modules/logview/LogViewWidget.h | |
| parent | kernel: We should read the default config on startup (bis) (#2548) (diff) | |
| download | KVIrc-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/LogViewWidget.h')
| -rw-r--r-- | src/modules/logview/LogViewWidget.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/modules/logview/LogViewWidget.h b/src/modules/logview/LogViewWidget.h index 9092dae84..203d05d90 100644 --- a/src/modules/logview/LogViewWidget.h +++ b/src/modules/logview/LogViewWidget.h @@ -31,19 +31,21 @@ #include <QTreeWidget> +#include <memory> + class LogListViewItem : public QTreeWidgetItem { public: - LogListViewItem(QTreeWidgetItem * pPar, LogFile::Type eType, LogFile * pLog); - LogListViewItem(QTreeWidget * pPar, LogFile::Type eType, LogFile * pLog); - ~LogListViewItem(){}; + LogListViewItem(QTreeWidgetItem * pPar, LogFile::Type eType, std::shared_ptr<LogFile> pLog); + LogListViewItem(QTreeWidget * pPar, LogFile::Type eType, std::shared_ptr<LogFile> pLog); + ~LogListViewItem() {}; public: LogFile::Type m_eType; - LogFile * m_pFileData; + std::shared_ptr<LogFile> m_pFileData; public: - LogFile * log() { return m_pFileData; }; + std::weak_ptr<LogFile> log() { return m_pFileData; }; virtual QString fileName() const { return QString(); }; }; @@ -51,7 +53,7 @@ class LogListViewItemFolder : public LogListViewItem { public: LogListViewItemFolder(QTreeWidgetItem * pPar, const QString & szLabel); - ~LogListViewItemFolder(){}; + ~LogListViewItemFolder() {}; public: }; @@ -60,15 +62,16 @@ class LogListViewItemType : public LogListViewItem { public: LogListViewItemType(QTreeWidget * pPar, LogFile::Type eType); - ~LogListViewItemType(){}; + ~LogListViewItemType() {}; }; class LogListViewLog : public LogListViewItem { public: - LogListViewLog(QTreeWidgetItem * pPar, LogFile::Type eType, LogFile * pLog); - ~LogListViewLog(){}; + LogListViewLog(QTreeWidgetItem * pPar, LogFile::Type eType, std::shared_ptr<LogFile> pLog); + ~LogListViewLog() {}; virtual QString fileName() const { return m_pFileData->fileName(); }; + protected: bool operator<(const QTreeWidgetItem & other) const { |
