~ubuntu-branches/ubuntu/wily/kid3/wily-proposed

« back to all changes in this revision

Viewing changes to kid3/configtable.h

  • Committer: Package Import Robot
  • Author(s): Ana Beatriz Guerrero Lopez, Patrick Matthäi, Ana Beatriz Guerrero Lopez
  • Date: 2011-11-13 16:34:13 UTC
  • mfrom: (1.1.13) (2.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20111113163413-5y0anlc4dqf511uh
Tags: 2.0.1-1
* New upstream release.

[ Patrick Matthäi ]
* Adjust build system.
* Add build dependency xsltproc.

[ Ana Beatriz Guerrero Lopez ]
* Some more adjustments to the build system taken from upstream's deb/
* directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * \file configtable.h
3
 
 * Table with context menu to add and remove rows.
4
 
 *
5
 
 * \b Project: Kid3
6
 
 * \author Urs Fleisch
7
 
 * \date 13 Jan 2009
8
 
 *
9
 
 * Copyright (C) 2009  Urs Fleisch
10
 
 *
11
 
 * This file is part of Kid3.
12
 
 *
13
 
 * Kid3 is free software; you can redistribute it and/or modify
14
 
 * it under the terms of the GNU General Public License as published by
15
 
 * the Free Software Foundation; either version 2 of the License, or
16
 
 * (at your option) any later version.
17
 
 *
18
 
 * Kid3 is distributed in the hope that it will be useful,
19
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 
 * GNU General Public License for more details.
22
 
 *
23
 
 * You should have received a copy of the GNU General Public License
24
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
25
 
 */
26
 
 
27
 
#ifndef CONFIGTABLE_H
28
 
#define CONFIGTABLE_H
29
 
 
30
 
#include <qmap.h>
31
 
#include "qtcompatmac.h"
32
 
/** The base class depends on the Qt version and is a table widget. */
33
 
#if QT_VERSION >= 0x040000
34
 
#include <QTableWidget>
35
 
typedef QTableWidget ConfigTableBaseClass;
36
 
#else 
37
 
#include <qtable.h>
38
 
typedef QTable ConfigTableBaseClass;
39
 
class QAction;
40
 
#endif
41
 
 
42
 
/**
43
 
 * Table with context menu to add and remove rows.
44
 
 */
45
 
class ConfigTable : public ConfigTableBaseClass {
46
 
Q_OBJECT
47
 
 
48
 
public:
49
 
        /**
50
 
         * Constructor.
51
 
         *
52
 
         * @param labels column labels
53
 
         * @param parent parent widget
54
 
         */
55
 
        ConfigTable(const QStringList& labels, QWidget* parent = 0);
56
 
 
57
 
        /**
58
 
         * Destructor.
59
 
         */
60
 
        virtual ~ConfigTable();
61
 
 
62
 
        /**
63
 
         * Set the values from a map.
64
 
         *
65
 
         * @param map map with keys and values
66
 
         */
67
 
        void fromMap(const QMap<QString, QString>& map);
68
 
 
69
 
        /**
70
 
         * Store the values in a map.
71
 
         *
72
 
         * @param map to be filled
73
 
         */
74
 
        void toMap(QMap<QString, QString>& map) const;
75
 
 
76
 
public slots:
77
 
        /**
78
 
         * Called when a value in the table is changed.
79
 
         * If the command cell in the last row is changed to a non-empty
80
 
         * value, a new row is added. If it is changed to an empty value,
81
 
         * the row is deleted.
82
 
         *
83
 
         * @param row table row of changed item
84
 
         * @param col table column of changed item
85
 
         */
86
 
        void valueChanged(int row, int col);
87
 
 
88
 
        /**
89
 
         * Insert a new row into the table.
90
 
         *
91
 
         * @param row the new row is inserted after this row
92
 
         */
93
 
        void addRow(int row);
94
 
 
95
 
        /**
96
 
         * Delete a row from the table.
97
 
         *
98
 
         * @param row row to delete
99
 
         */
100
 
        void deleteRow(int row);
101
 
 
102
 
        /**
103
 
         * Clear a row in the table.
104
 
         *
105
 
         * @param row row to clear
106
 
         */
107
 
        void clearRow(int row);
108
 
 
109
 
        /**
110
 
         * Execute a context menu action.
111
 
         *
112
 
         * @param action action of selected menu
113
 
         */
114
 
        void executeAction(QAction* action);
115
 
 
116
 
        /**
117
 
         * Display context menu.
118
 
         *
119
 
         * @param row row at which context menu is displayed
120
 
         * @param col column at which context menu is displayed
121
 
         * @param pos position where context menu is drawn on screen
122
 
         */
123
 
        void contextMenu(int row, int col, const QPoint& pos);
124
 
 
125
 
        /**
126
 
         * Display custom context menu.
127
 
         *
128
 
         * @param pos position where context menu is drawn on screen
129
 
         */
130
 
        void customContextMenu(const QPoint& pos);
131
 
};
132
 
 
133
 
#endif // CONFIGTABLE_H