PDF4QT/Pdf4QtDiff/differencesdockwidget.h

90 lines
2.5 KiB
C
Raw Normal View History

// 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/>.
2024-03-16 17:02:44 +01:00
#ifndef PDFDIFF_DIFFERENCESDOCKWIDGET_H
#define PDFDIFF_DIFFERENCESDOCKWIDGET_H
2021-10-02 19:30:18 +02:00
#include "settings.h"
#include <QDockWidget>
#include <QItemDelegate>
namespace Ui
{
class DifferencesDockWidget;
}
class QTreeWidgetItem;
namespace pdf
{
class PDFDiffResult;
class PDFDiffResultNavigator;
}
2024-03-16 17:02:44 +01:00
namespace pdfdiff
{
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);
virtual ~DifferencesDockWidget() override;
void update();
private slots:
void onSelectionChanged(size_t currentIndex);
void onCurrentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
private:
Ui::DifferencesDockWidget* ui;
2021-10-02 19:30:18 +02:00
QColor getColorForIndex(size_t index) const;
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;
pdf::PDFDiffResult* m_diffResult;
pdf::PDFDiffResultNavigator* m_diffNavigator;
2021-10-02 19:30:18 +02:00
Settings* m_settings;
bool m_disableChangeSelectedResultIndex;
};
2024-03-16 17:02:44 +01:00
} // namespace pdfdiff
2024-03-16 17:02:44 +01:00
#endif // PDFDIFF_DIFFERENCESDOCKWIDGET_H