~ubuntu-branches/ubuntu/gutsy/kid3/gutsy

« back to all changes in this revision

Viewing changes to kid3/mp3framelist.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Mercatante
  • Date: 2007-07-01 00:31:03 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070701003103-2qownnv49a7jdqm3
Tags: 0.9-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
         * @param name   internal name or 0
46
46
         * @param fld    ID3_Field containing binary data
47
47
         */
48
 
        BinaryOpenSave(QWidget *parent, const char *name, ID3_Field *fld);
 
48
        BinaryOpenSave(QWidget* parent, const char* name, ID3_Field* fld);
49
49
 
50
50
        /**
51
51
         * Set label.
52
52
         *
53
53
         * @param txt label
54
54
         */
55
 
        void setLabel(const QString & txt) { label->setText(txt); }
56
 
 
57
 
        /**
58
 
         * Get filename of file to import.
59
 
         *
60
 
         * @return filename.
61
 
         */
62
 
        QString getFilename(void) { return loadfilename; }
 
55
        void setLabel(const QString& txt) { m_label->setText(txt); }
 
56
 
 
57
        /**
 
58
         * Check if data changed.
 
59
         * @return true if data changed.
 
60
         */
 
61
        bool isChanged() const { return m_isChanged; }
 
62
 
 
63
        /**
 
64
         * Get binary data.
 
65
         * @return byte array.
 
66
         */
 
67
        const QByteArray& getData() const { return m_byteArray; }
63
68
#endif // HAVE_ID3LIB
64
69
 
65
70
 public slots:
67
72
         * Request name of file to import binary data from.
68
73
         * The data is imported later when Ok is pressed in the parent dialog.
69
74
         */
70
 
        void loadData(void);
 
75
        void loadData();
71
76
 
72
77
        /**
73
78
         * Request name of file and export binary data.
74
79
         */
75
 
        void saveData(void);
 
80
        void saveData();
76
81
 
77
82
        /**
78
83
         * Create image from binary data and display it in window.
79
84
         */
80
 
        void viewData(void);
 
85
        void viewData();
81
86
 
82
87
 private:
83
88
#ifdef HAVE_ID3LIB
84
 
        /** ID3 field containing binary data */
85
 
        ID3_Field *field;
 
89
        /** Array with binary data */
 
90
        QByteArray m_byteArray;
 
91
        /** true if m_byteArray changed */
 
92
        bool m_isChanged;
86
93
        /** horizontal layout */
87
 
        QHBoxLayout *layout;
 
94
        QHBoxLayout* m_layout;
88
95
        /** Label left of buttons */
89
 
        QLabel *label;
90
 
        /** filename of file to import */
91
 
        QString loadfilename;
 
96
        QLabel* m_label;
92
97
        /** Import push button */
93
 
        QPushButton *openButton;
 
98
        QPushButton* m_openButton;
94
99
        /** Export push button */
95
 
        QPushButton *saveButton;
 
100
        QPushButton* m_saveButton;
96
101
        /** View push button */
97
 
        QPushButton *viewButton;
 
102
        QPushButton* m_viewButton;
98
103
#endif // HAVE_ID3LIB
99
104
};
100
105
 
109
114
         * Constructor.
110
115
         */
111
116
        Mp3FrameList();
 
117
 
112
118
        /**
113
119
         * Destructor.
114
120
         */
115
121
        virtual ~Mp3FrameList();
 
122
 
116
123
        /**
117
124
         * Set file and fill the list box with its frames.
118
125
         * The listbox has to be set with setListBox() before calling this
121
128
         * @param taggedFile file
122
129
         */
123
130
        virtual void setTags(TaggedFile* taggedFile);
 
131
 
124
132
        /**
125
133
         * Create dialog to edit the selected frame and update the fields
126
134
         * if Ok is returned.
127
135
         *
128
 
         * @return TRUE if Ok selected in dialog.
 
136
         * @return true if Ok selected in dialog.
129
137
         */
130
 
        virtual bool editFrame(void);
 
138
        virtual bool editFrame();
 
139
 
131
140
        /**
132
141
         * Delete selected frame.
133
142
         *
134
 
         * @return FALSE if frame not found.
 
143
         * @return false if frame not found.
135
144
         */
136
 
        virtual bool deleteFrame(void);
 
145
        virtual bool deleteFrame();
 
146
 
137
147
        /**
138
148
         * Add a new frame.
139
149
         *
140
150
         * @param frameId ID of frame to add
141
151
         * @param edit    true to edit frame after adding it
142
 
         * @return TRUE if frame added.
 
152
         * @return true if frame added.
143
153
         */
144
154
        virtual bool addFrame(int frameId, bool edit = false);
 
155
 
