propertiesdialog.h 2.25 KB
Newer Older
Albert Astals Cid's avatar
Albert Astals Cid committed
1
/***************************************************************************
Albert Astals Cid's avatar
Albert Astals Cid committed
2
 *   Copyright (C) 2004 by Albert Astals Cid <aacid@kde.org>               *
Albert Astals Cid's avatar
Albert Astals Cid committed
3 4 5 6 7 8 9 10 11 12
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/

#ifndef _PROPERTIESDIALOG_H_
#define _PROPERTIESDIALOG_H_

13 14 15
#include <qabstractitemmodel.h>
#include <qlist.h>

16
#include <kpagedialog.h>
Albert Astals Cid's avatar
Albert Astals Cid committed
17

18 19 20 21 22 23
#include "core/fontinfo.h"

class QLabel;
class QProgressBar;
class FontsListModel;

24 25 26
namespace Okular {
class Document;
}
Albert Astals Cid's avatar
Albert Astals Cid committed
27

28
class PropertiesDialog : public KPageDialog
Albert Astals Cid's avatar
Albert Astals Cid committed
29
{
30 31
    Q_OBJECT

Albert Astals Cid's avatar
Albert Astals Cid committed
32
  public:
33
        PropertiesDialog( QWidget *parent, Okular::Document *doc );
34
        ~PropertiesDialog() override;
Albert Astals Cid's avatar
Albert Astals Cid committed
35

36
    private Q_SLOTS:
37 38 39 40
        void pageChanged( KPageWidgetItem *, KPageWidgetItem * );
        void slotFontReadingProgress( int page );
        void slotFontReadingEnded();
        void reallyStartFontReading();
41
        void showFontsMenu(const QPoint pos);
42 43 44 45 46 47 48 49 50

    private:
        Okular::Document * m_document;
        KPageWidgetItem * m_fontPage;
        FontsListModel * m_fontModel;
        QLabel * m_fontInfo;
        QProgressBar * m_fontProgressBar;
        bool m_fontScanStarted;
};
51 52 53 54 55 56 57

class FontsListModel
  : public QAbstractTableModel
{
  Q_OBJECT

  public:
Yuri Chornoivan's avatar
Yuri Chornoivan committed
58
    explicit FontsListModel( QObject * parent = nullptr );
59
    ~FontsListModel() override;
60 61

    // reimplementations from QAbstractTableModel
62 63 64 65
    int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
    QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
    QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
    int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
66

67
  public Q_SLOTS:
68 69
    void addFont( const Okular::FontInfo &fi );

70
  private:
71
    QList<Okular::FontInfo> m_fonts;
72 73
};

Albert Astals Cid's avatar
Albert Astals Cid committed
74
#endif
75 76

/* kate: replace-tabs on; indent-width 4; */