Changeset View
Changeset View
Standalone View
Standalone View
mainWindow/kpMainWindow_Tools.cpp
Show First 20 Lines • Show All 127 Lines • ▼ Show 20 Line(s) | 97 | { | |||
---|---|---|---|---|---|
128 | d->tools.append (d->toolZoom = new kpToolZoom (toolEnv, this)); | 128 | d->tools.append (d->toolZoom = new kpToolZoom (toolEnv, this)); | ||
129 | 129 | | |||
130 | 130 | | |||
131 | KActionCollection *ac = actionCollection (); | 131 | KActionCollection *ac = actionCollection (); | ||
132 | 132 | | |||
133 | d->actionPrevToolOptionGroup1 = ac->addAction ("prev_tool_option_group_1"); | 133 | d->actionPrevToolOptionGroup1 = ac->addAction ("prev_tool_option_group_1"); | ||
134 | d->actionPrevToolOptionGroup1->setText (i18n ("Previous Tool Option (Group #1)")); | 134 | d->actionPrevToolOptionGroup1->setText (i18n ("Previous Tool Option (Group #1)")); | ||
135 | ac->setDefaultShortcuts (d->actionPrevToolOptionGroup1, kpTool::shortcutForKey (Qt::Key_1)); | 135 | ac->setDefaultShortcuts (d->actionPrevToolOptionGroup1, kpTool::shortcutForKey (Qt::Key_1)); | ||
136 | connect (d->actionPrevToolOptionGroup1, SIGNAL (triggered(bool)), | 136 | connect (d->actionPrevToolOptionGroup1, &QAction::triggered, | ||
137 | SLOT (slotActionPrevToolOptionGroup1())); | 137 | this, &kpMainWindow::slotActionPrevToolOptionGroup1); | ||
138 | 138 | | |||
139 | d->actionNextToolOptionGroup1 = ac->addAction ("next_tool_option_group_1"); | 139 | d->actionNextToolOptionGroup1 = ac->addAction ("next_tool_option_group_1"); | ||
140 | d->actionNextToolOptionGroup1->setText (i18n ("Next Tool Option (Group #1)")); | 140 | d->actionNextToolOptionGroup1->setText (i18n ("Next Tool Option (Group #1)")); | ||
141 | ac->setDefaultShortcuts (d->actionNextToolOptionGroup1, kpTool::shortcutForKey (Qt::Key_2)); | 141 | ac->setDefaultShortcuts (d->actionNextToolOptionGroup1, kpTool::shortcutForKey (Qt::Key_2)); | ||
142 | connect (d->actionNextToolOptionGroup1, SIGNAL (triggered(bool)), | 142 | connect (d->actionNextToolOptionGroup1, &QAction::triggered, | ||
143 | SLOT (slotActionNextToolOptionGroup1())); | 143 | this, &kpMainWindow::slotActionNextToolOptionGroup1); | ||
144 | 144 | | |||
145 | d->actionPrevToolOptionGroup2 = ac->addAction ("prev_tool_option_group_2"); | 145 | d->actionPrevToolOptionGroup2 = ac->addAction ("prev_tool_option_group_2"); | ||
146 | d->actionPrevToolOptionGroup2->setText (i18n ("Previous Tool Option (Group #2)")); | 146 | d->actionPrevToolOptionGroup2->setText (i18n ("Previous Tool Option (Group #2)")); | ||
147 | ac->setDefaultShortcuts (d->actionPrevToolOptionGroup2, kpTool::shortcutForKey (Qt::Key_3)); | 147 | ac->setDefaultShortcuts (d->actionPrevToolOptionGroup2, kpTool::shortcutForKey (Qt::Key_3)); | ||
148 | connect (d->actionPrevToolOptionGroup2, SIGNAL (triggered(bool)), | 148 | connect (d->actionPrevToolOptionGroup2, &QAction::triggered, | ||
149 | SLOT (slotActionPrevToolOptionGroup2())); | 149 | this, &kpMainWindow::slotActionPrevToolOptionGroup2); | ||
150 | 150 | | |||
151 | d->actionNextToolOptionGroup2 = ac->addAction ("next_tool_option_group_2"); | 151 | d->actionNextToolOptionGroup2 = ac->addAction ("next_tool_option_group_2"); | ||
152 | d->actionNextToolOptionGroup2->setText (i18n ("Next Tool Option (Group #2)")); | 152 | d->actionNextToolOptionGroup2->setText (i18n ("Next Tool Option (Group #2)")); | ||
153 | ac->setDefaultShortcuts (d->actionNextToolOptionGroup2, kpTool::shortcutForKey (Qt::Key_4)); | 153 | ac->setDefaultShortcuts (d->actionNextToolOptionGroup2, kpTool::shortcutForKey (Qt::Key_4)); | ||
154 | connect (d->actionNextToolOptionGroup2, SIGNAL (triggered(bool)), | 154 | connect (d->actionNextToolOptionGroup2, &QAction::triggered, | ||
155 | SLOT (slotActionNextToolOptionGroup2())); | 155 | this, &kpMainWindow::slotActionNextToolOptionGroup2); | ||
156 | 156 | | |||
157 | 157 | | |||
158 | // | 158 | // | ||
159 | // Implemented in this file (kpMainWindow_Tools.cpp), not | 159 | // Implemented in this file (kpMainWindow_Tools.cpp), not | ||
160 | // kpImageWindow_Image.cpp since they're really setting tool options. | 160 | // kpImageWindow_Image.cpp since they're really setting tool options. | ||
161 | // | 161 | // | ||
162 | 162 | | |||
163 | d->actionDrawOpaque = ac->add <KToggleAction> ("image_draw_opaque"); | 163 | d->actionDrawOpaque = ac->add <KToggleAction> ("image_draw_opaque"); | ||
164 | d->actionDrawOpaque->setText (i18n ("&Draw Opaque")); | 164 | d->actionDrawOpaque->setText (i18n ("&Draw Opaque")); | ||
165 | connect (d->actionDrawOpaque, SIGNAL (triggered(bool)), | 165 | connect (d->actionDrawOpaque, &QAction::triggered, | ||
166 | SLOT (slotActionDrawOpaqueToggled())); | 166 | this, &kpMainWindow::slotActionDrawOpaqueToggled); | ||
167 | 167 | | |||
168 | d->actionDrawColorSimilarity = ac->addAction ("image_draw_color_similarity"); | 168 | d->actionDrawColorSimilarity = ac->addAction ("image_draw_color_similarity"); | ||
169 | d->actionDrawColorSimilarity->setText (i18n ("Draw With Color Similarity...")); | 169 | d->actionDrawColorSimilarity->setText (i18n ("Draw With Color Similarity...")); | ||
170 | connect (d->actionDrawColorSimilarity, SIGNAL (triggered(bool)), | 170 | connect (d->actionDrawColorSimilarity, &QAction::triggered, | ||
171 | SLOT (slotActionDrawColorSimilarity())); | 171 | this, &kpMainWindow::slotActionDrawColorSimilarity); | ||
172 | } | 172 | } | ||
173 | 173 | | |||
174 | //--------------------------------------------------------------------- | 174 | //--------------------------------------------------------------------- | ||
175 | 175 | | |||
176 | // private | 176 | // private | ||
177 | void kpMainWindow::createToolBox () | 177 | void kpMainWindow::createToolBox () | ||
178 | { | 178 | { | ||
179 | d->toolToolBar = new kpToolToolBar(QLatin1String("Tool Box"), 2/*columns/rows*/, this); | 179 | d->toolToolBar = new kpToolToolBar(QLatin1String("Tool Box"), 2/*columns/rows*/, this); | ||
180 | d->toolToolBar->setWindowTitle(i18n("Tool Box")); | 180 | d->toolToolBar->setWindowTitle(i18n("Tool Box")); | ||
181 | 181 | | |||
182 | connect (d->toolToolBar, SIGNAL (sigToolSelected(kpTool*)), | 182 | connect (d->toolToolBar, &kpToolToolBar::sigToolSelected, | ||
183 | this, SLOT (slotToolSelected(kpTool*))); | 183 | this, &kpMainWindow::slotToolSelected); | ||
184 | connect (d->toolToolBar, SIGNAL (toolWidgetOptionSelected()), | 184 | | ||
185 | this, SLOT (updateToolOptionPrevNextActionsEnabled())); | 185 | connect (d->toolToolBar, &kpToolToolBar::toolWidgetOptionSelected, | ||
186 | this, &kpMainWindow::updateToolOptionPrevNextActionsEnabled); | ||||
186 | 187 | | |||
187 | connect (d->toolToolBar->toolWidgetOpaqueOrTransparent (), | 188 | connect (d->toolToolBar->toolWidgetOpaqueOrTransparent(), | ||
188 | SIGNAL (isOpaqueChanged(bool)), | 189 | &kpToolWidgetOpaqueOrTransparent::isOpaqueChanged, | ||
189 | SLOT (updateActionDrawOpaqueChecked())); | 190 | this, &kpMainWindow::updateActionDrawOpaqueChecked); | ||
191 | | ||||
190 | updateActionDrawOpaqueChecked (); | 192 | updateActionDrawOpaqueChecked (); | ||
191 | 193 | | |||
192 | foreach (kpTool *tool, d->tools) | 194 | foreach (kpTool *tool, d->tools) | ||
193 | d->toolToolBar->registerTool(tool); | 195 | d->toolToolBar->registerTool(tool); | ||
194 | 196 | | |||
195 | // (from config file) | 197 | // (from config file) | ||
196 | readLastTool (); | 198 | readLastTool (); | ||
197 | } | 199 | } | ||
▲ Show 20 Lines • Show All 224 Lines • ▼ Show 20 Line(s) | |||||
422 | #if DEBUG_KP_MAIN_WINDOW | 424 | #if DEBUG_KP_MAIN_WINDOW | ||
423 | qCDebug(kpLogMainWindow) << "kpMainWindow::slotToolSelected (" << tool << ")"; | 425 | qCDebug(kpLogMainWindow) << "kpMainWindow::slotToolSelected (" << tool << ")"; | ||
424 | #endif | 426 | #endif | ||
425 | 427 | | |||
426 | kpTool *previousTool = d->toolToolBar ? d->toolToolBar->previousTool () : nullptr; | 428 | kpTool *previousTool = d->toolToolBar ? d->toolToolBar->previousTool () : nullptr; | ||
427 | 429 | | |||
428 | if (previousTool) | 430 | if (previousTool) | ||
429 | { | 431 | { | ||
430 | disconnect (previousTool, SIGNAL (movedAndAboutToDraw(QPoint,QPoint,int,bool*)), | 432 | disconnect (previousTool, &kpTool::movedAndAboutToDraw, | ||
431 | this, SLOT (slotDragScroll(QPoint,QPoint,int,bool*))); | 433 | this, &kpMainWindow::slotDragScroll); | ||
432 | disconnect (previousTool, SIGNAL (endedDraw(QPoint)), | 434 | | ||
433 | this, SLOT (slotEndDragScroll())); | 435 | disconnect (previousTool, &kpTool::endedDraw, | ||
434 | disconnect (previousTool, SIGNAL (cancelledShape(QPoint)), | 436 | this, &kpMainWindow::slotEndDragScroll); | ||
435 | this, SLOT (slotEndDragScroll())); | 437 | | ||
436 | 438 | disconnect (previousTool, &kpTool::cancelledShape, | |||
437 | disconnect (previousTool, SIGNAL (userMessageChanged(QString)), | 439 | this, &kpMainWindow::slotEndDragScroll); | ||
438 | this, SLOT (recalculateStatusBarMessage())); | 440 | | ||
439 | disconnect (previousTool, SIGNAL (userShapePointsChanged(QPoint,QPoint)), | 441 | disconnect (previousTool, &kpTool::userMessageChanged, | ||
440 | this, SLOT (recalculateStatusBarShape())); | 442 | this, &kpMainWindow::recalculateStatusBarMessage); | ||
441 | disconnect (previousTool, SIGNAL (userShapeSizeChanged(QSize)), | 443 | | ||
442 | this, SLOT (recalculateStatusBarShape())); | 444 | disconnect (previousTool, &kpTool::userShapePointsChanged, | ||
443 | 445 | this, &kpMainWindow::recalculateStatusBarShape); | |||
444 | disconnect (d->colorToolBar, SIGNAL (colorsSwapped(kpColor,kpColor)), | 446 | | ||
445 | previousTool, SLOT (slotColorsSwappedInternal(kpColor,kpColor))); | 447 | disconnect (previousTool, &kpTool::userShapeSizeChanged, | ||
446 | disconnect (d->colorToolBar, SIGNAL (foregroundColorChanged(kpColor)), | 448 | this, &kpMainWindow::recalculateStatusBarShape); | ||
447 | previousTool, SLOT (slotForegroundColorChangedInternal(kpColor))); | 449 | | ||
448 | disconnect (d->colorToolBar, SIGNAL (backgroundColorChanged(kpColor)), | 450 | | ||
449 | previousTool, SLOT (slotBackgroundColorChangedInternal(kpColor))); | 451 | disconnect (d->colorToolBar, &kpColorToolBar::colorsSwapped, | ||
450 | disconnect (d->colorToolBar, SIGNAL (colorSimilarityChanged(double,int)), | 452 | previousTool, &kpTool::slotColorsSwappedInternal); | ||
451 | previousTool, SLOT (slotColorSimilarityChangedInternal(double,int))); | 453 | | ||
454 | disconnect (d->colorToolBar, &kpColorToolBar::foregroundColorChanged, | ||||
455 | previousTool, &kpTool::slotForegroundColorChangedInternal); | ||||
456 | | ||||
457 | disconnect (d->colorToolBar, &kpColorToolBar::backgroundColorChanged, | ||||
458 | previousTool, &kpTool::slotBackgroundColorChangedInternal); | ||||
459 | | ||||
460 | | ||||
461 | disconnect (d->colorToolBar, &kpColorToolBar::colorSimilarityChanged, | ||||
462 | previousTool, &kpTool::slotColorSimilarityChangedInternal); | ||||
452 | } | 463 | } | ||
453 | 464 | | |||
454 | if (tool) | 465 | if (tool) | ||
455 | { | 466 | { | ||
456 | connect (tool, SIGNAL (movedAndAboutToDraw(QPoint,QPoint,int,bool*)), | 467 | connect (tool, &kpTool::movedAndAboutToDraw, | ||
457 | this, SLOT (slotDragScroll(QPoint,QPoint,int,bool*))); | 468 | this, &kpMainWindow::slotDragScroll); | ||
458 | connect (tool, SIGNAL (endedDraw(QPoint)), | 469 | | ||
459 | this, SLOT (slotEndDragScroll())); | 470 | connect (tool, &kpTool::endedDraw, | ||
460 | connect (tool, SIGNAL (cancelledShape(QPoint)), | 471 | this, &kpMainWindow::slotEndDragScroll); | ||
461 | this, SLOT (slotEndDragScroll())); | 472 | | ||
462 | 473 | connect (tool, &kpTool::cancelledShape, | |||
463 | connect (tool, SIGNAL (userMessageChanged(QString)), | 474 | this, &kpMainWindow::slotEndDragScroll); | ||
464 | this, SLOT (recalculateStatusBarMessage())); | 475 | | ||
465 | connect (tool, SIGNAL (userShapePointsChanged(QPoint,QPoint)), | 476 | connect (tool, &kpTool::userMessageChanged, | ||
466 | this, SLOT (recalculateStatusBarShape())); | 477 | this, &kpMainWindow::recalculateStatusBarMessage); | ||
467 | connect (tool, SIGNAL (userShapeSizeChanged(QSize)), | 478 | | ||
468 | this, SLOT (recalculateStatusBarShape())); | 479 | connect (tool, &kpTool::userShapePointsChanged, | ||
480 | this, &kpMainWindow::recalculateStatusBarShape); | ||||
481 | | ||||
482 | connect (tool, &kpTool::userShapeSizeChanged, | ||||
483 | this, &kpMainWindow::recalculateStatusBarShape); | ||||
484 | | ||||
469 | recalculateStatusBar (); | 485 | recalculateStatusBar (); | ||
470 | 486 | | |||
471 | connect (d->colorToolBar, SIGNAL (colorsSwapped(kpColor,kpColor)), | 487 | | ||
472 | tool, SLOT (slotColorsSwappedInternal(kpColor,kpColor))); | 488 | connect (d->colorToolBar, &kpColorToolBar::colorsSwapped, | ||
473 | connect (d->colorToolBar, SIGNAL (foregroundColorChanged(kpColor)), | 489 | tool, &kpTool::slotColorsSwappedInternal); | ||
474 | tool, SLOT (slotForegroundColorChangedInternal(kpColor))); | 490 | | ||
475 | connect (d->colorToolBar, SIGNAL (backgroundColorChanged(kpColor)), | 491 | connect (d->colorToolBar, &kpColorToolBar::foregroundColorChanged, | ||
476 | tool, SLOT (slotBackgroundColorChangedInternal(kpColor))); | 492 | tool, &kpTool::slotForegroundColorChangedInternal); | ||
477 | connect (d->colorToolBar, SIGNAL (colorSimilarityChanged(double,int)), | 493 | | ||
478 | tool, SLOT (slotColorSimilarityChangedInternal(double,int))); | 494 | connect (d->colorToolBar, &kpColorToolBar::backgroundColorChanged, | ||
495 | tool, &kpTool::slotBackgroundColorChangedInternal); | ||||
496 | | ||||
497 | connect (d->colorToolBar, &kpColorToolBar::colorSimilarityChanged, | ||||
498 | tool, &kpTool::slotColorSimilarityChangedInternal); | ||||
479 | 499 | | |||
480 | 500 | | |||
481 | saveLastTool (); | 501 | saveLastTool (); | ||
482 | } | 502 | } | ||
483 | 503 | | |||
484 | updateToolOptionPrevNextActionsEnabled (); | 504 | updateToolOptionPrevNextActionsEnabled (); | ||
485 | updateActionDrawOpaqueEnabled (); | 505 | updateActionDrawOpaqueEnabled (); | ||
486 | } | 506 | } | ||
▲ Show 20 Lines • Show All 319 Lines • Show Last 20 Lines |