You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
318 lines
7.7 KiB
318 lines
7.7 KiB
15 years ago
|
/*
|
||
|
kscoringeditor.h
|
||
|
|
||
|
Copyright (c) 2001 Mathias Waack
|
||
|
Copyright (C) 2005 by Volker Krause <volker.krause@rwth-aachen.de>
|
||
|
|
||
|
Author: Mathias Waack <mathias@atoll-net.de>
|
||
|
|
||
|
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 of the License, or
|
||
|
(at your option) any later version.
|
||
|
You should have received a copy of the GNU General Public License
|
||
|
along with this program; if not, write to the Free Software Foundation,
|
||
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
|
||
|
*/
|
||
|
|
||
|
#ifndef SCOREEDITWIDGET_H
|
||
|
#define SCOREEDITWIDGET_H
|
||
|
|
||
15 years ago
|
#include <tqmap.h>
|
||
15 years ago
|
#include <kdialogbase.h>
|
||
15 years ago
|
#include <tqtable.h>
|
||
|
#include <tqframe.h>
|
||
15 years ago
|
|
||
|
#include "kwidgetlister.h"
|
||
|
|
||
13 years ago
|
#include <tdepimmacros.h>
|
||
15 years ago
|
|
||
|
class KComboBox;
|
||
|
class KLineEdit;
|
||
|
class KIntSpinBox;
|
||
|
class KListBox;
|
||
15 years ago
|
class TQFrame;
|
||
|
class TQLabel;
|
||
|
class TQListBoxItem;
|
||
|
class TQPushButton;
|
||
|
class TQCheckBox;
|
||
|
class TQRadioButton;
|
||
15 years ago
|
|
||
|
class KScoringRule;
|
||
|
class KScoringExpression;
|
||
|
class KScoringManager;
|
||
|
class ActionBase;
|
||
|
class KScoringEditor;
|
||
|
class ScoreEditWidget;
|
||
|
class KColorCombo;
|
||
|
|
||
|
/** this widget implements an editor for one condition.
|
||
|
It is used in ExpressionEditWidget
|
||
|
*/
|
||
14 years ago
|
class KDE_EXPORT SingleConditionWidget : public TQFrame
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
friend class ConditionEditWidget;
|
||
|
public:
|
||
15 years ago
|
SingleConditionWidget(KScoringManager *,TQWidget *p =0, const char *n =0);
|
||
15 years ago
|
~SingleConditionWidget();
|
||
|
void setCondition(KScoringExpression*);
|
||
|
KScoringExpression *createCondition() const;
|
||
|
void clear();
|
||
|
|
||
|
protected slots:
|
||
|
void toggleRegExpButton( int );
|
||
|
void showRegExpDialog();
|
||
|
|
||
|
private:
|
||
|
/** marks a condition as negated */
|
||
15 years ago
|
TQCheckBox *neg;
|
||
15 years ago
|
/** list of possible headers */
|
||
|
KComboBox *headers;
|
||
|
/** list of match types */
|
||
|
KComboBox *matches;
|
||
|
/** the expression which will be matched */
|
||
|
KLineEdit *expr;
|
||
|
/** the button to open the regexp-editor */
|
||
15 years ago
|
TQPushButton *regExpButton;
|
||
15 years ago
|
|
||
|
KScoringManager *manager;
|
||
|
};
|
||
|
|
||
|
/** this widget implements the conditions editor
|
||
|
*/
|
||
|
class ConditionEditWidget: public KWidgetLister
|
||
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
public:
|
||
15 years ago
|
ConditionEditWidget(KScoringManager *,TQWidget *p =0, const char *n =0);
|
||
15 years ago
|
~ConditionEditWidget();
|
||
15 years ago
|
TQWidget* createWidget(TQWidget*);
|
||
15 years ago
|
void updateRule(KScoringRule*);
|
||
15 years ago
|
void clearWidget(TQWidget*);
|
||
15 years ago
|
public slots:
|
||
|
void slotEditRule(KScoringRule*);
|
||
|
private:
|
||
|
KScoringManager *manager;
|
||
|
};
|
||
|
|
||
|
/** this widget implements an editor for one action.
|
||
|
It is used in ActionEditWidget
|
||
|
*/
|
||
14 years ago
|
class SingleActionWidget : public TQWidget
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
friend class ActionEditWidget;
|
||
|
public:
|
||
15 years ago
|
SingleActionWidget(KScoringManager *m,TQWidget *p =0, const char *n =0);
|
||
15 years ago
|
~SingleActionWidget();
|
||
|
void setAction(ActionBase*);
|
||
|
ActionBase *createAction() const;
|
||
|
void clear();
|
||
|
private:
|
||
|
/** the list of available action */
|
||
|
KComboBox *types;
|
||
|
/** the stack of the edit widgets for each action type */
|
||
15 years ago
|
TQWidgetStack *stack;
|
||
15 years ago
|
/** the notify action editor */
|
||
|
KLineEdit *notifyEditor;
|
||
|
/** the score acton editor */
|
||
|
KIntSpinBox *scoreEditor;
|
||
|
/** the color action editor */
|
||
|
KColorCombo *colorEditor;
|
||
|
/** the dummy label */
|
||
15 years ago
|
TQLabel *dummyLabel;
|
||
15 years ago
|
|
||
|
KScoringManager *manager;
|
||
|
};
|
||
|
|
||
|
/** this widget implements the action editor
|
||
|
*/
|
||
|
class KDE_EXPORT ActionEditWidget : public KWidgetLister
|
||
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
public:
|
||
15 years ago
|
ActionEditWidget(KScoringManager *m,TQWidget *p =0, const char *n =0);
|
||
15 years ago
|
~ActionEditWidget();
|
||
14 years ago
|
TQWidget* createWidget(TQWidget *parent);
|
||
15 years ago
|
void updateRule(KScoringRule*);
|
||
15 years ago
|
void clearWidget(TQWidget *);
|
||
15 years ago
|
public slots:
|
||
|
void slotEditRule(KScoringRule *);
|
||
|
private:
|
||
|
KScoringManager *manager;
|
||
|
};
|
||
|
|
||
|
/** This widget implements the rule editor
|
||
|
*/
|
||
14 years ago
|
class RuleEditWidget : public TQWidget
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
public:
|
||
15 years ago
|
RuleEditWidget(KScoringManager *m,TQWidget *p =0, const char *n =0);
|
||
15 years ago
|
~RuleEditWidget();
|
||
|
public slots:
|
||
|
void setDirty();
|
||
15 years ago
|
void slotEditRule(const TQString&);
|
||
15 years ago
|
void updateRule(KScoringRule*);
|
||
|
void updateRule();
|
||
|
signals:
|
||
|
void shrink();
|
||
|
protected slots:
|
||
|
void slotAddGroup();
|
||
|
void slotShrink();
|
||
|
private slots:
|
||
|
void slotExpireEditChanged(int value);
|
||
|
private:
|
||
|
void clearContents();
|
||
|
|
||
|
bool dirty;
|
||
|
/** the name of the rule */
|
||
|
KLineEdit *ruleNameEdit;
|
||
|
/** the list of groups this rule applies to */
|
||
|
KLineEdit *groupsEdit;
|
||
|
/** list of all available groups */
|
||
|
KComboBox *groupsBox;
|
||
|
/** the expire enable */
|
||
15 years ago
|
TQCheckBox *expireCheck;
|
||
15 years ago
|
/** the label to the expireCheck */
|
||
15 years ago
|
TQLabel *expireLabel;
|
||
15 years ago
|
/** the expire delay */
|
||
|
KIntSpinBox *expireEdit;
|
||
|
/** the link modes of the conditions */
|
||
15 years ago
|
TQRadioButton *linkModeOr, *linkModeAnd;
|
||
15 years ago
|
/** the actions editor */
|
||
|
ActionEditWidget *actionEditor;
|
||
|
/** the conditions editor */
|
||
|
ConditionEditWidget *condEditor;
|
||
|
|
||
|
KScoringManager *manager;
|
||
|
|
||
|
// the old name of the current rule
|
||
15 years ago
|
TQString oldRuleName;
|
||
15 years ago
|
};
|
||
|
|
||
|
/** This widget shows a list of rules with buttons for
|
||
|
copy, delete aso.
|
||
|
*/
|
||
14 years ago
|
class KDE_EXPORT RuleListWidget : public TQWidget
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
public:
|
||
15 years ago
|
RuleListWidget(KScoringManager *m, bool =false, TQWidget *p =0, const char *n =0);
|
||
15 years ago
|
~RuleListWidget();
|
||
15 years ago
|
TQString currentRule() const { return ruleList->currentText(); }
|
||
15 years ago
|
protected:
|
||
|
void updateButton();
|
||
|
|
||
|
signals:
|
||
15 years ago
|
void ruleSelected(const TQString&);
|
||
|
void ruleEdited(const TQString&);
|
||
15 years ago
|
void leavingRule();
|
||
|
public slots:
|
||
15 years ago
|
void slotRuleSelected(const TQString&);
|
||
|
void slotRuleSelected(TQListBoxItem *);
|
||
15 years ago
|
void slotRuleSelected(int);
|
||
|
void updateRuleList();
|
||
|
void updateRuleList(const KScoringRule*);
|
||
15 years ago
|
void slotRuleNameChanged(const TQString&,const TQString&);
|
||
15 years ago
|
protected slots:
|
||
15 years ago
|
void slotGroupFilter(const TQString&);
|
||
|
void slotEditRule(TQListBoxItem*);
|
||
|
void slotEditRule(const TQString&);
|
||
15 years ago
|
void slotEditRule();
|
||
|
void slotDelRule();
|
||
|
void slotNewRule();
|
||
|
void slotCopyRule();
|
||
|
void slotRuleUp();
|
||
|
void slotRuleDown();
|
||
|
|
||
|
private:
|
||
|
/** the list of rules */
|
||
|
KListBox *ruleList;
|
||
|
/** the current group */
|
||
15 years ago
|
TQString group;
|
||
15 years ago
|
/** marks if we're alone or together with the edit widget */
|
||
|
bool alone;
|
||
|
|
||
|
KScoringManager *manager;
|
||
|
|
||
15 years ago
|
TQPushButton *editRule;
|
||
|
TQPushButton *newRule;
|
||
|
TQPushButton *delRule;
|
||
|
TQPushButton *copyRule;
|
||
|
TQPushButton *mRuleUp;
|
||
|
TQPushButton *mRuleDown;
|
||
15 years ago
|
};
|
||
|
|
||
|
class KDE_EXPORT KScoringEditor : public KDialogBase
|
||
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
public:
|
||
|
~KScoringEditor();
|
||
|
void setRule(KScoringRule*);
|
||
14 years ago
|
static KScoringEditor *createEditor(KScoringManager* m, TQWidget *parent=0, const char *name=0);
|
||
15 years ago
|
static KScoringEditor *editor() { return scoreEditor; }
|
||
|
void setDirty();
|
||
|
protected:
|
||
14 years ago
|
KScoringEditor(KScoringManager* m, TQWidget *parent=0, const char *name=0);
|
||
15 years ago
|
private:
|
||
|
/** the editor for the current rule */
|
||
|
RuleEditWidget* ruleEditor;
|
||
|
/** the list of known rules */
|
||
|
RuleListWidget *ruleLister;
|
||
|
protected slots:
|
||
|
void slotShrink();
|
||
|
void slotDoShrink();
|
||
|
void slotApply();
|
||
|
void slotOk();
|
||
|
void slotCancel();
|
||
|
void slotFinished();
|
||
|
private:
|
||
|
KScoringManager *manager;
|
||
|
ScoreEditWidget *edit;
|
||
|
/** make sure that there is only one instance of ourselve */
|
||
|
static KScoringEditor *scoreEditor;
|
||
|
};
|
||
|
|
||
|
class KScoringEditorWidgetDialog : public KDialogBase
|
||
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
public:
|
||
14 years ago
|
KScoringEditorWidgetDialog(KScoringManager *m, const TQString& rName, TQWidget *parent=0, const char *name=0);
|
||
15 years ago
|
protected slots:
|
||
|
void slotApply();
|
||
|
void slotOk();
|
||
|
void slotShrink();
|
||
|
void slotDoShrink();
|
||
|
private:
|
||
|
RuleEditWidget *ruleEditor;
|
||
|
KScoringManager *manager;
|
||
15 years ago
|
TQString ruleName;
|
||
15 years ago
|
};
|
||
|
|
||
14 years ago
|
class KDE_EXPORT KScoringEditorWidget : public TQWidget
|
||
15 years ago
|
{
|
||
|
Q_OBJECT
|
||
14 years ago
|
TQ_OBJECT
|
||
15 years ago
|
public:
|
||
15 years ago
|
KScoringEditorWidget(KScoringManager *m,TQWidget *p =0, const char *n =0);
|
||
15 years ago
|
~KScoringEditorWidget();
|
||
|
protected slots:
|
||
15 years ago
|
void slotRuleEdited(const TQString&);
|
||
15 years ago
|
private:
|
||
|
RuleListWidget *ruleLister;
|
||
|
KScoringManager *manager;
|
||
|
};
|
||
|
|
||
|
|
||
|
#endif // SCOREEDITWIDGET_H
|