View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0016884 | Scribus | User Interface | public | 2023-01-06 17:57 | 2024-07-12 14:15 |
Reporter | pmjdebruijn | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Product Version | 1.6.0.svn | ||||
Summary | 0016884: Style Manager UI resizing | ||||
Description | Currently when opening the Style Manager the first time, it's a fairly small window, however when pressing the "Edit >>" button, the window resizes (significantly larger) both horizontally and vertically. And when pressing the "<< Done" button, the window again resizes (significantly smaller) horizontally and vertically. This isn't great from a usability perspective. The attached patch... ... enforces a minimum height for the Style Manager window, so in most cases the window will only resize horizontally (caveat, the minium height of 705pixels may vary per OS, due to default fonts, so this value may need to be slightly increased) ... enforces a minimum width for the Styles list box, as it often gets "crushed" when pressing the "Edit >>" button, when a Paragraph style is selected | ||||
Tags | No tags attached. | ||||
Patch | Yes | ||||
related to | 0017134 | new | remove the expanding / collapsing of the style manager |
|
stylemanagerui.patch (1,049 bytes)
diff --git a/scribus/ui/stylemanager.ui b/scribus/ui/stylemanager.ui index be11f8d6a..fd057cdf8 100644 --- a/scribus/ui/stylemanager.ui +++ b/scribus/ui/stylemanager.ui @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>772</width> - <height>422</height> + <width>775</width> + <height>705</height> </rect> </property> <property name="sizePolicy"> @@ -19,6 +19,12 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>705</height> + </size> + </property> <property name="windowTitle"> <string>Style Manager</string> </property> @@ -53,6 +59,12 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="minimumSize"> + <size> + <width>272</width> + <height>0</height> + </size> + </property> <property name="contextMenuPolicy"> <enum>Qt::CustomContextMenu</enum> </property> |
|
Loose connection: 0009786 Hi pmjdebruijn, Would you consider making a patch for the full size style editor window? Edit button: unnecessary Done button: unnecessary Advantage if no "Edit button": -- User friendly -- Easy to use -- Faster use -- No jumping (small size -> full size -> small size). This is horrid. The size of current monitors is already quite large, no need to reduce the window size, no point, no advantage. |
|
I agree, that the button has no real use anymore, but I wanted to keep my first patch very small, so it has a very large chance of being accepted. Removing the Edit button will likely involve a large amount of refactoring, which I might want to take a look at later (though it might end up being out of my league), though I won't attempt it if I'm not having success with my other patches being accepted as well... |
|
Here's minimalist patch that essentially removes the dialog modal button, which results in a much nicer user experience indeed. The current implementation is erhm... hacky... but functional... I'll look into further refactoring... stylemanager.patch (5,006 bytes)
Index: a/scribus/ui/stylemanager.cpp =================================================================== --- a/scribus/ui/stylemanager.cpp (revision 25249) +++ a/scribus/ui/stylemanager.cpp (working copy) @@ -65,7 +65,6 @@ m_newPopup->setEnabled(false); connect(m_newPopup, SIGNAL(triggered(QAction*)), this, SLOT(slotNewPopup(QAction*))); - connect(okButton, SIGNAL(clicked()), this, SLOT(slotOk())); connect(importButton, SIGNAL(clicked()), this, SLOT(slotImport())); connect(resetButton, SIGNAL(clicked()), this, SLOT(slotClean())); connect(applyButton, SIGNAL(clicked()), this, SLOT(slotApply())); @@ -79,6 +78,7 @@ languageChange(); slotOk(); + slotOk(); } void StyleManager::changeEvent(QEvent *e) @@ -121,17 +121,11 @@ applyButton->setText( tr("&Apply")); m_doneText= tr("&Done"); m_editText= tr("&Edit"); - setOkButtonText(); newButton->setText( tr("&New")); importButton->setText( tr("&Import")); cloneButton->setText( tr("&Clone")); deleteButton->setText( tr("&Delete")); - if (m_isEditMode) - okButton->setToolTip( m_exitEditModeOk); - else - okButton->setToolTip( m_enterEditModeOk); - if (m_shortcutWidget) m_shortcutWidget->languageChange(); @@ -196,14 +190,6 @@ return nullptr; } -void StyleManager::setOkButtonText() -{ - if (!m_isStoryEditMode) - okButton->setText(m_isEditMode ? "<< " + m_doneText : m_editText + " >>"); - else - okButton->setText(CommonStrings::tr_OK); -} - void StyleManager::setDoc(ScribusDoc *doc) { ScribusDoc* oldDoc = m_doc; @@ -800,7 +786,6 @@ disconnect(styleView, SIGNAL(itemSelectionChanged()), this, SLOT(slotSetupWidget())); slotApply(); - okButton->setText(QString("%1 >>").arg( tr("&Edit"))); editFrame->hide(); applyButton->hide(); resetButton->hide(); @@ -811,7 +796,6 @@ m_items.at(i)->apply(); m_items.at(i)->editMode(false); } - okButton->setToolTip( m_enterEditModeOk); slotClean(); slotDocSelectionChanged(); @@ -853,13 +837,11 @@ m_isEditMode = true; for (int i = 0; i < m_items.count(); ++i) m_items.at(i)->editMode(true); - okButton->setToolTip( m_exitEditModeOk); slotClean(); m_prefs->set("isEditMode", m_isEditMode); connect(styleView, SIGNAL(itemSelectionChanged()), this, SLOT(slotSetupWidget())); } - setOkButtonText(); isFirst = false; resize(1, 1); // megahack to keep palette small @@ -1036,7 +1018,6 @@ { if (m_item && name.isEmpty()) { - okButton->setEnabled(false); applyButton->setEnabled(false); return; } @@ -1043,7 +1024,6 @@ if (m_item && !nameIsUnique(name)) { uniqueLabel->show(); - okButton->setEnabled(false); applyButton->setEnabled(false); return; } @@ -1050,7 +1030,6 @@ if (uniqueLabel->isVisible()) { uniqueLabel->hide(); - okButton->setEnabled(true); applyButton->setEnabled(true); } @@ -1410,7 +1389,6 @@ applyButton->setEnabled(false); slotEdit(); } - setOkButtonText(); ScrPaletteBase::showEvent(e); if (isFirst) { Index: a/scribus/ui/stylemanager.ui =================================================================== --- a/scribus/ui/stylemanager.ui (revision 25249) +++ a/scribus/ui/stylemanager.ui (working copy) @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>772</width> - <height>422</height> + <width>954</width> + <height>705</height> </rect> </property> <property name="sizePolicy"> @@ -19,6 +19,12 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="minimumSize"> + <size> + <width>954</width> + <height>705</height> + </size> + </property> <property name="windowTitle"> <string>Style Manager</string> </property> @@ -53,6 +59,12 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="minimumSize"> + <size> + <width>272</width> + <height>0</height> + </size> + </property> <property name="contextMenuPolicy"> <enum>Qt::CustomContextMenu</enum> </property> @@ -372,28 +384,6 @@ <number>0</number> </property> <item> - <widget class="QPushButton" name="okButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>85</width> - <height>24</height> - </size> - </property> - <property name="text"> - <string><< &Done</string> - </property> - <property name="shortcut"> - <string>Alt+D</string> - </property> - </widget> - </item> - <item> <widget class="QPushButton" name="applyButton"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> |
|
And this is with a very large part of the refactoring done. @PeterBenedek, would you mind testing as well? stylemanager-2.patch (13,450 bytes)
Index: a/scribus/ui/stylemanager.cpp =================================================================== --- a/scribus/ui/stylemanager.cpp (revision 25249) +++ a/scribus/ui/stylemanager.cpp (working copy) @@ -65,7 +65,6 @@ m_newPopup->setEnabled(false); connect(m_newPopup, SIGNAL(triggered(QAction*)), this, SLOT(slotNewPopup(QAction*))); - connect(okButton, SIGNAL(clicked()), this, SLOT(slotOk())); connect(importButton, SIGNAL(clicked()), this, SLOT(slotImport())); connect(resetButton, SIGNAL(clicked()), this, SLOT(slotClean())); connect(applyButton, SIGNAL(clicked()), this, SLOT(slotApply())); @@ -99,11 +98,6 @@ /***********************************/ // These are for general Style Manager widgets (not for c/pstyles except the name field - // for the "<< Done" button when in edit mode - m_exitEditModeOk = tr("Apply all changes and exit edit mode"); - // for the "Edit >>" button when not in edit mode - m_enterEditModeOk= tr("Edit styles"); - nameEdit->setToolTip( tr("Name of the selected style")); resetButton->setToolTip( tr("Reset all changes")); applyButton->setToolTip( tr("Apply all changes")); @@ -121,17 +115,11 @@ applyButton->setText( tr("&Apply")); m_doneText= tr("&Done"); m_editText= tr("&Edit"); - setOkButtonText(); newButton->setText( tr("&New")); importButton->setText( tr("&Import")); cloneButton->setText( tr("&Clone")); deleteButton->setText( tr("&Delete")); - if (m_isEditMode) - okButton->setToolTip( m_exitEditModeOk); - else - okButton->setToolTip( m_enterEditModeOk); - if (m_shortcutWidget) m_shortcutWidget->languageChange(); @@ -196,14 +184,6 @@ return nullptr; } -void StyleManager::setOkButtonText() -{ - if (!m_isStoryEditMode) - okButton->setText(m_isEditMode ? "<< " + m_doneText : m_editText + " >>"); - else - okButton->setText(CommonStrings::tr_OK); -} - void StyleManager::setDoc(ScribusDoc *doc) { ScribusDoc* oldDoc = m_doc; @@ -290,9 +270,6 @@ void StyleManager::slotDelete() { - if (!m_isEditMode) - slotOk(); // switch to edit mode before deleting - QStringList selected; if (!m_rcStyle.isNull()) @@ -379,8 +356,6 @@ //#7315 QList<QPair<QString, QString> > selected; if (dia2->exec()) { -//#7385 if (!m_isEditMode) -//#7385 slotOk(); QStringList neededColors; neededColors.clear(); @@ -505,9 +480,6 @@ void StyleManager::slotEdit() { - if (!m_isEditMode) - slotOk(); // switch to edit mode for cloning - if (m_rcStyle.isNull()) return; @@ -534,9 +506,6 @@ void StyleManager::slotClone() { - if (!m_isEditMode) - slotOk(); // switch to edit mode for cloning - if (!m_rcStyle.isNull()) { QTreeWidgetItemIterator it(styleView); @@ -582,10 +551,6 @@ void StyleManager::slotNew() { -//#5334: Don't open into edit mdoe until user has selected a style type -// if (!m_isEditMode) -// slotOk(); // switch to edit mode for a new style - // TODO maybe there's something more clever for this m_newPopup->exec(newButton->mapToGlobal(QPoint(0, newButton->height() + 2))); } @@ -592,9 +557,6 @@ void StyleManager::slotNewPopup(QAction *action) { - if (!m_isEditMode) - slotOk(); // switch to edit mode for a new style - QString typeName = m_rcType; QString actionType = action->data().toString(); if (actionType.isEmpty()) @@ -621,7 +583,7 @@ m_rcStyle.clear(); m_rcType.clear(); - if (m_isEditMode && item) // make item the only selection if in edit mode + if (item) // make item the only selection if in edit mode { // default behaviour for right clicking is not to select the item styleView->clearSelection(); styleView->setCurrentItem(item); @@ -705,7 +667,7 @@ m_rcStyle.clear(); m_rcType.clear(); - if (m_isEditMode && item) // make item the only selection if in edit mode + if (item) // make item the only selection if in edit mode { styleView->clearSelection(); styleView->setCurrentItem(item); @@ -724,8 +686,6 @@ { //slotOk will recreate all items so sitem is invalid after that call QString itext = sitem->text(0); - if (!m_isEditMode) - slotOk(); createNewStyle(itext); } m_rcStyle.clear(); @@ -794,77 +754,21 @@ // open or close edit mode void StyleManager::slotOk() { - static bool isFirst = true; - if (m_isEditMode) - { - disconnect(styleView, SIGNAL(itemSelectionChanged()), this, SLOT(slotSetupWidget())); - slotApply(); + slotSetupWidget(); - okButton->setText(QString("%1 >>").arg( tr("&Edit"))); - editFrame->hide(); - applyButton->hide(); - resetButton->hide(); - rightFrame->hide(); - m_isEditMode = false; - for (int i = 0; i < m_items.count(); ++i) - { - m_items.at(i)->apply(); - m_items.at(i)->editMode(false); - } - okButton->setToolTip( m_enterEditModeOk); - slotClean(); - slotDocSelectionChanged(); + m_editPosition.setX(x()); + m_editPosition.setY(y()); + m_prefs->set("eX", x()); + m_prefs->set("eY", y()); + editFrame->show(); + applyButton->show(); + resetButton->show(); + rightFrame->show(); + for (int i = 0; i < m_items.count(); ++i) + m_items.at(i)->editMode(true); + slotClean(); - if (!isFirst) - move(m_editPosition); - m_prefs->set("isEditMode", m_isEditMode); -// qDebug() <<"CONNECT slotOK"; -// connect(styleView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), -// this, SLOT(slotApplyStyle(QTreeWidgetItem*,QTreeWidgetItem*))); -// connect(styleView, SIGNAL(itemClicked(QTreeWidgetItem*,int)), -// this, SLOT(slotApplyStyle(QTreeWidgetItem*,int))); - if (m_isStoryEditMode) - { - m_isStoryEditMode=false; - hide(); - } - - m_rcStyle.clear(); - m_rcType.clear(); - } - else - { -// qDebug() <<"DISCONNECT slotOK"; -// disconnect(styleView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), -// this, SLOT(slotApplyStyle(QTreeWidgetItem*,QTreeWidgetItem*))); -// disconnect(styleView, SIGNAL(itemClicked(QTreeWidgetItem*,int)), -// this, SLOT(slotApplyStyle(QTreeWidgetItem*,int))); - - slotSetupWidget(); - - m_editPosition.setX(x()); - m_editPosition.setY(y()); - m_prefs->set("eX", x()); - m_prefs->set("eY", y()); - editFrame->show(); - applyButton->show(); - resetButton->show(); - rightFrame->show(); - m_isEditMode = true; - for (int i = 0; i < m_items.count(); ++i) - m_items.at(i)->editMode(true); - okButton->setToolTip( m_exitEditModeOk); - slotClean(); - - m_prefs->set("isEditMode", m_isEditMode); - connect(styleView, SIGNAL(itemSelectionChanged()), this, SLOT(slotSetupWidget())); - } - setOkButtonText(); - isFirst = false; - - resize(1, 1); // megahack to keep palette small - updateGeometry(); - adjustSize(); + connect(styleView, SIGNAL(itemSelectionChanged()), this, SLOT(slotSetupWidget())); } void StyleManager::addNewType(StyleItem *item, bool loadFromDoc) @@ -954,18 +858,16 @@ ++it; } - if (m_isEditMode) + StyleItem *tmp = m_item; + + for (int i = 0; i < m_items.count(); ++i) { - StyleItem *tmp = m_item; + m_item = m_items.at(i); + reloadStyleView(); + } + slotSetupWidget(); + m_item = tmp; - for (int i = 0; i < m_items.count(); ++i) - { - m_item = m_items.at(i); - reloadStyleView(); - } - slotSetupWidget(); - m_item = tmp; - } applyButton->setEnabled(false); resetButton->setEnabled(false); uniqueLabel->hide(); @@ -1036,7 +938,6 @@ { if (m_item && name.isEmpty()) { - okButton->setEnabled(false); applyButton->setEnabled(false); return; } @@ -1043,7 +944,6 @@ if (m_item && !nameIsUnique(name)) { uniqueLabel->show(); - okButton->setEnabled(false); applyButton->setEnabled(false); return; } @@ -1050,7 +950,6 @@ if (uniqueLabel->isVisible()) { uniqueLabel->hide(); - okButton->setEnabled(true); applyButton->setEnabled(true); } @@ -1146,18 +1045,7 @@ void StyleManager::slotApplyStyle(const QString& keyString) { - if (m_isEditMode) - return; - - QStringList slist = keyString.split(SEPARATOR, Qt::SkipEmptyParts); - Q_ASSERT(slist.count() == 2); - - loadType(slist[0]); - m_item->toSelection(slist[1]); - slotDocSelectionChanged(); - - m_rcStyle.clear(); - m_rcType.clear(); + return; } bool StyleManager::nameIsUnique(const QString &name) @@ -1224,7 +1112,7 @@ { StyleViewItem *sitem = dynamic_cast<StyleViewItem*>(item); - if (m_isEditMode || !sitem || sitem->isRoot()) + if (!sitem || sitem->isRoot()) return; // don't apply a style in edit mode or if there was no item/type selected styleView->clearSelection(); @@ -1254,44 +1142,7 @@ void StyleManager::slotDocSelectionChanged() { - if (m_isEditMode) - return; // don't track changes when in edit mode - -// qDebug() << "Style Manager : doc selection changed"; - -// qDebug() <<"DISCONNECT slotDocSelectionChanged"; -// disconnect(styleView, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), -// this, SLOT(slotApplyStyle(QTreeWidgetItem*, QTreeWidgetItem*))); - - styleView->clearSelection(); - - QList<QPair<QString, QString> > selected; - - for (int i = 0; i < m_items.count(); ++i) - selected << QPair<QString, QString>(m_items.at(i)->typeName(), m_items.at(i)->fromSelection()); - - QTreeWidgetItemIterator it(styleView, QTreeWidgetItemIterator::Selectable); - StyleViewItem *item; - - while (*it) - { - item = dynamic_cast<StyleViewItem*>(*it); - if (item) - { - for (int i = 0; i < selected.count(); ++i) - { - if (item->rootName() == selected[i].first && item->text(NAME_COL) == selected[i].second) - { - styleView->setCurrentItem(item); - item->setSelected(true); - } - } - } - ++it; - } -// qDebug() <<"CONNECT slotDocSelectionChanged"; -// connect(styleView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), -// this, SLOT(slotApplyStyle(QTreeWidgetItem*,QTreeWidgetItem*))); + return; // don't track changes when in edit mode } void StyleManager::slotDocStylesChanged() @@ -1379,7 +1230,6 @@ disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(slotDocSelectionChanged())); m_prefs->set("eX", x()); m_prefs->set("eY", y()); - m_prefs->set("isEditMode", m_isEditMode); m_prefs->set("InitX", x()); m_prefs->set("InitY", y()); storeVisibility(false); @@ -1392,7 +1242,6 @@ { m_prefs->set("eX", x()); m_prefs->set("eY", y()); - m_prefs->set("isEditMode", m_isEditMode); m_prefs->set("InitX", x()); m_prefs->set("InitY", y()); storeVisibility(false); @@ -1410,7 +1259,6 @@ applyButton->setEnabled(false); slotEdit(); } - setOkButtonText(); ScrPaletteBase::showEvent(e); if (isFirst) { @@ -1426,7 +1274,6 @@ { m_prefs->set("eX", x()); m_prefs->set("eY", y()); - m_prefs->set("isEditMode", m_isEditMode); m_prefs->set("InitX", x()); m_prefs->set("InitY", y()); storeVisibility(this->isVisible()); Index: a/scribus/ui/stylemanager.h =================================================================== --- a/scribus/ui/stylemanager.h (revision 25249) +++ a/scribus/ui/stylemanager.h (working copy) @@ -64,13 +64,10 @@ // QAction *m_rcpToScrapId; ScrAction *m_selectedStyleAction { nullptr }; - bool m_isEditMode { true }; bool m_isStoryEditMode { false }; QPoint m_editPosition; QString m_rcStyle; QString m_rcType; - QString m_exitEditModeOk; - QString m_enterEditModeOk; QString m_doneText; QString m_editText; Index: a/scribus/ui/stylemanager.ui =================================================================== --- a/scribus/ui/stylemanager.ui (revision 25249) +++ a/scribus/ui/stylemanager.ui (working copy) @@ -9,8 +9,8 @@ <rect> <x>0</x> <y>0</y> - <width>772</width> - <height>422</height> + <width>954</width> + <height>705</height> </rect> </property> <property name="sizePolicy"> @@ -19,6 +19,12 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="minimumSize"> + <size> + <width>954</width> + <height>705</height> + </size> + </property> <property name="windowTitle"> <string>Style Manager</string> </property> @@ -53,6 +59,12 @@ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="minimumSize"> + <size> + <width>272</width> + <height>0</height> + </size> + </property> <property name="contextMenuPolicy"> <enum>Qt::CustomContextMenu</enum> </property> @@ -372,28 +384,6 @@ <number>0</number> </property> <item> - <widget class="QPushButton" name="okButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>85</width> - <height>24</height> - </size> - </property> - <property name="text"> - <string><< &Done</string> - </property> - <property name="shortcut"> - <string>Alt+D</string> - </property> - </widget> - </item> - <item> <widget class="QPushButton" name="applyButton"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> |
|
Thank you very mutch pmjdebruijn! It is huge patch. |
|
Here's two screenshots illustrating how the Style Manager dialog looks after the patch: |
|
i won't miss the removed buttons! but the save and cancel could be at the same height as the lower ones on the left side... |
|
Excellent work! |
|
@ale, moving Apply/Reset into the right pane would suggest it only applies/reset the currently edited style, but those button apply to ALL edited styles, thus those buttons are exactly where they should be. |
|
I just want an OK button that applies the style and closes the window (but not important) |
|
|
|
I'd first like to see my work thus far committed before investing more time though... |
|
As @PeterBenedek pointed out, this also obsoletes 0009786 |
|
@jghali would you please take a look? |
|
i wonder if it's hard to achieve something like this... |
|
@ale @PeterBenedek suggested this as well, I might take a stab at this, if my patch thus far gets committed first. |
|
ale's suggestion: New, Clone, Import and Delete buttons should be at the bottom of the window. I don't insist on that. |
|
@PeterBenedek @ale, I won't be doing that, I think that looks much much much worse... It also makes the signalling what belongs to what slightly worse, so it's probably a minor degradation of usability as well. |
|
all in all, waiting for the current patch being applied is fine : - ) |
|
@jghali, do you see any chance of this long awaited modification being implemented? |
|
@jghali, I realize this somewhat larger patch is a bit more time consuming to review, but I've noticed no regressions thus far, any chance for you to take a look and consider it for inclusion? |
|
Hi @jghali. Maybe you didn't notice this patch... @jghali, do you see any chance of this long awaited modification being applied? |
|
I just did a quick test : I cannot apply this patch because it makes style manager much too big on my 15" screen. I can not even resize the window or access the buttons at the bottom of the dialog. One big problem for me is also that it removes the "Apply Style" functionality. |
|
@jghali, can you try without the changes in the .ui file? As those aren't critical... |
|
Please try this one stylemanager-3.patch (12,568 bytes)
Index: a/scribus/ui/stylemanager.cpp =================================================================== --- a/scribus/ui/stylemanager.cpp (revision 25249) +++ a/scribus/ui/stylemanager.cpp (working copy) @@ -65,7 +65,6 @@ m_newPopup->setEnabled(false); connect(m_newPopup, SIGNAL(triggered(QAction*)), this, SLOT(slotNewPopup(QAction*))); - connect(okButton, SIGNAL(clicked()), this, SLOT(slotOk())); connect(importButton, SIGNAL(clicked()), this, SLOT(slotImport())); connect(resetButton, SIGNAL(clicked()), this, SLOT(slotClean())); connect(applyButton, SIGNAL(clicked()), this, SLOT(slotApply())); @@ -99,11 +98,6 @@ /***********************************/ // These are for general Style Manager widgets (not for c/pstyles except the name field - // for the "<< Done" button when in edit mode - m_exitEditModeOk = tr("Apply all changes and exit edit mode"); - // for the "Edit >>" button when not in edit mode - m_enterEditModeOk= tr("Edit styles"); - nameEdit->setToolTip( tr("Name of the selected style")); resetButton->setToolTip( tr("Reset all changes")); applyButton->setToolTip( tr("Apply all changes")); @@ -121,17 +115,11 @@ applyButton->setText( tr("&Apply")); m_doneText= tr("&Done"); m_editText= tr("&Edit"); - setOkButtonText(); newButton->setText( tr("&New")); importButton->setText( tr("&Import")); cloneButton->setText( tr("&Clone")); deleteButton->setText( tr("&Delete")); - if (m_isEditMode) - okButton->setToolTip( m_exitEditModeOk); - else - okButton->setToolTip( m_enterEditModeOk); - if (m_shortcutWidget) m_shortcutWidget->languageChange(); @@ -196,14 +184,6 @@ return nullptr; } -void StyleManager::setOkButtonText() -{ - if (!m_isStoryEditMode) - okButton->setText(m_isEditMode ? "<< " + m_doneText : m_editText + " >>"); - else - okButton->setText(CommonStrings::tr_OK); -} - void StyleManager::setDoc(ScribusDoc *doc) { ScribusDoc* oldDoc = m_doc; @@ -290,9 +270,6 @@ void StyleManager::slotDelete() { - if (!m_isEditMode) - slotOk(); // switch to edit mode before deleting - QStringList selected; if (!m_rcStyle.isNull()) @@ -379,8 +356,6 @@ //#7315 QList<QPair<QString, QString> > selected; if (dia2->exec()) { -//#7385 if (!m_isEditMode) -//#7385 slotOk(); QStringList neededColors; neededColors.clear(); @@ -505,9 +480,6 @@ void StyleManager::slotEdit() { - if (!m_isEditMode) - slotOk(); // switch to edit mode for cloning - if (m_rcStyle.isNull()) return; @@ -534,9 +506,6 @@ void StyleManager::slotClone() { - if (!m_isEditMode) - slotOk(); // switch to edit mode for cloning - if (!m_rcStyle.isNull()) { QTreeWidgetItemIterator it(styleView); @@ -582,10 +551,6 @@ void StyleManager::slotNew() { -//#5334: Don't open into edit mdoe until user has selected a style type -// if (!m_isEditMode) -// slotOk(); // switch to edit mode for a new style - // TODO maybe there's something more clever for this m_newPopup->exec(newButton->mapToGlobal(QPoint(0, newButton->height() + 2))); } @@ -592,9 +557,6 @@ void StyleManager::slotNewPopup(QAction *action) { - if (!m_isEditMode) - slotOk(); // switch to edit mode for a new style - QString typeName = m_rcType; QString actionType = action->data().toString(); if (actionType.isEmpty()) @@ -621,7 +583,7 @@ m_rcStyle.clear(); m_rcType.clear(); - if (m_isEditMode && item) // make item the only selection if in edit mode + if (item) // make item the only selection if in edit mode { // default behaviour for right clicking is not to select the item styleView->clearSelection(); styleView->setCurrentItem(item); @@ -705,7 +667,7 @@ m_rcStyle.clear(); m_rcType.clear(); - if (m_isEditMode && item) // make item the only selection if in edit mode + if (item) // make item the only selection if in edit mode { styleView->clearSelection(); styleView->setCurrentItem(item); @@ -724,8 +686,6 @@ { //slotOk will recreate all items so sitem is invalid after that call QString itext = sitem->text(0); - if (!m_isEditMode) - slotOk(); createNewStyle(itext); } m_rcStyle.clear(); @@ -794,77 +754,21 @@ // open or close edit mode void StyleManager::slotOk() { - static bool isFirst = true; - if (m_isEditMode) - { - disconnect(styleView, SIGNAL(itemSelectionChanged()), this, SLOT(slotSetupWidget())); - slotApply(); + slotSetupWidget(); - okButton->setText(QString("%1 >>").arg( tr("&Edit"))); - editFrame->hide(); - applyButton->hide(); - resetButton->hide(); - rightFrame->hide(); - m_isEditMode = false; - for (int i = 0; i < m_items.count(); ++i) - { - m_items.at(i)->apply(); - m_items.at(i)->editMode(false); - } - okButton->setToolTip( m_enterEditModeOk); - slotClean(); - slotDocSelectionChanged(); + m_editPosition.setX(x()); + m_editPosition.setY(y()); + m_prefs->set("eX", x()); + m_prefs->set("eY", y()); + editFrame->show(); + applyButton->show(); + resetButton->show(); + rightFrame->show(); + for (int i = 0; i < m_items.count(); ++i) + m_items.at(i)->editMode(true); + slotClean(); - if (!isFirst) - move(m_editPosition); - m_prefs->set("isEditMode", m_isEditMode); -// qDebug() <<"CONNECT slotOK"; -// connect(styleView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), -// this, SLOT(slotApplyStyle(QTreeWidgetItem*,QTreeWidgetItem*))); -// connect(styleView, SIGNAL(itemClicked(QTreeWidgetItem*,int)), -// this, SLOT(slotApplyStyle(QTreeWidgetItem*,int))); - if (m_isStoryEditMode) - { - m_isStoryEditMode=false; - hide(); - } - - m_rcStyle.clear(); - m_rcType.clear(); - } - else - { -// qDebug() <<"DISCONNECT slotOK"; -// disconnect(styleView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), -// this, SLOT(slotApplyStyle(QTreeWidgetItem*,QTreeWidgetItem*))); -// disconnect(styleView, SIGNAL(itemClicked(QTreeWidgetItem*,int)), -// this, SLOT(slotApplyStyle(QTreeWidgetItem*,int))); - - slotSetupWidget(); - - m_editPosition.setX(x()); - m_editPosition.setY(y()); - m_prefs->set("eX", x()); - m_prefs->set("eY", y()); - editFrame->show(); - applyButton->show(); - resetButton->show(); - rightFrame->show(); - m_isEditMode = true; - for (int i = 0; i < m_items.count(); ++i) - m_items.at(i)->editMode(true); - okButton->setToolTip( m_exitEditModeOk); - slotClean(); - - m_prefs->set("isEditMode", m_isEditMode); - connect(styleView, SIGNAL(itemSelectionChanged()), this, SLOT(slotSetupWidget())); - } - setOkButtonText(); - isFirst = false; - - resize(1, 1); // megahack to keep palette small - updateGeometry(); - adjustSize(); + connect(styleView, SIGNAL(itemSelectionChanged()), this, SLOT(slotSetupWidget())); } void StyleManager::addNewType(StyleItem *item, bool loadFromDoc) @@ -954,18 +858,16 @@ ++it; } - if (m_isEditMode) + StyleItem *tmp = m_item; + + for (int i = 0; i < m_items.count(); ++i) { - StyleItem *tmp = m_item; + m_item = m_items.at(i); + reloadStyleView(); + } + slotSetupWidget(); + m_item = tmp; - for (int i = 0; i < m_items.count(); ++i) - { - m_item = m_items.at(i); - reloadStyleView(); - } - slotSetupWidget(); - m_item = tmp; - } applyButton->setEnabled(false); resetButton->setEnabled(false); uniqueLabel->hide(); @@ -1036,7 +938,6 @@ { if (m_item && name.isEmpty()) { - okButton->setEnabled(false); applyButton->setEnabled(false); return; } @@ -1043,7 +944,6 @@ if (m_item && !nameIsUnique(name)) { uniqueLabel->show(); - okButton->setEnabled(false); applyButton->setEnabled(false); return; } @@ -1050,7 +950,6 @@ if (uniqueLabel->isVisible()) { uniqueLabel->hide(); - okButton->setEnabled(true); applyButton->setEnabled(true); } @@ -1146,18 +1045,7 @@ void StyleManager::slotApplyStyle(const QString& keyString) { - if (m_isEditMode) - return; - - QStringList slist = keyString.split(SEPARATOR, Qt::SkipEmptyParts); - Q_ASSERT(slist.count() == 2); - - loadType(slist[0]); - m_item->toSelection(slist[1]); - slotDocSelectionChanged(); - - m_rcStyle.clear(); - m_rcType.clear(); + return; } bool StyleManager::nameIsUnique(const QString &name) @@ -1224,7 +1112,7 @@ { StyleViewItem *sitem = dynamic_cast<StyleViewItem*>(item); - if (m_isEditMode || !sitem || sitem->isRoot()) + if (!sitem || sitem->isRoot()) return; // don't apply a style in edit mode or if there was no item/type selected styleView->clearSelection(); @@ -1254,44 +1142,7 @@ void StyleManager::slotDocSelectionChanged() { - if (m_isEditMode) - return; // don't track changes when in edit mode - -// qDebug() << "Style Manager : doc selection changed"; - -// qDebug() <<"DISCONNECT slotDocSelectionChanged"; -// disconnect(styleView, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), -// this, SLOT(slotApplyStyle(QTreeWidgetItem*, QTreeWidgetItem*))); - - styleView->clearSelection(); - - QList<QPair<QString, QString> > selected; - - for (int i = 0; i < m_items.count(); ++i) - selected << QPair<QString, QString>(m_items.at(i)->typeName(), m_items.at(i)->fromSelection()); - - QTreeWidgetItemIterator it(styleView, QTreeWidgetItemIterator::Selectable); - StyleViewItem *item; - - while (*it) - { - item = dynamic_cast<StyleViewItem*>(*it); - if (item) - { - for (int i = 0; i < selected.count(); ++i) - { - if (item->rootName() == selected[i].first && item->text(NAME_COL) == selected[i].second) - { - styleView->setCurrentItem(item); - item->setSelected(true); - } - } - } - ++it; - } -// qDebug() <<"CONNECT slotDocSelectionChanged"; -// connect(styleView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), -// this, SLOT(slotApplyStyle(QTreeWidgetItem*,QTreeWidgetItem*))); + return; // don't track changes when in edit mode } void StyleManager::slotDocStylesChanged() @@ -1379,7 +1230,6 @@ disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(slotDocSelectionChanged())); m_prefs->set("eX", x()); m_prefs->set("eY", y()); - m_prefs->set("isEditMode", m_isEditMode); m_prefs->set("InitX", x()); m_prefs->set("InitY", y()); storeVisibility(false); @@ -1392,7 +1242,6 @@ { m_prefs->set("eX", x()); m_prefs->set("eY", y()); - m_prefs->set("isEditMode", m_isEditMode); m_prefs->set("InitX", x()); m_prefs->set("InitY", y()); storeVisibility(false); @@ -1410,7 +1259,6 @@ applyButton->setEnabled(false); slotEdit(); } - setOkButtonText(); ScrPaletteBase::showEvent(e); if (isFirst) { @@ -1426,7 +1274,6 @@ { m_prefs->set("eX", x()); m_prefs->set("eY", y()); - m_prefs->set("isEditMode", m_isEditMode); m_prefs->set("InitX", x()); m_prefs->set("InitY", y()); storeVisibility(this->isVisible()); Index: a/scribus/ui/stylemanager.h =================================================================== --- a/scribus/ui/stylemanager.h (revision 25249) +++ a/scribus/ui/stylemanager.h (working copy) @@ -64,13 +64,10 @@ // QAction *m_rcpToScrapId; ScrAction *m_selectedStyleAction { nullptr }; - bool m_isEditMode { true }; bool m_isStoryEditMode { false }; QPoint m_editPosition; QString m_rcStyle; QString m_rcType; - QString m_exitEditModeOk; - QString m_enterEditModeOk; QString m_doneText; QString m_editText; Index: a/scribus/ui/stylemanager.ui =================================================================== --- a/scribus/ui/stylemanager.ui (revision 25249) +++ a/scribus/ui/stylemanager.ui (working copy) @@ -372,28 +384,6 @@ <number>0</number> </property> <item> - <widget class="QPushButton" name="okButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>85</width> - <height>24</height> - </size> - </property> - <property name="text"> - <string><< &Done</string> - </property> - <property name="shortcut"> - <string>Alt+D</string> - </property> - </widget> - </item> - <item> <widget class="QPushButton" name="applyButton"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> |
Date Modified | Username | Field | Change |
---|---|---|---|
2023-01-06 17:57 | pmjdebruijn | New Issue | |
2023-01-06 17:57 | pmjdebruijn | File Added: stylemanagerui.patch | |
2023-01-07 13:06 | PeterBenedek | Note Added: 0049856 | |
2023-01-07 13:22 | pmjdebruijn | Note Added: 0049857 | |
2023-01-11 17:06 | pmjdebruijn | Note Added: 0049877 | |
2023-01-11 17:06 | pmjdebruijn | File Added: stylemanager.patch | |
2023-01-11 18:32 | pmjdebruijn | Note Added: 0049879 | |
2023-01-11 18:32 | pmjdebruijn | File Added: stylemanager-2.patch | |
2023-01-11 20:03 | PeterBenedek | Note Added: 0049881 | |
2023-01-12 17:10 | pmjdebruijn | Note Added: 0049888 | |
2023-01-12 17:10 | pmjdebruijn | File Added: scribus_style_manager_first_open.png | |
2023-01-12 17:10 | pmjdebruijn | File Added: scribus_style_manager_paragraph_style.png | |
2023-01-12 17:23 | ale | Note Added: 0049889 | |
2023-01-12 17:35 | PeterBenedek | Note Added: 0049890 | |
2023-01-12 17:56 | pmjdebruijn | Note Added: 0049891 | |
2023-01-12 18:13 | PeterBenedek | Note Added: 0049892 | |
2023-01-12 18:19 | PeterBenedek | Note Added: 0049893 | |
2023-01-12 18:19 | PeterBenedek | File Added: Clipboard 1.jpg | |
2023-01-12 18:21 | PeterBenedek | Note Edited: 0049892 | |
2023-01-12 18:47 | pmjdebruijn | Note Added: 0049894 | |
2023-01-12 18:54 | pmjdebruijn | Note Added: 0049895 | |
2023-01-13 16:12 | pmjdebruijn | Note Added: 0049902 | |
2023-01-14 08:28 | ale | Note Added: 0049908 | |
2023-01-14 08:28 | ale | File Added: Clipboard 1-2.jpg | |
2023-01-14 10:43 | pmjdebruijn | Note Added: 0049910 | |
2023-01-14 11:13 | PeterBenedek | Note Added: 0049911 | |
2023-01-14 11:42 | pmjdebruijn | Note Added: 0049913 | |
2023-01-14 17:04 | ale | Note Added: 0049917 | |
2023-01-15 19:03 | PeterBenedek | Note Added: 0049934 | |
2023-01-16 15:06 | PeterBenedek | Note Edited: 0049934 | |
2023-01-25 16:55 | pmjdebruijn | Note Added: 0049978 | |
2023-03-16 14:47 | PeterBenedek | Note Added: 0050032 | |
2023-03-16 17:42 | jghali | Note Added: 0050033 | |
2023-03-20 18:20 | pmjdebruijn | Note Added: 0050041 | |
2023-03-21 17:25 | pmjdebruijn | Note Added: 0050042 | |
2023-03-21 17:25 | pmjdebruijn | File Added: stylemanager-3.patch | |
2024-01-20 09:38 | ale | Relationship added | related to 0017134 |