File indexing completed on 2024-05-05 16:08:27

0001 /* This file is part of the KDE libraries
0002     Copyright (C) 2001,2002 Rolf Magnus <ramagnus@kde.org>
0003 
0004     library is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU Library General Public
0006     License version 2 as published by the Free Software Foundation.
0007 
0008     This library is distributed in the hope that it will be useful,
0009     but WITHOUT ANY WARRANTY; without even the implied warranty of
0010     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0011     Library General Public License for more details.
0012 
0013     You should have received a copy of the GNU Library General Public License
0014     along with this library; see the file COPYING.LIB.  If not, write to
0015     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0016     Boston, MA 02110-1301, USA.
0017 
0018  */
0019 
0020 #ifndef __KFILEMETAINFOWIDGET_H__
0021 #define __KFILEMETAINFOWIDGET_H__
0022 
0023 #include <QWidget>
0024 #include <QVariant>
0025 #include <kfilemetainfo.h>
0026 #include <kdelibs4support_export.h>
0027 
0028 class KFileMetaInfoWidgetPrivate;
0029 
0030 /*!
0031  * @deprecated since 5.0
0032  * A widget to display file meta information (like id3 for mp3)
0033  */
0034 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KFileMetaInfoWidget: public QWidget
0035 {
0036     Q_OBJECT
0037 public:
0038     enum Mode {
0039         ReadOnly  = 1,  ///Only display the meta information, and do not permit the user to edit them
0040         ReadWrite = 0,  ///Permits user to edit the displayed meta-info
0041         Reserve = 0xff
0042     };
0043 
0044     KDELIBS4SUPPORT_DEPRECATED explicit KFileMetaInfoWidget(KFileMetaInfoItem item,
0045                                  QValidator *val = nullptr,
0046                                  QWidget *parent = nullptr);
0047 
0048     KFileMetaInfoWidget(KFileMetaInfoItem item, Mode mode, QValidator *val = nullptr,
0049                         QWidget *parent = nullptr);
0050 
0051     ~KFileMetaInfoWidget() override;
0052 
0053     bool apply();
0054 
0055     void setValue(const QVariant &value);
0056     QVariant value() const;
0057     QValidator *validator() const;
0058     KFileMetaInfoItem item() const;
0059 
0060 Q_SIGNALS:
0061     void valueChanged(const QVariant &value);
0062 
0063 protected:
0064     void reparentValidator(QWidget *widget, QValidator *validator);
0065     virtual QWidget *makeWidget();
0066 
0067     QWidget *makeBoolWidget();
0068     QWidget *makeIntWidget();
0069     QWidget *makeDoubleWidget();
0070     QWidget *makeStringWidget();
0071     QWidget *makeDateWidget();
0072     QWidget *makeTimeWidget();
0073     QWidget *makeDateTimeWidget();
0074 
0075 private Q_SLOTS:
0076     void slotChanged(bool value);
0077     void slotChanged(int value);
0078     void slotChanged(double value);
0079     void slotComboChanged(const QString &value);
0080     void slotLineEditChanged(const QString &value);
0081     void slotMultiLineEditChanged();
0082     void slotDateChanged(const QDate &value);
0083     void slotTimeChanged(const QTime &value);
0084     void slotDateTimeChanged(const QDateTime &value);
0085 
0086 private:
0087     friend class KFileMetaInfoWidgetPrivate;
0088     KFileMetaInfoWidgetPrivate *const d;
0089 
0090     Q_DISABLE_COPY(KFileMetaInfoWidget)
0091 };
0092 
0093 #endif