Changeset View
Standalone View
lib/documentview/documentviewcontroller.cpp
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | 75 | { | |||
---|---|---|---|---|---|
76 | DocumentViewController* q; | 76 | DocumentViewController* q; | ||
77 | KActionCollection* mActionCollection; | 77 | KActionCollection* mActionCollection; | ||
78 | DocumentView* mView; | 78 | DocumentView* mView; | ||
79 | ZoomWidget* mZoomWidget; | 79 | ZoomWidget* mZoomWidget; | ||
80 | SlideContainer* mToolContainer; | 80 | SlideContainer* mToolContainer; | ||
81 | ToolContainerContent* mToolContainerContent; | 81 | ToolContainerContent* mToolContainerContent; | ||
82 | 82 | | |||
83 | QAction * mZoomToFitAction; | 83 | QAction * mZoomToFitAction; | ||
84 | QAction * mZoomToFitWidthAction; | 84 | QAction * mZoomToFillAction; | ||
85 | QAction * mActualSizeAction; | 85 | QAction * mActualSizeAction; | ||
86 | QAction * mZoomInAction; | 86 | QAction * mZoomInAction; | ||
87 | QAction * mZoomOutAction; | 87 | QAction * mZoomOutAction; | ||
88 | QList<QAction *> mActions; | 88 | QList<QAction *> mActions; | ||
89 | 89 | | |||
90 | void setupActions() | 90 | void setupActions() | ||
91 | { | 91 | { | ||
92 | KActionCategory* view = new KActionCategory(i18nc("@title actions category - means actions changing smth in interface", "View"), mActionCollection); | 92 | KActionCategory* view = new KActionCategory(i18nc("@title actions category - means actions changing smth in interface", "View"), mActionCollection); | ||
93 | 93 | | |||
94 | mZoomToFitAction = view->addAction("view_zoom_to_fit"); | 94 | mZoomToFitAction = view->addAction("view_zoom_to_fit"); | ||
95 | view->collection()->setDefaultShortcut(mZoomToFitAction, Qt::Key_F); | 95 | view->collection()->setDefaultShortcut(mZoomToFitAction, Qt::Key_F); | ||
96 | mZoomToFitAction->setCheckable(true); | 96 | mZoomToFitAction->setCheckable(true); | ||
97 | mZoomToFitAction->setChecked(true); | 97 | mZoomToFitAction->setChecked(true); | ||
98 | mZoomToFitAction->setText(i18n("Zoom to Fit")); | 98 | mZoomToFitAction->setText(i18n("Zoom to fit")); | ||
99 | mZoomToFitAction->setIcon(QIcon::fromTheme("zoom-fit-best")); | 99 | mZoomToFitAction->setIcon(QIcon::fromTheme("zoom-fit-best")); | ||
100 | mZoomToFitAction->setIconText(i18nc("@action:button Zoom to fit, shown in status bar, keep it short please", "Fit")); | 100 | mZoomToFitAction->setIconText(i18nc("@action:button Zoom to fit, shown in status bar, keep it short please", "Fit")); | ||
101 | 101 | | |||
102 | mZoomToFitWidthAction = view->addAction("view_zoom_to_fit_width"); | 102 | mZoomToFillAction = view->addAction("view_zoom_to_fill"); | ||
103 | //view->collection()->setDefaultShortcuts(mZoomToFitWidthAction, Qt::Key_W); ?? | 103 | //view->collection()->setDefaultShortcuts(mZoomToFillAction, Qt::Key_W); ?? | ||
104 | mZoomToFitWidthAction->setCheckable(true); | 104 | mZoomToFillAction->setCheckable(true); | ||
105 | mZoomToFitWidthAction->setChecked(false); | 105 | mZoomToFillAction->setChecked(false); | ||
106 | mZoomToFitWidthAction->setText(i18n("Zoom to Fit Width")); | 106 | mZoomToFillAction->setText(i18n("Zoom to fill window by fitting to width or height")); | ||
rkflx: Could you try to come up with a better tooltip, more akin to the one for {nav 100%}? | |||||
Would it not be better to change all tooltips to something like Zoom to fit/fill screen and Zoom to actual size (Lightroom actually uses "Zoom to 100%")? I can't come up with something good that is similar to the one for 100%. Slightly off topic, but I don't think anyone actually thinks of themselves as viewing "documents" in an image viewer, so that standard text suits us quite badly anyways. slenz: Would it not be better to change all tooltips to something like `Zoom to fit/fill screen` and… | |||||
Yeah, that's not ideal. What I meant was not the text, but the fact the explanation is longer. IMO the tooltips serve multiple purposes:
Let's keep it for now as is, perhaps later we'll have a better idea for the wording. I don't want to only repeat what's on the button, but phrase it differently.
Gwenview's target user base is very different, I feel Darktable or RawTherapee users are more technical than the average Gwenview user. rkflx: > documents
Yeah, that's not ideal. What I meant was not the text, but the fact the… | |||||
muhlenpfordt: What about e.g. "Zoom to fit smaller side" as tooltip? | |||||
rkflx: Good idea.
smaller → narrower? | |||||
Not really true? Would depend on the current combination of window aspect ratio to image aspect ratio (4:3 image on a 16:9 window does fit width even if that is bigger). slenz: Not really true? Would depend on the current combination of window aspect ratio to image aspect… | |||||
I love your attention to detail ;) How about "Zoom to fill screen by fitting to width or height" rkflx: I love your attention to detail ;)
How about "Zoom to fill screen by fitting to width or… | |||||
Also: While 3e10699ac37c did not add anything to doc/index.docbook (grep for slider at the bottom), I think it might be worth explaining what the button does, as it may not be obvious to every user unless they are adventurous enough to Rotate when experimenting. rkflx: Also: While 3e10699ac37c did not add anything to `doc/index.docbook` (grep for `slider at the… | |||||
Updated but untested. I can't get khelpcenter to actually use my new documentation instead. Perhaps some shell variables I'm missing? slenz: Updated but untested. I can't get khelpcenter to actually use my new documentation instead. | |||||
We should improve our documentation on that, for now see here: https://phabricator.kde.org/D10295#206872 rkflx: We should improve our documentation on that, for now see here: https://phabricator.kde. | |||||
Can you make that "window" instead of "screen"? (Just like you proposed in the docbook.) rkflx: Can you make that "window" instead of "screen"? (Just like you proposed in the docbook.) | |||||
107 | mZoomToFitWidthAction->setIcon(QIcon::fromTheme("zoom-fit-best")); | 107 | mZoomToFillAction->setIcon(QIcon::fromTheme("zoom-fit-best")); | ||
108 | mZoomToFitWidthAction->setIconText(i18nc("@action:button Zoom to fit width, shown in status bar, keep it short please", "Fit Width")); | 108 | mZoomToFillAction->setIconText(i18nc("@action:button Zoom to fill (fit width or height), shown in status bar, keep it short please", "Fill")); | ||
rkflx: Perhaps add `(fit width or height)` after `to fill`? | |||||
109 | 109 | | |||
110 | mActualSizeAction = view->addAction(KStandardAction::ActualSize); | 110 | mActualSizeAction = view->addAction(KStandardAction::ActualSize); | ||
111 | mActualSizeAction->setCheckable(true); | 111 | mActualSizeAction->setCheckable(true); | ||
112 | mZoomToFitWidthAction->setChecked(false); | 112 | mZoomToFillAction->setChecked(false); | ||
113 | mActualSizeAction->setIcon(QIcon::fromTheme("zoom-original")); | 113 | mActualSizeAction->setIcon(QIcon::fromTheme("zoom-original")); | ||
114 | mActualSizeAction->setIconText(i18nc("@action:button Zoom to original size, shown in status bar, keep it short please", "100%")); | 114 | mActualSizeAction->setIconText(i18nc("@action:button Zoom to original size, shown in status bar, keep it short please", "100%")); | ||
115 | 115 | | |||
116 | mZoomInAction = view->addAction(KStandardAction::ZoomIn); | 116 | mZoomInAction = view->addAction(KStandardAction::ZoomIn); | ||
117 | mZoomOutAction = view->addAction(KStandardAction::ZoomOut); | 117 | mZoomOutAction = view->addAction(KStandardAction::ZoomOut); | ||
118 | 118 | | |||
119 | mActions << mZoomToFitAction << mActualSizeAction << mZoomInAction << mZoomOutAction << mZoomToFitWidthAction; | 119 | mActions << mZoomToFitAction << mActualSizeAction << mZoomInAction << mZoomOutAction << mZoomToFillAction; | ||
120 | } | 120 | } | ||
121 | 121 | | |||
122 | void connectZoomWidget() | 122 | void connectZoomWidget() | ||
123 | { | 123 | { | ||
124 | if (!mZoomWidget || !mView) { | 124 | if (!mZoomWidget || !mView) { | ||
125 | return; | 125 | return; | ||
126 | } | 126 | } | ||
127 | 127 | | |||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 174 | { | |||
183 | 183 | | |||
184 | // Connect new view | 184 | // Connect new view | ||
185 | d->mView = view; | 185 | d->mView = view; | ||
186 | if (!d->mView) { | 186 | if (!d->mView) { | ||
187 | return; | 187 | return; | ||
188 | } | 188 | } | ||
189 | connect(d->mView, &DocumentView::adapterChanged, this, &DocumentViewController::slotAdapterChanged); | 189 | connect(d->mView, &DocumentView::adapterChanged, this, &DocumentViewController::slotAdapterChanged); | ||
190 | connect(d->mView, &DocumentView::zoomToFitChanged, this, &DocumentViewController::updateZoomToFitActionFromView); | 190 | connect(d->mView, &DocumentView::zoomToFitChanged, this, &DocumentViewController::updateZoomToFitActionFromView); | ||
191 | connect(d->mView, &DocumentView::zoomToFitWidthChanged, this, &DocumentViewController::updateZoomToFitWidthActionFromView); | 191 | connect(d->mView, &DocumentView::zoomToFillChanged, this, &DocumentViewController::updateZoomToFillActionFromView); | ||
192 | connect(d->mView, &DocumentView::currentToolChanged, this, &DocumentViewController::updateTool); | 192 | connect(d->mView, &DocumentView::currentToolChanged, this, &DocumentViewController::updateTool); | ||
193 | 193 | | |||
194 | connect(d->mZoomToFitAction, SIGNAL(toggled(bool)), | 194 | connect(d->mZoomToFitAction, SIGNAL(toggled(bool)), | ||
195 | d->mView, SLOT(setZoomToFit(bool))); | 195 | d->mView, SLOT(setZoomToFit(bool))); | ||
196 | connect(d->mZoomToFitWidthAction, SIGNAL(toggled(bool)), | 196 | connect(d->mZoomToFillAction, SIGNAL(toggled(bool)), | ||
197 | d->mView, SLOT(setZoomToFitWidth(bool))); | 197 | d->mView, SLOT(setZoomToFill(bool))); | ||
198 | connect(d->mActualSizeAction, SIGNAL(triggered()), | 198 | connect(d->mActualSizeAction, SIGNAL(triggered()), | ||
199 | d->mView, SLOT(zoomActualSize())); | 199 | d->mView, SLOT(zoomActualSize())); | ||
200 | connect(d->mZoomInAction, SIGNAL(triggered()), | 200 | connect(d->mZoomInAction, SIGNAL(triggered()), | ||
201 | d->mView, SLOT(zoomIn())); | 201 | d->mView, SLOT(zoomIn())); | ||
202 | connect(d->mZoomOutAction, SIGNAL(triggered()), | 202 | connect(d->mZoomOutAction, SIGNAL(triggered()), | ||
203 | d->mView, SLOT(zoomOut())); | 203 | d->mView, SLOT(zoomOut())); | ||
204 | 204 | | |||
205 | d->updateActions(); | 205 | d->updateActions(); | ||
206 | updateZoomToFitActionFromView(); | 206 | updateZoomToFitActionFromView(); | ||
207 | updateZoomToFitWidthActionFromView(); | 207 | updateZoomToFillActionFromView(); | ||
208 | updateTool(); | 208 | updateTool(); | ||
209 | 209 | | |||
210 | // Sync zoom widget | 210 | // Sync zoom widget | ||
211 | d->connectZoomWidget(); | 211 | d->connectZoomWidget(); | ||
212 | d->updateZoomWidgetVisibility(); | 212 | d->updateZoomWidgetVisibility(); | ||
213 | } | 213 | } | ||
214 | 214 | | |||
215 | DocumentView* DocumentViewController::view() const | 215 | DocumentView* DocumentViewController::view() const | ||
216 | { | 216 | { | ||
217 | return d->mView; | 217 | return d->mView; | ||
218 | } | 218 | } | ||
219 | 219 | | |||
220 | void DocumentViewController::setZoomWidget(ZoomWidget* widget) | 220 | void DocumentViewController::setZoomWidget(ZoomWidget* widget) | ||
221 | { | 221 | { | ||
222 | d->mZoomWidget = widget; | 222 | d->mZoomWidget = widget; | ||
223 | 223 | | |||
224 | d->mZoomWidget->setActions( | 224 | d->mZoomWidget->setActions( | ||
225 | d->mZoomToFitAction, | 225 | d->mZoomToFitAction, | ||
226 | d->mActualSizeAction, | 226 | d->mActualSizeAction, | ||
227 | d->mZoomInAction, | 227 | d->mZoomInAction, | ||
228 | d->mZoomOutAction, | 228 | d->mZoomOutAction, | ||
229 | d->mZoomToFitWidthAction | 229 | d->mZoomToFillAction | ||
230 | ); | 230 | ); | ||
231 | 231 | | |||
232 | d->mZoomWidget->setMaximumZoom(qreal(DocumentView::MaximumZoom)); | 232 | d->mZoomWidget->setMaximumZoom(qreal(DocumentView::MaximumZoom)); | ||
233 | 233 | | |||
234 | d->connectZoomWidget(); | 234 | d->connectZoomWidget(); | ||
235 | d->updateZoomWidgetVisibility(); | 235 | d->updateZoomWidgetVisibility(); | ||
236 | } | 236 | } | ||
237 | 237 | | |||
Show All 9 Lines | |||||
247 | } | 247 | } | ||
248 | 248 | | |||
249 | void DocumentViewController::updateZoomToFitActionFromView() | 249 | void DocumentViewController::updateZoomToFitActionFromView() | ||
250 | { | 250 | { | ||
251 | SignalBlocker blocker(d->mZoomToFitAction); | 251 | SignalBlocker blocker(d->mZoomToFitAction); | ||
252 | d->mZoomToFitAction->setChecked(d->mView->zoomToFit()); | 252 | d->mZoomToFitAction->setChecked(d->mView->zoomToFit()); | ||
253 | } | 253 | } | ||
254 | 254 | | |||
255 | void DocumentViewController::updateZoomToFitWidthActionFromView() | 255 | void DocumentViewController::updateZoomToFillActionFromView() | ||
256 | { | 256 | { | ||
257 | SignalBlocker blocker(d->mZoomToFitWidthAction); | 257 | SignalBlocker blocker(d->mZoomToFillAction); | ||
258 | d->mZoomToFitWidthAction->setChecked(d->mView->zoomToFitWidth()); | 258 | d->mZoomToFillAction->setChecked(d->mView->zoomToFill()); | ||
259 | } | 259 | } | ||
260 | 260 | | |||
261 | void DocumentViewController::updateTool() | 261 | void DocumentViewController::updateTool() | ||
262 | { | 262 | { | ||
263 | if (!d->mToolContainer) { | 263 | if (!d->mToolContainer) { | ||
264 | return; | 264 | return; | ||
265 | } | 265 | } | ||
266 | AbstractRasterImageViewTool* tool = d->mView->currentTool(); | 266 | AbstractRasterImageViewTool* tool = d->mView->currentTool(); | ||
Show All 18 Lines |
Could you try to come up with a better tooltip, more akin to the one for 100%?