temporarydata.h 3.44 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
/*
Copyright (C) 2016  Jean-Baptiste Mardelle <jb@kdenlive.org>
This file is part of Kdenlive. See www.kdenlive.org.

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) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy 
defined in Section 14 of version 3 of the license.

This program 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 General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef TEMPORARYDATA_H
#define TEMPORARYDATA_H

#include "definitions.h"

27
#include <QWidget>
28
#include <QDir>
29 30 31 32 33 34

class KdenliveDoc;
class KJob;
class QPaintEvent;
class QLabel;
class QGridLayout;
35
class QTreeWidget;
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

/**
 * @class ChartWidget
 * @brief Chart drawing widget.
 *
 */
class ChartWidget : public QWidget
{
public:
    explicit ChartWidget(QWidget *parent = 0);
    void setSegments(QList <int> segments);

protected:
    void paintEvent(QPaintEvent *event);

private:
    QList <int> m_segments;
};

55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78

/**
 * @class TreeWidgetItem
 * @brief Manage custom sort order for size.
 *
 */

class TreeWidgetItem : public QTreeWidgetItem {
  public:
  TreeWidgetItem(QTreeWidget* parent):QTreeWidgetItem(parent){}
  private:
  bool operator<(const QTreeWidgetItem &other)const {
     int column = treeWidget()->sortColumn();
     switch (column) {
         case 0:
            return text(column).toLower() < other.text(column).toLower();
            break;
         default:
            return data(column, Qt::UserRole) < other.data(column, Qt::UserRole);
            break;
     }
  }
};

79 80 81 82 83 84
/**
 * @class TemporaryData
 * @brief Dialog allowing management of project's temporary data.
 *
 */

85
class TemporaryData : public QWidget
86 87 88 89 90 91 92 93 94
{
    Q_OBJECT

public:
    explicit TemporaryData(KdenliveDoc *doc, bool currentProjectOnly, QWidget * parent = 0);

private:
    KdenliveDoc *m_doc;
    ChartWidget *m_currentPie;
95
    ChartWidget *m_globalPie;
96 97 98 99 100
    QLabel *m_previewSize;
    QLabel *m_proxySize;
    QLabel *m_audioSize;
    QLabel *m_thumbSize;
    QLabel *m_currentSize;
101 102
    QLabel *m_globalSize;
    QLabel *m_selectedSize;
103
    QWidget *m_currentPage;
104 105
    QWidget *m_globalPage;
    QTreeWidget *m_listWidget;
106 107
    QGridLayout *m_grid;
    qulonglong m_totalCurrent;
108
    qulonglong m_totalGlobal;
109
    QList <qulonglong> mCurrentSizes;
110 111 112 113
    QList <qulonglong> mGlobalSizes;
    QStringList m_globalDirectories;
    QString m_processingDirectory;
    QDir m_globalDir;
114
    void updateDataInfo();
115
    void updateGlobalInfo();
116
    void updateTotal();
117 118
    void buildGlobalCacheDialog(int minHeight);
    void processglobalDirectories();
119 120 121 122 123 124

private slots:
    void gotPreviewSize(KJob *job);
    void gotProxySize(KJob *job);
    void gotAudioSize(KJob *job);
    void gotThumbSize(KJob *job);
125 126
    void gotFolderSize(KJob *job);
    void refreshGlobalPie();
127 128 129 130 131
    void deletePreview();
    void deleteProxy();
    void deleteAudio();
    void deleteThumbs();
    void deleteAll();
132
    void openCacheFolder();
133
    void deleteSelected();
134 135 136 137

signals:
    void disableProxies();
    void disablePreview();
138 139 140
};

#endif