24 #include <kcombobox.h>
29 #include <QHBoxLayout>
30 #include <QListWidget>
31 #include <QRadioButton>
32 #include <QVBoxLayout>
43 int margin = fontMetrics().height();
44 setWindowTitle(i18n(
"&Diagrams"));
45 QHBoxLayout * mainLayout =
new QHBoxLayout(
this);
46 mainLayout->setSpacing(10);
47 mainLayout->setMargin(margin);
49 m_pFilterGB =
new QGroupBox(i18n(
"Filter"),
this);
50 mainLayout->addWidget(m_pFilterGB);
52 QVBoxLayout * filter =
new QVBoxLayout(m_pFilterGB);
53 filter->setSpacing(10);
54 filter->setMargin(margin);
56 m_pCurrentRB =
new QRadioButton(i18n(
"&Current diagram"), m_pFilterGB);
57 filter->addWidget(m_pCurrentRB);
58 m_pCurrentRB->setChecked(
true);
60 m_pAllRB =
new QRadioButton(i18n(
"&All diagrams"), m_pFilterGB);
61 filter->addWidget(m_pAllRB);
63 m_pSelectRB =
new QRadioButton(i18n(
"&Select diagrams"), m_pFilterGB);
64 filter->addWidget(m_pSelectRB);
66 m_pTypeRB =
new QRadioButton(i18n(
"&Type of diagram"), m_pFilterGB);
67 filter->addWidget(m_pTypeRB);
69 m_pSelectGB =
new QGroupBox(i18nc(
"diagram selection for printing",
"Selection"),
this);
70 mainLayout->addWidget(m_pSelectGB);
72 QVBoxLayout * select =
new QVBoxLayout(m_pSelectGB);
73 select->setSpacing(10);
74 select->setMargin(margin);
76 m_pTypeCB =
new KComboBox(m_pSelectGB);
77 select->addWidget(m_pTypeCB);
78 m_pTypeCB->setEnabled(
false);
80 m_pSelectLW =
new QListWidget(m_pSelectGB);
81 select->addWidget(m_pSelectLW);
82 m_pSelectLW->setEnabled(
false);
83 m_pSelectLW->setSelectionMode(QAbstractItemView::MultiSelection);
84 m_pSelectLW->addItem(
UMLApp::app()->currentView()->umlScene()->name());
85 m_pSelectLW->setCurrentRow(0);
87 m_nIdList.append(
UMLApp::app()->currentView()->umlScene()->ID());
90 connect(m_pAllRB, SIGNAL(clicked()),
this, SLOT(
slotClicked()));
91 connect(m_pCurrentRB, SIGNAL(clicked()),
this, SLOT(
slotClicked()));
92 connect(m_pSelectRB, SIGNAL(clicked()),
this, SLOT(
slotClicked()));
93 connect(m_pTypeRB, SIGNAL(clicked()),
this, SLOT(
slotClicked()));
95 connect(m_pTypeCB, SIGNAL(activated(
int)),
this, SLOT(
slotActivated(
int)));
105 m_pTypeCB->insertItems(0, types);
122 return selectedItems.count();
134 for (
int i = 0; i < m_pSelectLW->count(); ++i) {
152 int listCount = m_pSelectLW->count();
154 for (
int i = 0; i < listCount; ++i) {
160 msg = i18n(
"No diagrams selected.");
169 bool DiagramPrintPage::isSelected(
int index)
172 QListWidgetItem* itemAtIndex = m_pSelectLW->item(index);
173 if (selectedItems.contains(itemAtIndex)) {
195 if (m_pCurrentRB->isChecked()) {
196 m_pTypeCB->setEnabled(
false);
197 m_pSelectLW->setEnabled(
false);
198 m_pSelectLW->clear();
199 m_pSelectLW->addItem(currentScene->
name());
200 m_pSelectLW->setCurrentRow(0);
201 m_nIdList.append(currentScene->
ID());
204 if (m_pAllRB->isChecked()) {
205 m_pTypeCB->setEnabled(
false);
206 m_pSelectLW->setEnabled(
false);
207 m_pSelectLW->clear();
208 foreach (
UMLView * view, list) {
212 m_pSelectLW->selectAll();
215 if (m_pSelectRB->isChecked()) {
216 m_pTypeCB->setEnabled(
false);
217 m_pSelectLW->setEnabled(
true);
218 m_pSelectLW->clear();
219 foreach (
UMLView * view, list) {
225 if (m_pTypeRB->isChecked()) {
226 m_pTypeCB->setEnabled(
true);
227 m_pSelectLW->setEnabled(
true);
228 m_pSelectLW->clear();
229 foreach (
UMLView * view, list) {
235 m_pSelectLW->selectAll();
252 m_pSelectLW->clear();
255 foreach (
UMLView * view, list) {
261 m_pSelectLW->selectAll();
264 #include "diagramprintpage.moc"
int printUmlCount()
Get selected print options.
QString toString(Enum item)
Convert DiagramType item into QString representation.
QString name() const
Return the name of the diagram.
UMLView * currentView() const
Get the current view.
UMLView instances represent diagrams.
static UMLApp * app()
Get the last created instance of this class.
bool isValid(QString &msg)
Overridden method.
QList< UMLView * > UMLViewList
UMLView * findView(Uml::ID::Type id)
Finds a view (diagram) by the ID given to method.
Uml::DiagramType::Enum type() const
Returns the type of the diagram.
QString printUmlDiagram(int sel)
Return ID string of UML diagram.
DiagramPrintPage(QWidget *parent, UMLDoc *doc)
Constructs the diagram print page.
void slotClicked()
Gets called when the users chooses to print all diagrams, the current diagram, a selection of diagram...
UMLViewList viewIterator()
Return the list of views for this document.
QString toString(const ID::Type &id)
Enum fromInt(int item)
Convert an integer item into DiagramType representation.
UMLScene * umlScene() const
Getter for the scene.
~DiagramPrintPage()
Standard destructor.
void slotActivated(int index)
Gets called when the user chooses another diagram type.
UMLScene instances represent diagrams.
Uml::ID::Type ID() const
Returns the ID of the diagram.
UMLDoc provides a document object for a document-view model.