2021-10-02 15:57:07 +02:00
|
|
|
// Copyright (C) 2021 Jakub Melka
|
|
|
|
//
|
|
|
|
// This file is part of PDF4QT.
|
|
|
|
//
|
|
|
|
// PDF4QT is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// with the written consent of the copyright owner, any later version.
|
|
|
|
//
|
|
|
|
// PDF4QT is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#ifndef DIFFERENCESDOCKWIDGET_H
|
|
|
|
#define DIFFERENCESDOCKWIDGET_H
|
|
|
|
|
2021-10-02 19:30:18 +02:00
|
|
|
#include "settings.h"
|
|
|
|
|
2021-10-02 15:57:07 +02:00
|
|
|
#include <QDockWidget>
|
|
|
|
#include <QItemDelegate>
|
|
|
|
|
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class DifferencesDockWidget;
|
|
|
|
}
|
|
|
|
|
2021-10-03 17:16:12 +02:00
|
|
|
class QTreeWidgetItem;
|
|
|
|
|
2021-10-02 15:57:07 +02:00
|
|
|
namespace pdf
|
|
|
|
{
|
|
|
|
class PDFDiffResult;
|
|
|
|
class PDFDiffResultNavigator;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace pdfdocdiff
|
|
|
|
{
|
|
|
|
|
|
|
|
class DifferenceItemDelegate : public QItemDelegate
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
using BaseClass = QItemDelegate;
|
|
|
|
|
|
|
|
public:
|
|
|
|
DifferenceItemDelegate(QObject* parent);
|
|
|
|
|
|
|
|
virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
|
|
|
virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class DifferencesDockWidget : public QDockWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2021-10-02 19:30:18 +02:00
|
|
|
explicit DifferencesDockWidget(QWidget* parent,
|
2021-10-09 18:13:34 +02:00
|
|
|
pdf::PDFDiffResult* unfilteredDiffResult,
|
2021-10-02 19:30:18 +02:00
|
|
|
pdf::PDFDiffResult* diffResult,
|
|
|
|
pdf::PDFDiffResultNavigator* diffNavigator,
|
|
|
|
Settings* settings);
|
2021-10-02 15:57:07 +02:00
|
|
|
virtual ~DifferencesDockWidget() override;
|
|
|
|
|
|
|
|
void update();
|
|
|
|
|
2021-10-03 17:16:12 +02:00
|
|
|
private slots:
|
|
|
|
void onSelectionChanged(size_t currentIndex);
|
|
|
|
void onCurrentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
|
|
|
|
|
2021-10-02 15:57:07 +02:00
|
|
|
private:
|
|
|
|
Ui::DifferencesDockWidget* ui;
|
|
|
|
|
2021-10-02 19:30:18 +02:00
|
|
|
QColor getColorForIndex(size_t index) const;
|
2021-10-03 17:16:12 +02:00
|
|
|
QModelIndex findResultIndex(size_t index) const;
|
2021-10-02 19:30:18 +02:00
|
|
|
|
2021-10-09 18:13:34 +02:00
|
|
|
pdf::PDFDiffResult* m_unfilteredDiffResult;
|
2021-10-02 15:57:07 +02:00
|
|
|
pdf::PDFDiffResult* m_diffResult;
|
|
|
|
pdf::PDFDiffResultNavigator* m_diffNavigator;
|
2021-10-02 19:30:18 +02:00
|
|
|
Settings* m_settings;
|
2021-10-03 17:16:12 +02:00
|
|
|
bool m_disableChangeSelectedResultIndex;
|
2021-10-02 15:57:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace pdfdocdiff
|
|
|
|
|
|
|
|
#endif // DIFFERENCESDOCKWIDGET_H
|