Skip to content

Idefix Menu "Preview Display Mode"#2793

Merged
sunderme merged 5 commits intotexstudio-org:masterfrom
octaeder:previewModeMenu
Dec 23, 2022
Merged

Idefix Menu "Preview Display Mode"#2793
sunderme merged 5 commits intotexstudio-org:masterfrom
octaeder:previewModeMenu

Conversation

@octaeder
Copy link
Copy Markdown
Contributor

This PR adds a preview options group menu to the idefix menu and resolves #2760.

grafik

@octaeder
Copy link
Copy Markdown
Contributor Author

@sunderme Can you help with the broken CI? What should line 1473

configManager.previewMode = act->data().valueConfigManager::PreviewMode();

look like?




QActionGroup *previewModeGroup = nullptr;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no need to use a global variable here.
global variables are considered bad in cpp.

act->setData(ConfigManager::PM_TOOLTIP_AS_FALLBACK);
act->setCheckable(true);
previewModeGroup->addAction(act);
act = newManagedAction(submenu, "preview2", tr("Always show preview in preview panel"), SLOT(setPreviewMode()));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

menu names should be, at least a little, self-explanatory.
preview2 (etc.) is definitely not.
There is a reason why the enum is called PM_PANEL.

act->setData(ConfigManager::PM_INLINE);
act->setCheckable(true);
previewModeGroup->addAction(act);
act = newManagedAction(submenu, "preview6", tr("Show in embedded viewer"), SLOT(setPreviewMode()));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you look at configdialog.cpp ll. 584..590, the last option is not present if no pdf previewer is build.

@sunderme
Copy link
Copy Markdown
Member

in configmanager.h Q_DECLARE_METATYPE(ConfigManager::PreviewMode); is missing at one before last line. (CI failure)

@sunderme
Copy link
Copy Markdown
Member

and for consistency, I would actually prefer to stick to txs way of using menus.
An example which basically does the exact same thing is "line ending" (menu edit).
see texstudio.cpp lines 1849-1867 and 1028ff

@octaeder
Copy link
Copy Markdown
Contributor Author

hope this is the last change. Thanks for your support.


ConfigManager::PreviewMode pm = configManager.previewMode;
switch (pm) {
case ConfigManager::PM_TOOLTIP_AS_FALLBACK:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is okay.
The action selection could be moved in an extra function as it is basically used twice.

@sunderme
Copy link
Copy Markdown
Member

thanks

@sunderme sunderme merged commit dd12a3d into texstudio-org:master Dec 23, 2022
@octaeder octaeder deleted the previewModeMenu branch December 23, 2022 11:18
@octaeder
Copy link
Copy Markdown
Contributor Author

octaeder commented Dec 28, 2022

@sunderme I see that the German translation misses the accelerator key (&p) for the sub menu (s. image above). Is this intended?

grafik

@sunderme
Copy link
Copy Markdown
Member

no

@octaeder
Copy link
Copy Markdown
Contributor Author

changed to: Vorschau &Modus

sunderme added a commit that referenced this pull request Dec 29, 2022
This is based on PR #2803 by Octaeder. The main difference is that it
does not use QAction manipulation/copying.

Implements #2793
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

provide option to change preview display mode from idefix > preview menu entry

2 participants