summaryrefslogtreecommitdiffstats
path: root/amarok/src/editfilterdialog.h
blob: 6e536e75e15b829760908e6180aa21635cac9434 (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
// (c) 2006 Giovanni Venturi <giovanni@kde-it.org>
// See COPYING file for licensing information.

#ifndef AMAROK_EDITFILTERDIALOG_H
#define AMAROK_EDITFILTERDIALOG_H

#include <tqvaluelist.h>
#include <tqvaluevector.h>

#include <kdialogbase.h>

class TQWidget;
class TQVBoxLayout;
class TQComboBox;
class TQCheckBox;
class TQLineEdit;
class TQRadioButton;
class TQGroupBox;
class TQSpinBox;
class TQStringList;
class KComboBox;

class EditFilterDialog : public KDialogBase
{
    Q_OBJECT
  
    public:
        EditFilterDialog( TQWidget* parent, bool metaBundleKeywords, const TQString &text = "" );
        ~EditFilterDialog();

        TQString filter() const;

    signals:
        void filterChanged( const TQString &filter );

    private:
        TQVBoxLayout *m_mainLay;

        TQCheckBox *m_prefixNOT;
        TQComboBox *m_comboKeyword;
        KLineEdit *m_editKeyword;

        TQGroupBox *m_groupBox;

        TQComboBox *m_comboCondition;
        TQLabel *m_filesizeLabel;
        TQComboBox *m_comboUnitSize;

        TQRadioButton *m_minMaxRadio;
        TQSpinBox *m_spinMin1, *m_spinMin2;
        TQLabel *m_andLabel;
        TQSpinBox *m_spinMax1, *m_spinMax2;

        TQGroupBox *m_groupBox2;
        TQRadioButton *m_checkALL;
        TQRadioButton *m_checkAtLeastOne;
        TQRadioButton *m_checkExactly;
        TQRadioButton *m_checkExclude;
        TQValueList<TQRadioButton*> m_actionCheck;

        TQGroupBox *m_groupBox3;
        TQRadioButton *m_checkAND;
        TQRadioButton *m_checkOR;

        bool m_appended;               // true if a filter appended
        int m_selectedIndex;           // the position of the selected keyword in the combobox
        TQValueVector<TQString> m_vector; // the vector of the amarok filter keyword
        TQString m_filterText;          // the resulting filter string
        TQString m_previousFilterText;  // the previous resulting filter string
        TQString m_strPrefixNOT;        // is empty if no NOT prefix is needed else it's "-"

    private:
        void exclusiveSelectOf( int which );
        TQString keywordConditionString(const TQString& keyword) const;
        void setMinMaxValueSpins();

    private slots:
        void selectedKeyword(int index);

        void minSpinChanged(int value);
        void maxSpinChanged(int value);

        void textWanted();
        void textWanted( const TQStringList &completions );
        void valueWanted();

        void chooseCondition(int index);
        void chooseOneValue();
        void chooseMinMaxValue();

        void slotCheckAll();
        void slotCheckAtLeastOne();
        void slotCheckExactly();
        void slotCheckExclude();

        void slotCheckAND();
        void slotCheckOR();

        void assignPrefixNOT();

    protected slots:
        virtual void slotDefault();
        virtual void slotUser1();
        virtual void slotUser2();
        virtual void slotOk();
};

#endif /* AMAROK_EDITFILTERDIALOG_H */