summaryrefslogtreecommitdiffstats
path: root/src/libs/widgets/metadata/metadatawidget.h
blob: 5d2feb643d2a780646ceb0999ed1b75d33db6887 (plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/* ============================================================
 *
 * This file is a part of digiKam project
 * http://www.digikam.org
 *
 * Date        : 2006-02-22
 * Description : a generic widget to display metadata
 *
 * Copyright (C) 2006-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
 *
 * 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, or (at your option)
 * any later version.
 *
 * 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.
 *
 * ============================================================ */

#ifndef METADATAWIDGET_H
#define METADATAWIDGET_H

// TQt includes.

#include <tqwidget.h>
#include <tqstring.h>

// KDE includes.

#include <kurl.h>

// Local includes.

#include "dmetadata.h"
#include "digikam_export.h"

namespace Digikam
{

class MetadataListView;
class MetadataWidgetPriv;

class DIGIKAM_EXPORT MetadataWidget : public TQWidget
{
    TQ_OBJECT
  

public:

    enum Mode
    {
        SIMPLE=0,
        FULL
    };

public:

    MetadataWidget(TQWidget* parent, const char* name=0);
    ~MetadataWidget();

    int     getMode();
    void    setMode(int mode);

    TQString getCurrentItemKey() const;
    void    setCurrentItemByKey(const TQString& itemKey);

    void    setUserAreaWidget(TQWidget *w);

    virtual TQString getTagTitle(const TQString& key);
    virtual TQString getTagDescription(const TQString& key);

    virtual bool loadFromData(const TQString &fileName, const TQByteArray& data=TQByteArray());
    virtual bool loadFromURL(const KURL& url)=0;

private slots:

    void slotModeChanged(int);
    void slotCopy2Clipboard();
    void slotPrintMetadata();
    
protected slots:    
    
    virtual void slotSaveMetadataToFile()=0;
    
protected:

    void   enabledToolButtons(bool);
    void   setFileName(const TQString& fileName);
    MetadataListView* view();

    bool   setMetadata(const TQByteArray& data=TQByteArray());
    const  TQByteArray& getMetadata();

    void   setMetadataMap(const DMetadata::MetaDataMap& data=DMetadata::MetaDataMap());
    const  DMetadata::MetaDataMap& getMetadataMap();

    void   setIfdList(const DMetadata::MetaDataMap &ifds, const TQStringList& tagsFilter=TQStringList());
    void   setIfdList(const DMetadata::MetaDataMap &ifds, const TQStringList& keysFilter,
                      const TQStringList& tagsFilter);

    KURL   saveMetadataToFile(const TQString& caption, const TQString& fileFilter);
    bool   storeMetadataToFile(const KURL& url);

    virtual void buildView();
    virtual bool decodeMetadata()=0;
    virtual TQString getMetadataTitle()=0;
    virtual void setMetadataEmpty();

private:

    MetadataWidgetPriv* d;
};

}  // namespace Digikam

#endif /* METADATAWIDGET_H */