Changeset View
Changeset View
Standalone View
Standalone View
Viewer/ViewerWidget.cpp
Show First 20 Lines • Show All 136 Lines • ▼ Show 20 Line(s) | 129 | { | |||
---|---|---|---|---|---|
137 | createShowContextMenu(); | 137 | createShowContextMenu(); | ||
138 | createWallPaperMenu(); | 138 | createWallPaperMenu(); | ||
139 | createInvokeExternalMenu(); | 139 | createInvokeExternalMenu(); | ||
140 | createVideoMenu(); | 140 | createVideoMenu(); | ||
141 | createCategoryImageMenu(); | 141 | createCategoryImageMenu(); | ||
142 | createFilterMenu(); | 142 | createFilterMenu(); | ||
143 | 143 | | |||
144 | QAction * action = m_actions->addAction( QString::fromLatin1("viewer-edit-image-properties"), this, SLOT(editImage()) ); | 144 | QAction * action = m_actions->addAction( QString::fromLatin1("viewer-edit-image-properties"), this, SLOT(editImage()) ); | ||
145 | action->setText( i18nc("@action:inmenu","Annotate...") ); | 145 | action->setText( i18nc("@action:inmenu","Annotate...") ); | ||
146 | action->setShortcut( Qt::CTRL+Qt::Key_1 ); | 146 | action->setShortcut( Qt::CTRL+Qt::Key_1 ); | ||
147 | m_popup->addAction( action ); | 147 | m_popup->addAction( action ); | ||
148 | 148 | | |||
149 | m_setStackHead = m_actions->addAction( QString::fromLatin1("viewer-set-stack-head"), this, SLOT(slotSetStackHead()) ); | 149 | m_setStackHead = m_actions->addAction( QString::fromLatin1("viewer-set-stack-head"), this, SLOT(slotSetStackHead()) ); | ||
150 | m_setStackHead->setText( i18nc("@action:inmenu","Set as First Image in Stack") ); | 150 | m_setStackHead->setText( i18nc("@action:inmenu","Set as First Image in Stack") ); | ||
151 | m_setStackHead->setShortcut( Qt::CTRL+Qt::Key_4 ); | 151 | m_setStackHead->setShortcut( Qt::CTRL+Qt::Key_4 ); | ||
152 | m_popup->addAction( m_setStackHead ); | 152 | m_popup->addAction( m_setStackHead ); | ||
153 | 153 | | |||
154 | m_showExifViewer = m_actions->addAction( QString::fromLatin1("viewer-show-exif-viewer"), this, SLOT(showExifViewer()) ); | 154 | m_showExifViewer = m_actions->addAction( QString::fromLatin1("viewer-show-exif-viewer"), this, SLOT(showExifViewer()) ); | ||
155 | m_showExifViewer->setText( i18nc("@action:inmenu","Show EXIF Viewer") ); | 155 | m_showExifViewer->setText( i18nc("@action:inmenu","Show Exif Viewer") ); | ||
156 | m_popup->addAction( m_showExifViewer ); | 156 | m_popup->addAction( m_showExifViewer ); | ||
157 | 157 | | |||
158 | m_copyTo = m_actions->addAction( QString::fromLatin1("viewer-copy-to"), this, SLOT(copyTo()) ); | 158 | m_copyTo = m_actions->addAction( QString::fromLatin1("viewer-copy-to"), this, SLOT(copyTo()) ); | ||
159 | m_copyTo->setText( i18nc("@action:inmenu","Copy image to...") ); | 159 | m_copyTo->setText( i18nc("@action:inmenu","Copy image to...") ); | ||
160 | m_copyTo->setShortcut( Qt::Key_F7 ); | 160 | m_copyTo->setShortcut( Qt::Key_F7 ); | ||
161 | m_popup->addAction( m_copyTo ); | 161 | m_popup->addAction( m_copyTo ); | ||
162 | 162 | | |||
163 | if ( m_type == ViewerWindow ) { | 163 | if ( m_type == ViewerWindow ) { | ||
164 | action = m_actions->addAction( QString::fromLatin1("viewer-close"), this, SLOT(close()) ); | 164 | action = m_actions->addAction( QString::fromLatin1("viewer-close"), this, SLOT(close()) ); | ||
165 | action->setText( i18nc("@action:inmenu","Close") ); | 165 | action->setText( i18nc("@action:inmenu","Close") ); | ||
pino: extra whitespace changes | |||||
166 | action->setShortcut( Qt::Key_Escape ); | 166 | action->setShortcut( Qt::Key_Escape ); | ||
167 | } | 167 | } | ||
168 | 168 | | |||
169 | m_popup->addAction( action ); | 169 | m_popup->addAction( action ); | ||
170 | m_actions->readSettings(); | 170 | m_actions->readSettings(); | ||
171 | 171 | | |||
172 | Q_FOREACH( QAction* action, m_actions->actions() ) { | 172 | Q_FOREACH( QAction* action, m_actions->actions() ) { | ||
173 | action->setShortcutContext(Qt::WindowShortcut); | 173 | action->setShortcutContext(Qt::WindowShortcut); | ||
174 | addAction(action); | 174 | addAction(action); | ||
175 | } | 175 | } | ||
176 | } | 176 | } | ||
177 | 177 | | |||
178 | void Viewer::ViewerWidget::createShowContextMenu() | 178 | void Viewer::ViewerWidget::createShowContextMenu() | ||
179 | { | 179 | { | ||
180 | VisibleOptionsMenu* menu = new VisibleOptionsMenu( this, m_actions ); | 180 | VisibleOptionsMenu* menu = new VisibleOptionsMenu( this, m_actions ); | ||
181 | connect(menu, &VisibleOptionsMenu::visibleOptionsChanged, this, &ViewerWidget::updateInfoBox); | 181 | connect(menu, &VisibleOptionsMenu::visibleOptionsChanged, this, &ViewerWidget::updateInfoBox); | ||
182 | m_popup->addMenu( menu ); | 182 | m_popup->addMenu( menu ); | ||
183 | } | 183 | } | ||
184 | 184 | | |||
185 | void Viewer::ViewerWidget::createWallPaperMenu() | 185 | void Viewer::ViewerWidget::createWallPaperMenu() | ||
186 | { | 186 | { | ||
187 | // Setting wallpaper has still not yet been ported to KPA4 | 187 | // Setting wallpaper has still not yet been ported to KPA4 | ||
188 | #ifndef DOES_STILL_NOT_WORK_IN_KPA4 | 188 | #ifndef DOES_STILL_NOT_WORK_IN_KPA4 | ||
189 | m_wallpaperMenu = new QMenu( m_popup ); | 189 | m_wallpaperMenu = new QMenu( m_popup ); | ||
190 | m_wallpaperMenu->setTitle( i18nc("@title:inmenu","Set as Wallpaper") ); | 190 | m_wallpaperMenu->setTitle( i18nc("@title:inmenu","Set as Wallpaper") ); | ||
191 | 191 | | |||
192 | QAction * action = m_actions->addAction( QString::fromLatin1("viewer-centered"), this, SLOT(slotSetWallpaperC()) ); | 192 | QAction * action = m_actions->addAction( QString::fromLatin1("viewer-centered"), this, SLOT(slotSetWallpaperC()) ); | ||
193 | action->setText( i18nc("@action:inmenu","Centered") ); | 193 | action->setText( i18nc("@action:inmenu","Centered") ); | ||
194 | m_wallpaperMenu->addAction(action); | 194 | m_wallpaperMenu->addAction(action); | ||
195 | 195 | | |||
196 | action = m_actions->addAction( QString::fromLatin1("viewer-tiled"), this, SLOT(slotSetWallpaperT()) ); | 196 | action = m_actions->addAction( QString::fromLatin1("viewer-tiled"), this, SLOT(slotSetWallpaperT()) ); | ||
197 | action->setText( i18nc("@action:inmenu","Tiled") ); | 197 | action->setText( i18nc("@action:inmenu","Tiled") ); | ||
198 | m_wallpaperMenu->addAction( action ); | 198 | m_wallpaperMenu->addAction( action ); | ||
199 | 199 | | |||
200 | action = m_actions->addAction( QString::fromLatin1("viewer-center-tiled"), this, SLOT(slotSetWallpaperCT()) ); | 200 | action = m_actions->addAction( QString::fromLatin1("viewer-center-tiled"), this, SLOT(slotSetWallpaperCT()) ); | ||
201 | action->setText( i18nc("@action:inmenu","Center Tiled") ); | 201 | action->setText( i18nc("@action:inmenu","Center Tiled") ); | ||
202 | m_wallpaperMenu->addAction( action ); | 202 | m_wallpaperMenu->addAction( action ); | ||
203 | 203 | | |||
204 | action = m_actions->addAction( QString::fromLatin1("viewer-centered-maxspect"), this, SLOT(slotSetWallpaperCM()) ); | 204 | action = m_actions->addAction( QString::fromLatin1("viewer-centered-maxspect"), this, SLOT(slotSetWallpaperCM()) ); | ||
205 | action->setText( i18nc("@action:inmenu","Centered Maxpect") ); | 205 | action->setText( i18nc("@action:inmenu","Centered Maxpect") ); | ||
206 | m_wallpaperMenu->addAction( action ); | 206 | m_wallpaperMenu->addAction( action ); | ||
207 | 207 | | |||
208 | action = m_actions->addAction( QString::fromLatin1("viewer-tiled-maxpect"), this, SLOT(slotSetWallpaperTM()) ); | 208 | action = m_actions->addAction( QString::fromLatin1("viewer-tiled-maxpect"), this, SLOT(slotSetWallpaperTM()) ); | ||
209 | action->setText( i18nc("@action:inmenu","Tiled Maxpect") ); | 209 | action->setText( i18nc("@action:inmenu","Tiled Maxpect") ); | ||
210 | m_wallpaperMenu->addAction( action ); | 210 | m_wallpaperMenu->addAction( action ); | ||
211 | 211 | | |||
212 | action = m_actions->addAction( QString::fromLatin1("viewer-scaled"), this, SLOT(slotSetWallpaperS()) ); | 212 | action = m_actions->addAction( QString::fromLatin1("viewer-scaled"), this, SLOT(slotSetWallpaperS()) ); | ||
213 | action->setText( i18nc("@action:inmenu","Scaled") ); | 213 | action->setText( i18nc("@action:inmenu","Scaled") ); | ||
214 | m_wallpaperMenu->addAction( action ); | 214 | m_wallpaperMenu->addAction( action ); | ||
215 | 215 | | |||
216 | action = m_actions->addAction( QString::fromLatin1("viewer-centered-auto-fit"), this, SLOT(slotSetWallpaperCAF()) ); | 216 | action = m_actions->addAction( QString::fromLatin1("viewer-centered-auto-fit"), this, SLOT(slotSetWallpaperCAF()) ); | ||
217 | action->setText( i18nc("@action:inmenu","Centered Auto Fit") ); | 217 | action->setText( i18nc("@action:inmenu","Centered Auto Fit") ); | ||
pino: extra whitespace changes | |||||
218 | m_wallpaperMenu->addAction( action ); | 218 | m_wallpaperMenu->addAction( action ); | ||
219 | 219 | | |||
220 | m_popup->addMenu( m_wallpaperMenu ); | 220 | m_popup->addMenu( m_wallpaperMenu ); | ||
221 | #endif // DOES_STILL_NOT_WORK_IN_KPA4 | 221 | #endif // DOES_STILL_NOT_WORK_IN_KPA4 | ||
222 | } | 222 | } | ||
223 | 223 | | |||
224 | 224 | | |||
225 | void Viewer::ViewerWidget::inhibitScreenSaver( bool inhibit ) { | 225 | void Viewer::ViewerWidget::inhibitScreenSaver( bool inhibit ) { | ||
▲ Show 20 Lines • Show All 260 Lines • ▼ Show 20 Line(s) | 431 | { | |||
486 | if ( m_display == m_textDisplay ) | 486 | if ( m_display == m_textDisplay ) | ||
487 | updateInfoBox(); | 487 | updateInfoBox(); | ||
488 | 488 | | |||
489 | // Add all tagged areas | 489 | // Add all tagged areas | ||
490 | addTaggedAreas(); | 490 | addTaggedAreas(); | ||
491 | } | 491 | } | ||
492 | 492 | | |||
493 | void Viewer::ViewerWidget::setCaptionWithDetail( const QString& detail ) { | 493 | void Viewer::ViewerWidget::setCaptionWithDetail( const QString& detail ) { | ||
494 | setWindowTitle( QString::fromLatin1( "KPhotoAlbum - %1 %2" ) | 494 | setWindowTitle( i18nc("@title:window", "KPhotoAlbum - %1 %2" ) | ||
This will not build, since there is no i18n() here. OTOH, considering it is an UI string, then the QString::fromLatin1 ought to be i18nc(). pino: This will not build, since there is no i18n() here. OTOH, considering it is an UI string, then… | |||||
Now the arguments must be passed to i18n(), e.g: i18n("foo with %1 placeholder, like %2", arg_for_placeholder_1, second_arg); Additionally, please mention what are %1 and %2, e.g. in the message context (after the @foo marker). pino: Now the arguments must be passed to i18n(), e.g:
lang=c++
i18n("foo with %1 placeholder… | |||||
495 | .arg( currentInfo()->fileName().absolute() ) | 495 | .arg( currentInfo()->fileName().absolute() ) | ||
496 | .arg( detail ) ); | 496 | .arg( detail ) ); | ||
I don't know if it's worth mentioning at this place, but the "detail" parameter is usually the zoom factor (e.g. "[ Zoom x1.3]") as set in Viewer::ImageDisplay::updateZoomCaption()... johanneszarl: I don't know if it's worth mentioning at this place, but the "detail" parameter is usually the… | |||||
497 | } | 497 | } | ||
498 | 498 | | |||
499 | void Viewer::ViewerWidget::contextMenuEvent( QContextMenuEvent * e ) | 499 | void Viewer::ViewerWidget::contextMenuEvent( QContextMenuEvent * e ) | ||
500 | { | 500 | { | ||
501 | if ( m_videoDisplay ) { | 501 | if ( m_videoDisplay ) { | ||
502 | if ( m_videoDisplay->isPaused() ) | 502 | if ( m_videoDisplay->isPaused() ) | ||
503 | m_playPause->setText(i18nc("@action:inmenu Start video playback","Play")); | 503 | m_playPause->setText(i18nc("@action:inmenu Start video playback","Play")); | ||
504 | else | 504 | else | ||
▲ Show 20 Lines • Show All 1007 Lines • ▼ Show 20 Line(s) | |||||
1512 | { | 1512 | { | ||
1513 | QUrl src = QUrl::fromLocalFile(currentInfo()->fileName().absolute()); | 1513 | QUrl src = QUrl::fromLocalFile(currentInfo()->fileName().absolute()); | ||
1514 | if (m_lastCopyToTarget.isNull()) { | 1514 | if (m_lastCopyToTarget.isNull()) { | ||
1515 | // get directory of src file | 1515 | // get directory of src file | ||
1516 | m_lastCopyToTarget = QFileInfo(src.path()).path(); | 1516 | m_lastCopyToTarget = QFileInfo(src.path()).path(); | ||
1517 | } | 1517 | } | ||
1518 | 1518 | | |||
1519 | QFileDialog dialog( this ); | 1519 | QFileDialog dialog( this ); | ||
1520 | dialog.setWindowTitle( i18nc("@title:window", "Copy image to...") ); | 1520 | dialog.setWindowTitle( i18nc("@title:window", "Copy Image to...") ); | ||
1521 | // use directory of src as start-location: | 1521 | // use directory of src as start-location: | ||
1522 | dialog.setDirectory(m_lastCopyToTarget); | 1522 | dialog.setDirectory(m_lastCopyToTarget); | ||
1523 | dialog.selectFile(src.fileName()); | 1523 | dialog.selectFile(src.fileName()); | ||
1524 | dialog.setAcceptMode(QFileDialog::AcceptSave); | 1524 | dialog.setAcceptMode(QFileDialog::AcceptSave); | ||
1525 | dialog.setLabelText(QFileDialog::Accept, i18nc("@action:button", "Copy")); | 1525 | dialog.setLabelText(QFileDialog::Accept, i18nc("@action:button", "Copy")); | ||
1526 | 1526 | | |||
1527 | if (dialog.exec()) { | 1527 | if (dialog.exec()) { | ||
1528 | QUrl dst = dialog.selectedUrls().first(); | 1528 | QUrl dst = dialog.selectedUrls().first(); | ||
1529 | KIO::CopyJob *job = KIO::copy(src, dst); | 1529 | KIO::CopyJob *job = KIO::copy(src, dst); | ||
1530 | connect(job, &KIO::CopyJob::finished, job, &QObject::deleteLater); | 1530 | connect(job, &KIO::CopyJob::finished, job, &QObject::deleteLater); | ||
1531 | // get directory of dst file | 1531 | // get directory of dst file | ||
1532 | m_lastCopyToTarget = QFileInfo(dst.path()).path(); | 1532 | m_lastCopyToTarget = QFileInfo(dst.path()).path(); | ||
1533 | } | 1533 | } | ||
1534 | } | 1534 | } | ||
1535 | 1535 | | |||
1536 | // vi:expandtab:tabstop=4 shiftwidth=4: | 1536 | // vi:expandtab:tabstop=4 shiftwidth=4: |
extra whitespace changes