1 /***************************************************************************
2 * Copyright (C) 2005 by S�astien Laot *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
24 #include <kdialogbase.h>
25 #include <kcombobox.h>
26 #include <q3listview.h>
27 #include <q3valuelist.h>
30 #include <QMouseEvent>
53 typedef Q3ValueList
<StateCopy
*> List
;
54 StateCopy(State
*old
= 0);
64 typedef Q3ValueList
<TagCopy
*> List
;
65 TagCopy(Tag
*old
= 0);
69 StateCopy::List stateCopies
;
74 class TagListViewItem
: public Q3ListViewItem
77 TagListViewItem(Q3ListView
*parent
, TagCopy
*tagCopy
);
78 TagListViewItem(Q3ListViewItem
*parent
, TagCopy
*tagCopy
);
79 TagListViewItem(Q3ListView
*parent
, Q3ListViewItem
*after
, TagCopy
*tagCopy
);
80 TagListViewItem(Q3ListViewItem
*parent
, Q3ListViewItem
*after
, TagCopy
*tagCopy
);
81 TagListViewItem(Q3ListView
*parent
, StateCopy
*stateCopy
);
82 TagListViewItem(Q3ListViewItem
*parent
, StateCopy
*stateCopy
);
83 TagListViewItem(Q3ListView
*parent
, Q3ListViewItem
*after
, StateCopy
*stateCopy
);
84 TagListViewItem(Q3ListViewItem
*parent
, Q3ListViewItem
*after
, StateCopy
*stateCopy
);
86 TagCopy
* tagCopy() { return m_tagCopy
; }
87 StateCopy
* stateCopy() { return m_stateCopy
; }
88 bool isEmblemObligatory();
89 TagListViewItem
* lastChild();
90 TagListViewItem
* prevSibling();
91 TagListViewItem
* parent() const; // Reimplemented to cast the return value
92 int width(const QFontMetrics
&fontMetrics
, const Q3ListView
*listView
, int column
) const;
94 void paintCell(QPainter
*painter
, const QColorGroup
&colorGroup
, int column
, int width
, int align
);
98 StateCopy
*m_stateCopy
;
101 class TagListView
: public Q3ListView
105 TagListView(QWidget
*parent
= 0, const char *name
= 0, WFlags flags
= 0);
107 void keyPressEvent(QKeyEvent
*event
);
108 void contentsMouseDoubleClickEvent(QMouseEvent
*event
);
109 void contentsMousePressEvent(QMouseEvent
*event
);
110 void contentsMouseReleaseEvent(QMouseEvent
*event
);
111 TagListViewItem
* currentItem() const; // Reimplemented to cast the return value
112 TagListViewItem
* firstChild() const; // Reimplemented to cast the return value
113 TagListViewItem
* lastItem() const; // Reimplemented to cast the return value
115 void deletePressed();
116 void doubleClickedItem();
120 * @author S�astien Laot
122 class TagsEditDialog
: public KDialogBase
126 TagsEditDialog(QWidget
*parent
= 0, State
*stateToEdit
= 0, bool addNewTag
= false);
128 State::List
deletedStates() { return m_deletedStates
; }
129 State::List
addedStates() { return m_addedStates
; }
130 TagListViewItem
* itemForState(State
*state
);
138 void capturedShortcut(const KShortcut
&shortcut
);
139 void removeShortcut();
142 void currentItemChanged(Q3ListViewItem
*item
);
149 void resetTreeSizeHint();
151 void loadBlankState();
152 void loadStateFrom(State
*state
);
153 void loadTagFrom(Tag
*tag
);
154 void saveStateTo(State
*state
);
155 void saveTagTo(Tag
*tag
);
156 void ensureCurrentItemVisible();
158 KPushButton
*m_moveUp
;
159 KPushButton
*m_moveDown
;
160 KPushButton
*m_deleteTag
;
161 QLineEdit
*m_tagName
;
162 KKeyButton
*m_shortcut
;
163 QPushButton
*m_removeShortcut
;
164 QCheckBox
*m_inherit
;
165 Q3GroupBox
*m_tagBox
;
166 Q3GroupBox
*m_stateBox
;
167 QLabel
*m_stateNameLabel
;
168 QLineEdit
*m_stateName
;
169 KIconButton
*m_emblem
;
170 QPushButton
*m_removeEmblem
;
172 QPushButton
*m_underline
;
173 QPushButton
*m_italic
;
174 QPushButton
*m_strike
;
175 KColorCombo2
*m_textColor
;
177 FontSizeCombo
*m_fontSize
;
178 KColorCombo2
*m_backgroundColor
;
179 QLineEdit
*m_textEquivalent
;
180 QCheckBox
*m_onEveryLines
;
182 TagCopy::List m_tagCopies
;
183 State::List m_deletedStates
;
184 State::List m_addedStates
;