SymbolEditor  1.3.0
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
MainWindow.cpp
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2011 by Stephen Allewell *
3  * sallewell@users.sourceforge.net *
4  * *
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. *
9  ********************************************************************************/
10 
11 
144 #include "MainWindow.h"
145 
146 #include <QVBoxLayout>
147 #include <QListWidgetItem>
148 #include <QMenu>
149 
150 #include <KAction>
151 #include <KActionCollection>
152 #include <KConfigDialog>
153 #include <KFileDialog>
154 #include <KGlobalSettings>
155 #include <KIO/NetAccess>
156 #include <KLocale>
157 #include <KMessageBox>
158 #include <KRecentFilesAction>
159 #include <KStatusBar>
160 #include <KTabWidget>
161 #include <KUrl>
162 
163 #include "ConfigurationDialogs.h"
164 #include "Editor.h"
165 #include "Exceptions.h"
166 #include "SymbolListWidget.h"
167 #include "SymbolLibrary.h"
168 
169 #include "ui_EditorConfigPage.h"
170 
171 #include "SymbolEditor.h"
172 
173 
187  : m_tabWidget(new KTabWidget(this)),
188  m_editor(new Editor),
189  m_listWidget(new SymbolListWidget(m_tabWidget)),
190  m_symbolLibrary(new SymbolLibrary(m_listWidget)),
191  m_item(0),
192  m_menu(0)
193 {
195  m_url = KUrl(i18n("Untitled"));
196 
197  setObjectName("MainWindow#");
198 
199  KActionCollection *actions = actionCollection();
200 
201  QVBoxLayout *editorLayout = new QVBoxLayout;
202  editorLayout->addWidget(m_editor, 0, Qt::AlignCenter);
203  QWidget *layoutWidget = new QWidget;
204  layoutWidget->setLayout(editorLayout);
205 
207  m_listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
208 
209  m_tabWidget->addTab(layoutWidget, "Editor");
210  m_tabWidget->addTab(m_listWidget, "Symbol Library");
211 
212  setCentralWidget(m_tabWidget);
213 
214  setupActions();
215 
216  m_undoGroup.addStack(m_editor->undoStack());
218  connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
219  connect(m_editor, SIGNAL(message(QString)), statusBar(), SLOT(showMessage(QString)));
220  connect(m_editor, SIGNAL(minLineWidth(bool)), actions->action("decreaseLineWidth"), SLOT(setDisabled(bool)));
221  connect(m_editor, SIGNAL(maxLineWidth(bool)), actions->action("increaseLineWidth"), SLOT(setDisabled(bool)));
222  connect(&m_undoGroup, SIGNAL(canUndoChanged(bool)), actions->action("edit_undo"), SLOT(setEnabled(bool)));
223  connect(&m_undoGroup, SIGNAL(canRedoChanged(bool)), actions->action("edit_redo"), SLOT(setEnabled(bool)));
224  connect(&m_undoGroup, SIGNAL(undoTextChanged(QString)), this, SLOT(undoTextChanged(QString)));
225  connect(&m_undoGroup, SIGNAL(redoTextChanged(QString)), this, SLOT(redoTextChanged(QString)));
226  connect(&m_undoGroup, SIGNAL(cleanChanged(bool)), this, SLOT(cleanChanged(bool)));
227  connect(m_editor->undoStack(), SIGNAL(cleanChanged(bool)), actions->action("saveSymbol"), SLOT(setDisabled(bool)));
228  connect(m_editor->undoStack(), SIGNAL(cleanChanged(bool)), actions->action("saveSymbolAsNew"), SLOT(setDisabled(bool)));
229  connect(m_symbolLibrary->undoStack(), SIGNAL(cleanChanged(bool)), actions->action("file_save"), SLOT(setDisabled(bool)));
230  connect(m_listWidget, SIGNAL(executed(QListWidgetItem*)), this, SLOT(itemSelected(QListWidgetItem*)));
231  connect(m_listWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(listWidgetContextMenuRequested(QPoint)));
232 
233  setupGUI(KXmlGuiWindow::Default, "SymbolEditorui.rc");
234 
235  m_tabWidget->setCurrentIndex(0); // select the editor
236  currentChanged(0); // setting current index above doesn't trigger the signal
237  actions->action("moveTo")->trigger(); // select draw tool
238  actions->action("enableSnap")->setChecked(true); // enable snap
239  actions->action("file_save")->setEnabled(false); // nothing to save yet
240  actions->action("saveSymbol")->setEnabled(false); // nothing to save yet
241  actions->action("saveSymbolAsNew")->setEnabled(false); // nothing to save yet
242  actions->action("help_contents")->setVisible(false); // hide the handbook action from the help menu
243  setActionsFromSymbol(m_editor->symbol().second); // set the actions that depend on the current empty symbol, i.e. the defaults
244 }
245 
246 
253 {
254  delete m_symbolLibrary;
255 }
256 
257 
265 {
266  return (editorClean() && libraryClean());
267 }
268 
269 
276 {
277  bool clean = m_editor->undoStack()->isClean();
278 
279  if (!clean) {
280  int messageBoxResult = KMessageBox::warningYesNoCancel(this, i18n("Save changes to the symbol?\nSelecting No discards changes."));
281 
282  switch (messageBoxResult) {
283  case KMessageBox::Yes:
284  saveSymbol();
285  save();
286  clean = true;
287  break;
288 
289  case KMessageBox::No:
290  clean = true;
291  break;
292 
293  case KMessageBox::Cancel:
294  clean = false;
295  break;
296  }
297  }
298 
299  return clean;
300 }
301 
302 
309 {
310  bool clean = m_symbolLibrary->undoStack()->isClean();
311 
312  if (!clean) {
313  int messageBoxResult = KMessageBox::warningYesNoCancel(this, i18n("Save changes to the library?\nSelecting No discards changes."));
314 
315  switch (messageBoxResult) {
316  case KMessageBox::Yes:
317  save();
318  clean = true;
319  break;
320 
321  case KMessageBox::No:
322  clean = true;
323  break;
324 
325  case KMessageBox::Cancel:
326  clean = false;
327  break;
328  }
329  }
330 
331  return clean;
332 }
333 
334 
341 {
342  return true;
343 }
344 
345 
351 {
352  KUrl url = KFileDialog::getOpenUrl(KUrl("kfiledialog:///"), i18n("*.sym|Cross Stitch Symbols"), this);
353 
354  if (!url.isEmpty()) {
355  fileOpen(url);
356  }
357 }
358 
359 
370 void MainWindow::fileOpen(const KUrl &url)
371 {
372  if (!editorClean() || !libraryClean()) {
373  return;
374  }
375 
377  m_editor->clear();
378 
379  if (url.isValid()) {
380  QString src;
381 
382  if (KIO::NetAccess::download(url, src, 0)) {
383  QFile file(src);
384 
385  if (file.open(QIODevice::ReadOnly)) {
386  QDataStream stream(&file);
387 
388  try {
389  stream >> *m_symbolLibrary;
390  m_url = url;
391  KRecentFilesAction *action = static_cast<KRecentFilesAction *>(actionCollection()->action("file_open_recent"));
392  action->addUrl(url);
393  action->saveEntries(KConfigGroup(KGlobal::config(), "RecentFiles"));
394  m_tabWidget->setCurrentIndex(1);
395  } catch (const InvalidFile &e) {
396  KMessageBox::sorry(0, i18n("This doesn't appear to be a valid symbol file"));
397  } catch (const InvalidFileVersion &e) {
398  KMessageBox::sorry(0, i18n("Version %1 of the library file is not supported in this version of SymbolEditor", e.version));
399  } catch (const InvalidSymbolVersion &e) {
400  KMessageBox::sorry(0, i18n("Version %1 of the symbol is not supported in this version of SymbolEditor", e.version));
401  } catch (const FailedReadLibrary &e) {
402  KMessageBox::sorry(0, i18n("Failed to read the library\n%1", e.statusMessage()));
404  }
405 
406  file.close();
407  } else {
408  KMessageBox::sorry(0, i18n("Failed to open the file %1", url.fileName()));
409  }
410  } else {
411  KMessageBox::sorry(0, i18n("Failed to download the file %1", url.fileName()));
412  }
413  } else {
414  KMessageBox::sorry(0, i18n("The url %1 is invalid", url.fileName()));
415  }
416 }
417 
418 
426 {
427  if (m_url == KUrl(i18n("Untitled"))) {
428  saveAs();
429  } else {
430  QFile file(m_url.path());
431 
432  if (file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
433  QDataStream stream(&file);
434  stream.setVersion(QDataStream::Qt_4_0);
435 
436  try {
437  stream << *m_symbolLibrary;
438  } catch (const FailedWriteLibrary &e) {
439  KMessageBox::sorry(0, i18n("Failed to write the library\n%1", e.statusMessage()));
440  }
441 
442  file.close();
443  m_symbolLibrary->undoStack()->setClean();
444  } else {
445  KMessageBox::sorry(0, i18n("Failed to open the file %1\n%2", m_url.fileName(), file.errorString()));
446  }
447  }
448 }
449 
450 
457 {
458  KUrl url = KFileDialog::getSaveUrl(QString("::%1").arg(KGlobalSettings::documentPath()), i18n("*.sym|Cross Stitch Symbols"), this, i18n("Save As"));
459 
460  if (url.isValid()) {
461  if (KIO::NetAccess::exists(url, false, 0)) {
462  if (KMessageBox::warningYesNo(this, i18n("This file already exists\nDo you want to overwrite it?")) == KMessageBox::No) {
463  return;
464  }
465  }
466 
467  m_url = url;
468  save();
469  KRecentFilesAction *action = static_cast<KRecentFilesAction *>(actionCollection()->action("file_open_recent"));
470  action->addUrl(url);
471  action->saveEntries(KConfigGroup(KGlobal::config(), "RecentFiles"));
472  }
473 }
474 
475 
484 {
485  if (editorClean()) {
486  m_editor->clear();
488  actionCollection()->action("moveTo")->trigger(); // Select move tool
489  }
490 }
491 
492 
500 {
501  QPair<qint16, Symbol> pair = m_editor->symbol();
502  m_symbolLibrary->undoStack()->push(new UpdateSymbolCommand(m_symbolLibrary, pair.first, pair.second));
503  m_editor->undoStack()->setClean();
504 }
505 
506 
515 {
516  QPair<qint16, Symbol> pair = m_editor->symbol();
517  pair.first = 0;
518  m_symbolLibrary->undoStack()->push(new UpdateSymbolCommand(m_symbolLibrary, pair.first, pair.second));
519  m_editor->setSymbol(pair);
520 }
521 
522 
533 {
534  KUrl url = KFileDialog::getOpenUrl(KUrl("kfiledialog:///"), i18n("*.sym|Cross Stitch Symbols"), this);
535 
536  if (url.isEmpty()) {
537  return;
538  }
539 
540  if (url.isValid()) {
541  QString src;
542 
543  if (KIO::NetAccess::download(url, src, 0)) {
544  QFile file(src);
545 
546  if (file.open(QIODevice::ReadOnly)) {
547  SymbolLibrary *lib = new SymbolLibrary;
548  QDataStream stream(&file);
549 
550  try {
551  stream >> *lib;
553  } catch (const InvalidFile &e) {
554  KMessageBox::sorry(0, i18n("This doesn't appear to be a valid symbol file"));
555  } catch (const InvalidFileVersion &e) {
556  KMessageBox::sorry(0, i18n("Version %1 of the library file is not supported in this version of SymbolEditor", e.version));
557  }
558 
559  file.close();
560  } else {
561  KMessageBox::sorry(0, i18n("Failed to open the file %1", url.fileName()));
562  }
563  } else {
564  KMessageBox::sorry(0, i18n("Failed to download the file %1", url.fileName()));
565  }
566  } else {
567  KMessageBox::sorry(0, i18n("The url %1 is invalid", url.fileName()));
568  }
569 }
570 
571 
578 {
579  if (editorClean() && libraryClean()) {
580  m_editor->clear();
582  m_url = KUrl(i18n("Untitled"));
583  }
584 }
585 
586 
592 {
593  KXmlGuiWindow::close();
594 }
595 
596 
603 {
604  m_undoGroup.undo();
605 }
606 
607 
614 {
615  m_undoGroup.redo();
616 }
617 
618 
626 void MainWindow::undoTextChanged(const QString &text)
627 {
628  actionCollection()->action("edit_undo")->setText(QString(i18n("Undo %1", text)));
629 }
630 
631 
639 void MainWindow::redoTextChanged(const QString &text)
640 {
641  actionCollection()->action("edit_redo")->setText(QString(i18n("Redo %1", text)));
642 }
643 
644 
650 void MainWindow::cleanChanged(bool clean)
651 {
652  QString tab = QString("%1 ").arg(m_url.fileName());
653 
654  if (m_tabWidget->currentIndex() == 1) {
655  tab += QString(i18nc("The Library tab title", "Library"));
656  } else {
657  tab += QString(i18nc("The Editor tab title", "Editor"));
658  }
659 
660  setCaption(tab, !clean);
661 }
662 
663 
672 {
673  if (index == 0) { // Editor
674  m_undoGroup.setActiveStack(m_editor->undoStack());
675  } else if (index == 1) { // QListWidget
676  m_undoGroup.setActiveStack(m_symbolLibrary->undoStack());
677  }
678 }
679 
680 
690 void MainWindow::itemSelected(QListWidgetItem *item)
691 {
692  QPair<qint16, Symbol> pair;
693 
694  if (editorClean()) {
695  m_editor->clear();
696  pair.first = static_cast<qint16>(item->data(Qt::UserRole).toInt());
697  pair.second = m_symbolLibrary->symbol(pair.first);
698  m_editor->setSymbol(pair);
699  setActionsFromSymbol(pair.second);
700  m_tabWidget->setCurrentIndex(0);
701  }
702 }
703 
704 
713 {
714  if (m_item = m_listWidget->itemAt(pos)) {
715  if (!m_menu) {
716  m_menu = new QMenu;
717  m_menu->addAction(i18n("Delete Symbol"), this, SLOT(deleteSymbol()));
718  }
719 
720  m_menu->popup(QCursor::pos());
721  }
722 }
723 
724 
729 {
730  m_symbolLibrary->undoStack()->push(new DeleteSymbolCommand(m_symbolLibrary, static_cast<qint16>(m_item->data(Qt::UserRole).toInt())));
731 }
732 
733 
739 {
740  if (KConfigDialog::showDialog("preferences")) {
741  return;
742  }
743 
744  KConfigDialog *dialog = new KConfigDialog(this, "preferences", Configuration::self());
745  dialog->setFaceType(KPageDialog::List);
746 
747  dialog->addPage(new EditorConfigPage(0, "EditorConfigPage"), i18nc("The Editor config page", "Editor"), "preferences-desktop");
748 
749  connect(dialog, SIGNAL(settingsChanged(QString)), m_editor, SLOT(readSettings()));
750 
751  dialog->show();
752 }
753 
754 
763 {
764  KAction *action;
765  QActionGroup *actionGroup;
766 
767  KActionCollection *actions = actionCollection();
768 
769  // File menu
770  KStandardAction::open(this, SLOT(fileOpen()), actions);
771  KStandardAction::openNew(this, SLOT(newSymbol()), actions);
772  KStandardAction::openRecent(this, SLOT(fileOpen(KUrl)), actions)->loadEntries(KConfigGroup(KGlobal::config(), "RecentFiles"));
773  KStandardAction::save(this, SLOT(save()), actions);
774  KStandardAction::saveAs(this, SLOT(saveAs()), actions);
775 
776  action = new KAction(this);
777  action->setText(i18n("Import Library"));
778  connect(action, SIGNAL(triggered()), this, SLOT(importLibrary()));
779  actions->addAction("importLibrary", action);
780 
781  action = new KAction(this);
782  action->setText(i18n("Save Symbol"));
783  action->setIcon(KIcon("save-symbol"));
784  connect(action, SIGNAL(triggered()), this, SLOT(saveSymbol()));
785  actions->addAction("saveSymbol", action);
786 
787  action = new KAction(this);
788  action->setText(i18n("Save Symbol as New"));
789  connect(action, SIGNAL(triggered()), this, SLOT(saveSymbolAsNew()));
790  actions->addAction("saveSymbolAsNew", action);
791 
792  KStandardAction::close(this, SLOT(close()), actions);
793  KStandardAction::quit(this, SLOT(quit()), actions);
794 
795  // Edit menu
796  KStandardAction::undo(this, SLOT(undo()), actions);
797  KStandardAction::redo(this, SLOT(redo()), actions);
798 
799  // Rendering menu
800  action = new KAction(this);
801  action->setText(i18n("Fill Path"));
802  action->setIcon(KIcon("rating"));
803  action->setCheckable(true);
804  connect(action, SIGNAL(triggered(bool)), m_editor, SLOT(selectFilled(bool)));
805  actions->addAction("fillPath", action);
806 
807  actionGroup = new QActionGroup(this);
808  actionGroup->setExclusive(true);
809 
810  action = new KAction(this);
811  action->setText(i18n("Odd Even Fill"));
812  action->setData(Qt::OddEvenFill);
813  action->setIcon(KIcon("odd-even-fill"));
814  action->setCheckable(true);
815  actions->addAction("oddEvenFill", action);
816  actionGroup->addAction(action);
817 
818  action = new KAction(this);
819  action->setText(i18n("Winding Fill"));
820  action->setData(Qt::WindingFill);
821  action->setIcon(KIcon("winding-fill"));
822  action->setCheckable(true);
823  actions->addAction("windingFill", action);
824  actionGroup->addAction(action);
825 
826  connect(actionGroup, SIGNAL(triggered(QAction*)), m_editor, SLOT(selectFillRule(QAction*)));
827 
828  actionGroup = new QActionGroup(this);
829  actionGroup->setExclusive(true);
830 
831  action = new KAction(this);
832  action->setText(i18n("Flat Cap"));
833  action->setData(Qt::FlatCap);
834  action->setIcon(KIcon("flat-cap"));
835  action->setCheckable(true);
836  actions->addAction("flatCap", action);
837  actionGroup->addAction(action);
838 
839  action = new KAction(this);
840  action->setText(i18n("Square Cap"));
841  action->setData(Qt::SquareCap);
842  action->setIcon(KIcon("square-cap"));
843  action->setCheckable(true);
844  actions->addAction("squareCap", action);
845  actionGroup->addAction(action);
846 
847  action = new KAction(this);
848  action->setText(i18n("Round Cap"));
849  action->setData(Qt::RoundCap);
850  action->setIcon(KIcon("round-cap"));
851  action->setCheckable(true);
852  actions->addAction("roundCap", action);
853  actionGroup->addAction(action);
854 
855  connect(actionGroup, SIGNAL(triggered(QAction*)), m_editor, SLOT(selectCapStyle(QAction*)));
856 
857  actionGroup = new QActionGroup(this);
858  actionGroup->setExclusive(true);
859 
860  action = new KAction(this);
861  action->setText(i18n("Bevel Join"));
862  action->setData(Qt::BevelJoin);
863  action->setIcon(KIcon("bevel-join"));
864  action->setCheckable(true);
865  actions->addAction("bevelJoin", action);
866  actionGroup->addAction(action);
867 
868  action = new KAction(this);
869  action->setText(i18n("Miter Join"));
870  action->setData(Qt::MiterJoin);
871  action->setIcon(KIcon("miter-join"));
872  action->setCheckable(true);
873  actions->addAction("miterJoin", action);
874  actionGroup->addAction(action);
875 
876  action = new KAction(this);
877  action->setText(i18n("Round Join"));
878  action->setData(Qt::RoundJoin);
879  action->setIcon(KIcon("round-join"));
880  action->setCheckable(true);
881  actions->addAction("roundJoin", action);
882  actionGroup->addAction(action);
883 
884  connect(actionGroup, SIGNAL(triggered(QAction*)), m_editor, SLOT(selectJoinStyle(QAction*)));
885 
886  action = new KAction(this);
887  action->setText(i18n("Increase Line Width"));
888  action->setIcon(KIcon("increase-line-width"));
889  connect(action, SIGNAL(triggered()), m_editor, SLOT(increaseLineWidth()));
890  actions->addAction("increaseLineWidth", action);
891 
892  action = new KAction(this);
893  action->setText(i18n("Decrease Line Width"));
894  action->setIcon(KIcon("decrease-line-width"));
895  connect(action, SIGNAL(triggered()), m_editor, SLOT(decreaseLineWidth()));
896  actions->addAction("decreaseLineWidth", action);
897 
898  // Tools Menu
899  actionGroup = new QActionGroup(this);
900  actionGroup->setExclusive(true);
901 
902  action = new KAction(this);
903  action->setText(i18n("Move To"));
904  action->setData(Editor::MoveTo);
905  action->setIcon(KIcon("go-jump"));
906  action->setCheckable(true);
907  actions->addAction("moveTo", action);
908  actionGroup->addAction(action);
909 
910  action = new KAction(this);
911  action->setText(i18n("Draw To"));
912  action->setData(Editor::LineTo);
913  action->setIcon(KIcon("draw-line"));
914  action->setCheckable(true);
915  actions->addAction("lineTo", action);
916  actionGroup->addAction(action);
917 
918  action = new KAction(this);
919  action->setText(i18n("Cubic To"));
920  action->setData(Editor::CubicTo);
921  action->setIcon(KIcon("draw-bezier-curves"));
922  action->setCheckable(true);
923  actions->addAction("cubicTo", action);
924  actionGroup->addAction(action);
925 
926  action = new KAction(this);
927  action->setText(i18n("Rectangle"));
928  action->setData(Editor::Rectangle);
929  action->setIcon(KIcon("draw-rectangle"));
930  action->setCheckable(true);
931  actions->addAction("rectangle", action);
932  actionGroup->addAction(action);
933 
934  action = new KAction(this);
935  action->setText(i18n("Ellipse"));
936  action->setData(Editor::Ellipse);
937  action->setIcon(KIcon("draw-ellipse"));
938  action->setCheckable(true);
939  actions->addAction("ellipse", action);
940  actionGroup->addAction(action);
941 
942  action = new KAction(this);
943  action->setText(i18n("Insert Character"));
944  action->setData(Editor::Character);
945  action->setIcon(KIcon("character-set"));
946  action->setCheckable(true);
947  actions->addAction("character", action);
948  actionGroup->addAction(action);
949 
950  connect(actionGroup, SIGNAL(triggered(QAction*)), m_editor, SLOT(selectTool(QAction*)));
951 
952  action = new KAction(this);
953  action->setText(i18n("Rotate Left"));
954  action->setIcon(KIcon("object-rotate-left"));
955  connect(action, SIGNAL(triggered()), m_editor, SLOT(rotateLeft()));
956  actions->addAction("rotateLeft", action);
957 
958  action = new KAction(this);
959  action->setText(i18n("Rotate Right"));
960  action->setIcon(KIcon("object-rotate-right"));
961  connect(action, SIGNAL(triggered()), m_editor, SLOT(rotateRight()));
962  actions->addAction("rotateRight", action);
963 
964  action = new KAction(this);
965  action->setText(i18n("Flip Horizontal"));
966  action->setIcon(KIcon("object-flip-horizontal"));
967  connect(action, SIGNAL(triggered()), m_editor, SLOT(flipHorizontal()));
968  actions->addAction("flipHorizontal", action);
969 
970  action = new KAction(this);
971  action->setText(i18n("Flip Vertical"));
972  action->setIcon(KIcon("object-flip-vertical"));
973  connect(action, SIGNAL(triggered()), m_editor, SLOT(flipVertical()));
974  actions->addAction("flipVertical", action);
975 
976  action = new KAction(this);
977  action->setText(i18n("Scale to Preferred Size"));
978  action->setIcon(KIcon("scale-preferred"));
979  connect(action, SIGNAL(triggered()), m_editor, SLOT(scalePreferred()));
980  actions->addAction("scalePreferred", action);
981 
982  action = new KAction(this);
983  action->setText(i18n("Enable Snap"));
984  action->setIcon(KIcon("snap-to-grid"));
985  action->setCheckable(true);
986  connect(action, SIGNAL(toggled(bool)), m_editor, SLOT(enableSnap(bool)));
987  actions->addAction("enableSnap", action);
988 
989  // Settings Menu
990  KStandardAction::preferences(this, SLOT(preferences()), actions);
991 }
992 
993 
1000 {
1001  action("fillPath")->setChecked(symbol.filled());
1002 
1003  switch (symbol.path().fillRule()) {
1004  case Qt::WindingFill:
1005  action("windingFill")->setChecked(true);
1006  break;
1007 
1008  case Qt::OddEvenFill:
1009  action("oddEvenFill")->setChecked(true);
1010  break;
1011  }
1012 
1013  switch (symbol.capStyle()) {
1014  case Qt::FlatCap:
1015  action("flatCap")->setChecked(true);
1016  break;
1017 
1018  case Qt::SquareCap:
1019  action("squareCap")->setChecked(true);
1020  break;
1021 
1022  case Qt::RoundCap:
1023  action("roundCap")->setChecked(true);
1024  break;
1025  }
1026 
1027  switch (symbol.joinStyle()) {
1028  case Qt::BevelJoin:
1029  action("bevelJoin")->setChecked(true);
1030  break;
1031 
1032  case Qt::MiterJoin:
1033  action("miterJoin")->setChecked(true);
1034  break;
1035 
1036  case Qt::RoundJoin:
1037  action("roundJoin")->setChecked(true);
1038  break;
1039  }
1040 
1041  action("increaseLineWidth")->setDisabled(symbol.lineWidth() == 1.00);
1042  action("decreaseLineWidth")->setDisabled(symbol.lineWidth() == 0.01);
1043 }