145
156
        /**
146
157
         * Copy the selected frame to the copy buffer.
147
158
         *
148
159
         * @return true if frame copied.
149
160
         */
150
161
        virtual bool copyFrame();
 
162
 
151
163
        /**
152
164
         * Paste the selected frame from the copy buffer.
153
165
         *
154
166
         * @return true if frame pasted.
155
167
         */
156
168
        virtual bool pasteFrame();
 
169
 
157
170
        /**
158
171
         * Display a dialog to select a frame type.
159
172
         *
160
173
         * @return ID of selected frame,
161
174
         *         -1 if no frame selected.
162
175
         */
163
 
        virtual int selectFrameId(void);
 
176
        virtual int selectFrameId();
164
177
 
165
178
        friend class IntComboBoxControl; // access to setSelectedEncoding()
166
179
        friend class TextFieldControl;   // access to getSelectedEncoding()
174
187
         *
175
188
         * @param enc encoding.
176
189
         */
177
 
        void setSelectedEncoding(ID3_TextEnc enc) { selected_enc = enc; }
 
190
        void setSelectedEncoding(ID3_TextEnc enc) { m_selectedEnc = enc; }
 
191
 
178
192
        /**
179
193
         * Get encoding selected in frame dialog.
180
194
         *
181
195
         * @return encoding, ID3TE_NONE if none selected.
182
196
         */
183
 
        ID3_TextEnc getSelectedEncoding(void) const { return selected_enc; }
 
197
        ID3_TextEnc getSelectedEncoding() const { return m_selectedEnc; }
 
198
 
184
199
        /**
185
200
         * Get frame with index.
186
201
         *
187
202
         * @param index index in listbox
188
203
         * @return frame with index.
189
204
         */
190
 
        ID3_Frame *getFrame(int index) const;
 
205
        ID3_Frame* getFrame(int index) const;
 
206
 
191
207
        /**
192
208
         * Get frame which is selected in listbox.
193
209
         *
196
212
         *
197
213
         * @return selected frame.
198
214
         */
199
 
        ID3_Frame *getSelectedFrame(int* lbIndex = 0) const;
 
215
        ID3_Frame* getSelectedFrame(int* lbIndex = 0) const;
 
216
 
200
217
        /**
201
218
         * Fill listbox with frame descriptions.
202
219
         * Before using this method, the listbox and file have to be set.
203
220
         * @see setListBox(), setTags()
204
221
         */
205
 
        void readTags(void);
 
222
        void readTags();
 
223
 
206
224
        /**
207
225
         * Create dialog to edit a frame and update the fields if Ok is
208
226
         * returned.
209
227
         *
210
228
         * @param frame frame to edit
211
229
         *
212
 
         * @return TRUE if Ok selected in dialog.
 
230
         * @return true if Ok selected in dialog.
213
231
         */
214
232
        bool editFrame(ID3_Frame* frame);
 
233
 
215
234
        /**
216
235
         * Get description of frame.
217
236
         *
218
237
         * @param id ID of frame
219
238
         * @return description or NULL if id not found.
220
239
         */
221
 
        const char *getIdString(ID3_FrameID id) const;
 
240
        const char* getIdString(ID3_FrameID id) const;
222
241
 
223
242
        /** ID3v2 tags containing frames */
224
 
        ID3_Tag *tags;
 
243
        ID3_Tag* m_tags;
225
244
        /** List with controls to edit fields in frame */
226
 
        Q3PtrList<FieldControl> fieldcontrols; 
 
245
        Q3PtrList<FieldControl> m_fieldcontrols; 
227
246
        /** Number of possible frame IDs */
228
247
#if defined _WIN32 || defined WIN32
229
 
        enum { num_frameid = 76 };
 
248
        enum { NumFrameIds = 74 };
230
249
#else
231
 
        static const int num_frameid = 76;
 
250
        static const int NumFrameIds = 74;
232
251
#endif
233
252
        /** Encoding selected in frame dialog */
234
 
        ID3_TextEnc selected_enc;
 
253
        ID3_TextEnc m_selectedEnc;
235
254
        /** Frame storage for copy-paste */
236
255
        ID3_Frame* m_copyFrame;
237
256
 
238
257
        /** Alphabetically sorted list of frame descriptions */
239
 
        static const char *frameid_str[num_frameid];
240
 
        /** Frame IDs corresponding to frameid_str[] */
241
 
        static const ID3_FrameID frameid_code[num_frameid];
 
258
        static const char* s_frameIdStr[NumFrameIds];
 
259
        /** Frame IDs corresponding to s_frameIdStr[] */
 
260
        static const ID3_FrameID s_frameIdCode[NumFrameIds];
242
261
};
243
262
 
244
263
#endif // HAVE_ID3LIB