Changeset View
Changeset View
Standalone View
Standalone View
applets/comic/comic.cpp
Show First 20 Lines • Show All 124 Lines • ▼ Show 20 Line(s) | 80 | { | |||
---|---|---|---|---|---|
125 | mActions.append( mActionGoJump ); | 125 | mActions.append( mActionGoJump ); | ||
126 | connect( mActionGoJump, &QAction::triggered, this, &ComicApplet::slotGoJump ); | 126 | connect( mActionGoJump, &QAction::triggered, this, &ComicApplet::slotGoJump ); | ||
127 | 127 | | |||
128 | mActionShop = new QAction(i18nc("@action", "Visit the Shop &Website"), this); | 128 | mActionShop = new QAction(i18nc("@action", "Visit the Shop &Website"), this); | ||
129 | mActionShop->setEnabled( false ); | 129 | mActionShop->setEnabled( false ); | ||
130 | mActions.append( mActionShop ); | 130 | mActions.append( mActionShop ); | ||
131 | connect( mActionShop, &QAction::triggered, this, &ComicApplet::slotShop ); | 131 | connect( mActionShop, &QAction::triggered, this, &ComicApplet::slotShop ); | ||
132 | 132 | | |||
133 | QAction *action = new QAction(QIcon::fromTheme(QStringLiteral("document-save-as")), | 133 | mActionSaveComicAs = new QAction(QIcon::fromTheme(QStringLiteral("document-save-as")), | ||
134 | i18nc("@action", "&Save Comic As..."), this); | 134 | i18nc("@action", "&Save Comic As..."), this); | ||
135 | mActions.append( action ); | 135 | mActions.append( mActionSaveComicAs ); | ||
136 | connect( action, &QAction::triggered, this, &ComicApplet::slotSaveComicAs ); | 136 | connect( mActionSaveComicAs, &QAction::triggered, this, &ComicApplet::slotSaveComicAs ); | ||
137 | 137 | | |||
138 | action = new QAction(QIcon::fromTheme(QStringLiteral("application-epub+zip")), | 138 | mActionCreateComicBook = new QAction(QIcon::fromTheme(QStringLiteral("application-epub+zip")), | ||
139 | i18nc("@action", "&Create Comic Book Archive..."), this); | 139 | i18nc("@action", "&Create Comic Book Archive..."), this); | ||
140 | mActions.append( action ); | 140 | mActions.append( mActionCreateComicBook ); | ||
141 | connect( action, &QAction::triggered, this, &ComicApplet::createComicBook ); | 141 | connect( mActionCreateComicBook, &QAction::triggered, this, &ComicApplet::createComicBook ); | ||
142 | 142 | | |||
143 | mActionScaleContent = new QAction(QIcon::fromTheme(QStringLiteral("zoom-original")), | 143 | mActionScaleContent = new QAction(QIcon::fromTheme(QStringLiteral("zoom-original")), | ||
144 | i18nc("@option:check Context menu of comic image", "&Actual Size"), this); | 144 | i18nc("@option:check Context menu of comic image", "&Actual Size"), this); | ||
145 | mActionScaleContent->setCheckable( true ); | 145 | mActionScaleContent->setCheckable( true ); | ||
146 | mActionScaleContent->setChecked( mCurrent.scaleComic() ); | 146 | mActionScaleContent->setChecked( mCurrent.scaleComic() ); | ||
147 | mActions.append( mActionScaleContent ); | 147 | mActions.append( mActionScaleContent ); | ||
148 | connect( mActionScaleContent, &QAction::triggered, this, &ComicApplet::slotScaleToContent ); | 148 | connect( mActionScaleContent, &QAction::triggered, this, &ComicApplet::slotScaleToContent ); | ||
149 | 149 | | |||
▲ Show 20 Lines • Show All 356 Lines • ▼ Show 20 Line(s) | 492 | if ( !id.isEmpty() && mEngine && mEngine->isValid() ) { | |||
506 | } | 506 | } | ||
507 | mOldSource = identifier; | 507 | mOldSource = identifier; | ||
508 | mEngine->connectSource( identifier, this ); | 508 | mEngine->connectSource( identifier, this ); | ||
509 | slotScaleToContent(); | 509 | slotScaleToContent(); | ||
510 | } else { | 510 | } else { | ||
511 | qWarning() << "Either no identifier was specified or the engine could not be created:" << "id" << id << "engine valid:" << ( mEngine && mEngine->isValid() ); | 511 | qWarning() << "Either no identifier was specified or the engine could not be created:" << "id" << id << "engine valid:" << ( mEngine && mEngine->isValid() ); | ||
512 | setConfigurationRequired( true ); | 512 | setConfigurationRequired( true ); | ||
513 | } | 513 | } | ||
514 | updateContextMenu(); | ||||
514 | } | 515 | } | ||
515 | 516 | | |||
516 | void ComicApplet::updateContextMenu() | 517 | void ComicApplet::updateContextMenu() | ||
517 | { | 518 | { | ||
519 | if (mCurrent.id().isEmpty()) { | ||||
520 | | ||||
521 | mActiveComicModel->clear(); | ||||
522 | mActionNextNewStripTab->setEnabled(false); | ||||
523 | mActionGoFirst->setEnabled(false); | ||||
524 | mActionGoLast->setEnabled(false); | ||||
525 | mActionScaleContent->setEnabled(false); | ||||
526 | if (mActionShop) { | ||||
527 | mActionShop->setEnabled(false); | ||||
anthonyfieroni: Check against nullptr like else branch? | |||||
528 | } | ||||
529 | mActionStorePosition->setEnabled(false); | ||||
530 | mActionGoJump->setEnabled(false); | ||||
531 | mActionSaveComicAs->setEnabled(false); | ||||
532 | mActionCreateComicBook->setEnabled(false); | ||||
533 | mActionScaleContent->setChecked(false); | ||||
534 | } else { | ||||
518 | mActionGoFirst->setVisible(mCurrent.hasFirst()); | 535 | mActionGoFirst->setVisible(mCurrent.hasFirst()); | ||
519 | mActionGoFirst->setEnabled(mCurrent.hasPrev()); | 536 | mActionGoFirst->setEnabled(mCurrent.hasPrev()); | ||
520 | mActionGoLast->setEnabled(true);//always enable to have some kind of refresh action | 537 | mActionGoLast->setEnabled(true); | ||
521 | if (mActionShop) { | 538 | if (mActionShop) { | ||
522 | mActionShop->setEnabled(mCurrent.shopUrl().isValid()); | 539 | mActionShop->setEnabled(mCurrent.shopUrl().isValid()); | ||
523 | } | 540 | } | ||
541 | mActionScaleContent->setEnabled(true); | ||||
542 | mActionStorePosition->setEnabled(true); | ||||
543 | mActionGoJump->setEnabled(true); | ||||
544 | mActionSaveComicAs->setEnabled(true); | ||||
545 | mActionCreateComicBook->setEnabled(true); | ||||
546 | } | ||||
524 | } | 547 | } | ||
525 | 548 | | |||
526 | void ComicApplet::slotSaveComicAs() | 549 | void ComicApplet::slotSaveComicAs() | ||
527 | { | 550 | { | ||
528 | ComicSaver saver(mSavingDir); | 551 | ComicSaver saver(mSavingDir); | ||
529 | saver.save(mCurrent); | 552 | saver.save(mCurrent); | ||
530 | } | 553 | } | ||
531 | 554 | | |||
▲ Show 20 Lines • Show All 265 Lines • Show Last 20 Lines |
Check against nullptr like else branch?