View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0017134 | Scribus | User Interface | public | 2024-01-20 09:36 | 2026-07-11 07:13 |
| Reporter | ale | Assigned To | |||
| Priority | normal | Severity | feature | Reproducibility | N/A |
| Status | new | Resolution | open | ||
| Product Version | 1.7.0.svn | ||||
| Summary | 0017134: remove the expanding / collapsing of the style manager | ||||
| Description | since it's not possible (nor planned) to use the style manager to apply styles, i don't see the interest on having a collapsed view. the code managing it is rather complex and the benefit is small or even negative (personally, i feel that the need to expand the view is only a useless extra task to be done each time the style manager is first opened) i guess that the only use case where the dialog is of some use in its collapsed state is when importing styles. but i don't think that the dialog being already expanded will bother anybody. (another one, would be to make the dialog smaller and check the changes applied in the text behind it... but in that case pressing F4 is much more effective, since it does not lose the context in the style manager) if jean and craig agree, i can work on a patch. | ||||
| Tags | No tags attached. | ||||
| Patch | No | ||||
|
|
p.s.: there are lot of bugs that have been submitted over the years for the positioning of the collapsed / expanded style manager. and there is even already a patch by pmjdebruijn that -- among other things -- removes the expanding / collapsing that has been sitting around for a year now. |
|
|
>> since it's not possible (nor planned) to use the style manager to apply styles Uh!? Right-click a style on left pane > Apply |
|
|
wow! in the same dialog, do we really have an "Apply" button that saves the current changes but does not apply the style to the current text, and an "Apply" command hidden in the context menu that applies to the current text but does not save the current changes? i have to admit that i've never noticed the command in the context menu and i wonder if anybody every used it! even when knowing about, i'm really not sure that anybody will prefer it, to using the palettes for it. this morning i've spent a couple of hours trying to understand how the click on a style name in the list leads to the style properties being loaded on the right side. with no luck. but i've noticed that the expansion mechanism and the context menu build upon some rather complex bits of code. both seem to be of very little (if any) use to the users. so, yes, i still would like to suggest the remove of the expansion mechanism and also try to suggest the removal of the context menu (and moving the apply in there close to the apply button... while fixing the naming conflict). this way the style manager could slowly become easier to read and the user will have a better dialog. p.s.: i still could need a hint: where is the slot triggered by selecting the style in the list to show its details in the right pane? |
|
|
oufh, i'm a bit relieved... the "apply" context menu seems to be doing nothing at all. |
|
|
KEY CHANGES (AI EXPLAINS) ------ - Style Manager opens expanded with Default Paragraph Style selected. - 'Apply' renamed to 'Save Changes', including tooltip and Alt+S. - Confirmed the current source already commits deletions through slotOk() → slotApply(). The patch now calls slotApply() directly, making deletion immediate while avoiding the collapse. - After Delete and Delete Unused, the default style from the affected category is selected. - After deleting a style, the SM stays in expanded mode (does not collapse) - Added 'Close' to the right of Reset. - Closing with unsaved changes displays Save / Discard / Cancel. No prompt appears when there are no changes. - Reopening after using the collapsed mode restores expanded editing mode. The patch passed clean-application, whitespace, content-comparison, and .ui XML validation. A full compilation was not possible because Qt development tooling is unavailable in the environment. 3_style-manager-expanded-save-delete-close-r27707.patch (10,375 bytes)
diff --git a/scribus/ui/stylemanager.cpp b/scribus/ui/stylemanager.cpp
index a0b22bc..91d12f3 100644
--- a/scribus/ui/stylemanager.cpp
+++ b/scribus/ui/stylemanager.cpp
@@ -67,6 +67,7 @@ StyleManager::StyleManager(QWidget *parent, const char *name)
connect(importButton, SIGNAL(clicked()), this, SLOT(slotImport()));
connect(resetButton, SIGNAL(clicked()), this, SLOT(slotClean()));
connect(applyButton, SIGNAL(clicked()), this, SLOT(slotApply()));
+ connect(closeButton, SIGNAL(clicked()), this, SLOT(slotClose()));
connect(deleteButton, SIGNAL(clicked()), this, SLOT(slotDelete()));
connect(deleteUnusedButton, SIGNAL(clicked()), this, SLOT(slotDeleteUnused()));
connect(cloneButton, SIGNAL(clicked()), this, SLOT(slotClone()));
@@ -97,13 +98,14 @@ void StyleManager::languageChange()
// 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");
+ m_exitEditModeOk = tr("Save all changes and exit style editing");
// 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"));
+ resetButton->setToolTip( tr("Discard all unsaved style changes"));
+ applyButton->setToolTip( tr("Save all style changes to the document"));
+ closeButton->setToolTip( tr("Close the Style Manager; unsaved changes will be offered for saving or discarding"));
newButton->setToolTip( tr("Create a new style"));
importButton->setToolTip( tr("Import styles from another document"));
cloneButton->setToolTip( tr("Clone selected style"));
@@ -116,7 +118,8 @@ void StyleManager::languageChange()
nameLabel->setText( tr("Name:"));
resetButton->setText( tr("&Reset"));
- applyButton->setText( tr("&Apply"));
+ applyButton->setText( tr("&Save Changes"));
+ closeButton->setText( tr("C&lose"));
m_doneText= tr("&Done");
m_editText= tr("&Edit");
setOkButtonText();
@@ -273,6 +276,9 @@ void StyleManager::setDoc(ScribusDoc *doc)
m_items.at(i)->unitChange();
}
styleView->resizeColumnToContents(0);
+
+ if (m_doc)
+ selectDefaultStyle(this->item<SMParagraphStyle>());
}
void StyleManager::refreshLists()
@@ -343,6 +349,7 @@ void StyleManager::reloadStyles()
addNewType(m_items.at(i));
}
styleView->resizeColumnToContents(0);
+ selectDefaultStyle(this->item<SMParagraphStyle>());
}
void StyleManager::showAsEditParagraphStyle(const QString &name)
@@ -398,6 +405,11 @@ void StyleManager::slotApply()
slotClean();
}
+void StyleManager::slotClose()
+{
+ close();
+}
+
void StyleManager::slotDelete()
{
// Snapshot the selection before entering edit mode. Entering edit mode rebuilds
@@ -405,11 +417,15 @@ void StyleManager::slotDelete()
// selection that spans more than one type does not survive that rebuild, so it
// has to be captured while the browse-mode tree is still intact.
QMap<StyleItem*, QStringList> selectedByItem;
+ StyleItem* postDeleteSelection = nullptr;
if (!m_rcStyle.isNull())
{
if (m_item)
+ {
selectedByItem[m_item] << m_rcStyle; // right-click: m_item is the clicked type
+ postDeleteSelection = m_item;
+ }
}
else
{
@@ -429,7 +445,11 @@ void StyleManager::slotDelete()
}
}
if (owner)
+ {
selectedByItem[owner] << sv->text(NAME_COL);
+ if (!postDeleteSelection)
+ postDeleteSelection = owner;
+ }
}
++it;
}
@@ -519,8 +539,8 @@ void StyleManager::slotDelete()
applyButton->setEnabled(true);
resetButton->setEnabled(true);
- reloadStyleView(false);
- slotOk();
+ slotApply();
+ selectDefaultStyle(postDeleteSelection);
}
void StyleManager::slotDeleteUnused()
@@ -528,6 +548,8 @@ void StyleManager::slotDeleteUnused()
if (!m_doc)
return;
+ StyleItem* postDeleteSelection = m_item;
+
// Scan page items to find styles referenced by content
ResourceCollection usedResources;
m_doc->getUsedStylesFromItems(usedResources);
@@ -608,6 +630,9 @@ void StyleManager::slotDeleteUnused()
if (result != QMessageBox::Yes)
return;
+ if (!postDeleteSelection && !deletions.isEmpty())
+ postDeleteSelection = deletions.first().item;
+
// Delete through each StyleItem — modifies temp copies only
for (int i = 0; i < deletions.count(); ++i)
deletions[i].item->deleteStyles(deletions[i].removeList);
@@ -615,8 +640,8 @@ void StyleManager::slotDeleteUnused()
// Mark dirty and refresh, then apply (same flow as slotDelete)
applyButton->setEnabled(true);
resetButton->setEnabled(true);
- reloadStyleView(false);
- slotOk();
+ slotApply();
+ selectDefaultStyle(postDeleteSelection);
}
@@ -885,6 +910,47 @@ void StyleManager::setSelection(const QList<QPair<QString, QString> > &selected)
}
}
+void StyleManager::selectDefaultStyle(StyleItem *preferredItem)
+{
+ QList<StyleItem*> candidates;
+ if (preferredItem)
+ candidates.append(preferredItem);
+
+ SMParagraphStyle* paragraphStyles = this->item<SMParagraphStyle>();
+ if (paragraphStyles && paragraphStyles != preferredItem)
+ candidates.append(paragraphStyles);
+
+ for (int i = 0; i < candidates.count(); ++i)
+ {
+ StyleItem* styleItem = candidates.at(i);
+ StyleViewItem* defaultItem = nullptr;
+ QTreeWidgetItemIterator it(styleView, QTreeWidgetItemIterator::Selectable);
+
+ while (*it)
+ {
+ StyleViewItem* item = dynamic_cast<StyleViewItem*>(*it);
+ if (item && item->rootName() == styleItem->typeName() && styleItem->isDefaultStyle(item->text(NAME_COL)))
+ {
+ defaultItem = item;
+ break;
+ }
+ ++it;
+ }
+
+ if (!defaultItem)
+ continue;
+
+ styleView->clearSelection();
+ for (QTreeWidgetItem* parent = defaultItem->parent(); parent; parent = parent->parent())
+ styleView->expandItem(parent);
+ styleView->setCurrentItem(defaultItem);
+ defaultItem->setSelected(true);
+ styleView->scrollToItem(defaultItem);
+ slotSetupWidget();
+ return;
+ }
+}
+
void StyleManager::slotEdit()
{
if (!m_isEditMode)
@@ -1779,6 +1845,27 @@ void StyleManager::hideEvent(QHideEvent *e)
void StyleManager::closeEvent(QCloseEvent *e)
{
+ if (applyButton->isEnabled())
+ {
+ QMessageBox::StandardButton result = ScMessageBox::warning(this,
+ tr("Unsaved Style Changes"),
+ tr("The Style Manager contains unsaved changes. Save them before closing?"),
+ QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
+ QMessageBox::Save,
+ QMessageBox::Cancel);
+
+ if (result == QMessageBox::Cancel)
+ {
+ e->ignore();
+ return;
+ }
+
+ if (result == QMessageBox::Save)
+ slotApply();
+ else
+ slotClean();
+ }
+
m_prefs->set("eX", x());
m_prefs->set("eY", y());
m_prefs->set("isEditMode", m_isEditMode);
@@ -1799,6 +1886,12 @@ void StyleManager::showEvent(QShowEvent *e)
applyButton->setEnabled(false);
slotEdit();
}
+ else
+ {
+ if (!m_isEditMode)
+ slotOk();
+ selectDefaultStyle(this->item<SMParagraphStyle>());
+ }
setOkButtonText();
ScrPaletteBase::showEvent(e);
if (isFirst)
diff --git a/scribus/ui/stylemanager.h b/scribus/ui/stylemanager.h
index f47a98e..859ce7e 100644
--- a/scribus/ui/stylemanager.h
+++ b/scribus/ui/stylemanager.h
@@ -82,7 +82,7 @@ private:
QAction *m_rcpCloneId { nullptr };
ScrAction *m_selectedStyleAction { nullptr };
- bool m_isEditMode { true };
+ bool m_isEditMode { false };
bool m_isStoryEditMode { false };
QPoint m_editPosition;
QString m_rcStyle;
@@ -121,6 +121,7 @@ private:
void updateActionName(const QString &oldName, const QString &newName);
/* QPair.first = type name and QPair.second = style name */
void setSelection(const QList<QPair<QString, QString> > &selected);
+ void selectDefaultStyle(StyleItem *preferredItem = nullptr);
void setOkButtonText();
void editStyleByName(int rcType, const QString &name);
@@ -130,6 +131,7 @@ private:
private slots:
void slotOk();
void slotApply();
+ void slotClose();
void slotDelete();
/**
* @brief Find and remove all styles not in use by any document content.
@@ -139,10 +141,10 @@ private slots:
* that is not referenced and is not a default style is offered for
* removal. Parent styles of used styles are always preserved.
*
- * Operates through the Style Manager's normal edit/apply flow:
+ * Operates through the Style Manager's normal edit/save flow:
* enters edit mode, calls deleteStyles() on temp copies for each
- * StyleItem, then commits via slotOk(). The user is shown a
- * confirmation dialog before any styles are removed.
+ * StyleItem, then commits via slotApply() without leaving edit mode.
+ * The user is shown a confirmation dialog before any styles are removed.
*/
void slotDeleteUnused();
void slotImport();
diff --git a/scribus/ui/stylemanager.ui b/scribus/ui/stylemanager.ui
index 5e9e5db..e9e27bf 100644
--- a/scribus/ui/stylemanager.ui
+++ b/scribus/ui/stylemanager.ui
@@ -393,10 +393,10 @@
</size>
</property>
<property name="text">
- <string>&Apply</string>
+ <string>&Save Changes</string>
</property>
<property name="shortcut">
- <string>Alt+A</string>
+ <string>Alt+S</string>
</property>
<property name="autoDefault">
<bool>false</bool>
@@ -428,6 +428,31 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QPushButton" name="closeButton">
+ <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>C&lose</string>
+ </property>
+ <property name="shortcut">
+ <string>Alt+L</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
</layout>
|
|
|
|
|
|
I plan to rewrite the interaction in the Style Manager. I'm currently working on a Style Browser that will allow us to remove the collapsing from the Style manager. See 0017858 Then, we can remove much of the interaction code and largely simplify it. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2024-01-20 09:36 | ale | New Issue | |
| 2024-01-20 09:37 | ale | Relationship added | related to 0009786 |
| 2024-01-20 09:38 | ale | Relationship added | related to 0016884 |
| 2024-01-20 09:43 | ale | Note Added: 0050914 | |
| 2024-01-20 13:38 | jghali | Note Added: 0050915 | |
| 2024-01-20 15:25 | ale | Note Added: 0050916 | |
| 2024-02-01 14:49 | ale | Note Added: 0050958 | |
| 2026-06-21 14:28 | ale | Relationship added | related to 0017859 |
| 2026-07-11 06:21 | qirat | Note Added: 0054012 | |
| 2026-07-11 06:21 | qirat | File Added: 3_style-manager-expanded-save-delete-close-r27707.patch | |
| 2026-07-11 06:29 | qirat | Note Added: 0054015 | |
| 2026-07-11 06:29 | qirat | File Added: 3_style-manager-expanded-save-delete-close_annot.jpg | |
| 2026-07-11 07:13 | ale | Note Added: 0054016 |