19#include "mainwindow2.h"
20#include "ui_mainwindow2.h"
23#include <QActionGroup>
29#include <QProgressDialog>
30#include <QTabletEvent>
31#include <QStandardPaths>
40#include "pencilsettings.h"
44#include "filemanager.h"
45#include "colormanager.h"
46#include "layermanager.h"
47#include "toolmanager.h"
48#include "playbackmanager.h"
49#include "selectionmanager.h"
50#include "soundmanager.h"
51#include "viewmanager.h"
52#include "selectionmanager.h"
54#include "actioncommands.h"
55#include "fileformat.h"
57#include "backupelement.h"
61#include "colorinspector.h"
62#include "colorpalettewidget.h"
63#include "tooloptionwidget.h"
64#include "preferencesdialog.h"
67#include "onionskinwidget.h"
68#include "pegbaralignmentdialog.h"
69#include "repositionframesdialog.h"
72#include "errordialog.h"
73#include "filedialog.h"
74#include "importimageseqdialog.h"
75#include "importlayersdialog.h"
76#include "importpositiondialog.h"
77#include "layeropacitydialog.h"
78#include "recentfilemenu.h"
79#include "shortcutfilter.h"
81#include "presetdialog.h"
82#include "pegbaralignmentdialog.h"
86#define BUILD_DATE S__GIT_TIMESTAMP
88#define BUILD_DATE __DATE__
91#if defined(PENCIL2D_RELEASE_BUILD)
92#define PENCIL_WINDOW_TITLE QString("[*]Pencil2D v%1").arg(APP_VERSION)
93#elif defined(PENCIL2D_NIGHTLY_BUILD)
94#define PENCIL_WINDOW_TITLE QString("[*]Pencil2D Nightly Build %1").arg(BUILD_DATE)
96#define PENCIL_WINDOW_TITLE QString("[*]Pencil2D Development Build %1").arg(BUILD_DATE)
101MainWindow2::MainWindow2(
QWidget* parent) :
109 mEditor =
new Editor(
this);
110 mEditor->setScribbleArea(ui->scribbleArea);
115 ui->scribbleArea->setEditor(mEditor);
116 ui->scribbleArea->init();
118 ui->statusBar->setEditor(mEditor);
119 ui->statusBar->updateZoomStatus();
120 ui->statusBar->setVisible(mEditor->preference()->isOn(SETTING::SHOW_STATUS_BAR));
123 mCommands->setCore(mEditor);
128 setupKeyboardShortcuts();
133 currentLayerChanged();
135 connect(mEditor, &Editor::needSave,
this, &MainWindow2::autoSave);
137 mEditor->tools()->setDefaultTool();
138 ui->background->init(mEditor->preference());
140 setWindowTitle(PENCIL_WINDOW_TITLE);
143MainWindow2::~MainWindow2()
148void MainWindow2::createDockWidgets()
154 mColorBox->
setToolTip(
tr(
"color palette:<br>use <b>(C)</b><br>toggle at cursor"));
162 mColorPalette->setCore(mEditor);
183 mStartIcon =
QIcon(
":icons/controls/play.png");
184 mStopIcon =
QIcon(
":icons/controls/stop.png");
189 pWidget->setFeatures(QDockWidget::DockWidgetFeature::DockWidgetClosable |
190 QDockWidget::DockWidgetFeature::DockWidgetMovable |
191 QDockWidget::DockWidgetFeature::DockWidgetFloatable);
194 pWidget->setEditor(mEditor);
196 qDebug() <<
"Init Dock widget: " << pWidget->objectName();
216 makeConnections(mEditor, ui->scribbleArea);
217 makeConnections(mEditor);
218 makeConnections(mEditor, mTimeLine);
219 makeConnections(mEditor, mColorBox);
220 makeConnections(mEditor, mColorInspector);
221 makeConnections(mEditor, mColorPalette);
222 makeConnections(mEditor, mToolOptions);
223 makeConnections(mEditor, ui->statusBar);
227 w->setFloating(
false);
233void MainWindow2::createMenus()
266 connect(mEditor, &Editor::updateBackup,
this, &MainWindow2::undoActSetText);
274 connect(mEditor->select(), &SelectionManager::selectionChanged,
this, &MainWindow2::selectionChanged);
289 connect(ui->actionChangeLineColorCurrent_keyframe, &
QAction::triggered, mCommands, &ActionCommands::changeKeyframeLineColor);
290 connect(ui->actionChangeLineColorAll_keyframes_on_layer, &
QAction::triggered, mCommands, &ActionCommands::changeallKeyframeLineColor);
293 QList<QAction*> visibilityActions = ui->menuLayer_Visibility->actions();
295 visibilityGroup->setExclusive(
true);
296 for (
int i = 0; i < visibilityActions.
size(); i++) {
297 QAction* action = visibilityActions[i];
298 visibilityGroup->addAction(action);
301 visibilityActions[mEditor->preference()->getInt(SETTING::LAYER_VISIBILITY)]->setChecked(
true);
302 connect(mEditor->preference(), &PreferenceManager::optionChanged, [=](SETTING e) {
303 if (e == SETTING::LAYER_VISIBILITY) {
304 visibilityActions[mEditor->preference()->getInt(SETTING::LAYER_VISIBILITY)]->setChecked(true);
310 connect(ui->actionZoom_Out, &
QAction::triggered, mCommands, &ActionCommands::ZoomOut);
311 connect(ui->actionRotate_Clockwise, &
QAction::triggered, mCommands, &ActionCommands::rotateClockwise);
312 connect(ui->actionRotate_Anticlockwise, &
QAction::triggered, mCommands, &ActionCommands::rotateCounterClockwise);
313 connect(ui->actionReset_Rotation, &
QAction::triggered, mEditor->view(), &ViewManager::resetRotation);
314 connect(ui->actionReset_View, &
QAction::triggered, mEditor->view(), &ViewManager::resetView);
315 connect(ui->actionCenter_View, &
QAction::triggered, mEditor->view(), &ViewManager::centerView);
316 connect(ui->actionZoom400, &
QAction::triggered, mEditor->view(), &ViewManager::scale400);
317 connect(ui->actionZoom300, &
QAction::triggered, mEditor->view(), &ViewManager::scale300);
318 connect(ui->actionZoom200, &
QAction::triggered, mEditor->view(), &ViewManager::scale200);
319 connect(ui->actionZoom100, &
QAction::triggered, mEditor->view(), &ViewManager::scale100);
320 connect(ui->actionZoom50, &
QAction::triggered, mEditor->view(), &ViewManager::scale50);
321 connect(ui->actionZoom33, &
QAction::triggered, mEditor->view(), &ViewManager::scale33);
322 connect(ui->actionZoom25, &
QAction::triggered, mEditor->view(), &ViewManager::scale25);
323 connect(ui->actionHorizontal_Flip, &
QAction::triggered, mEditor->view(), &ViewManager::flipHorizontal);
324 connect(ui->actionVertical_Flip, &
QAction::triggered, mEditor->view(), &ViewManager::flipVertical);
325 connect(mEditor->view(), &ViewManager::viewFlipped,
this, &MainWindow2::viewFlipped);
329 bindPreferenceSetting(ui->actionStatusBar, prefs, SETTING::SHOW_STATUS_BAR);
330 bindPreferenceSetting(ui->actionThreePointPerspective, prefs, SETTING::OVERLAY_PERSPECTIVE3);
331 bindPreferenceSetting(ui->actionTwoPointPerspective, prefs, SETTING::OVERLAY_PERSPECTIVE2);
332 bindPreferenceSetting(ui->actionOnePointPerspective, prefs, SETTING::OVERLAY_PERSPECTIVE1);
333 bindPreferenceSetting(ui->actionSafeAreas, prefs, SETTING::OVERLAY_SAFE);
334 bindPreferenceSetting(ui->actionGoldenRatio, prefs, SETTING::OVERLAY_GOLDEN);
335 bindPreferenceSetting(ui->actionThirds, prefs, SETTING::OVERLAY_THIRDS);
336 bindPreferenceSetting(ui->actionCenter, prefs, SETTING::OVERLAY_CENTER);
337 bindPreferenceSetting(ui->actionGrid, prefs, SETTING::GRID);
338 bindPreferenceSetting(ui->actionShowOutlinesOnly, prefs, SETTING::OUTLINES);
339 bindPreferenceSetting(ui->actionShowInvisibleLines, prefs, SETTING::INVISIBLE_LINES);
340 bindPreferenceSetting(ui->actionOnionPrev, prefs, SETTING::PREV_ONION);
341 bindPreferenceSetting(ui->actionOnionNext, prefs, SETTING::NEXT_ONION);
343 bool enableSafeArea = (prefs->isOn(SETTING::ACTION_SAFE_ON) || prefs->isOn(SETTING::TITLE_SAFE_ON));
344 ui->actionSafeAreas->setEnabled(enableSafeArea);
346 auto perspectiveLinesAngleGroup =
new QActionGroup(
this);
347 perspectiveLinesAngleGroup->setExclusive(
true);
348 perspectiveLinesAngleGroup->addAction(ui->action2Degrees);
349 perspectiveLinesAngleGroup->addAction(ui->action3Degrees);
350 perspectiveLinesAngleGroup->addAction(ui->action5Degrees);
351 perspectiveLinesAngleGroup->addAction(ui->action7_5Degrees);
352 perspectiveLinesAngleGroup->addAction(ui->action10Degrees);
353 perspectiveLinesAngleGroup->addAction(ui->action15Degrees);
354 perspectiveLinesAngleGroup->addAction(ui->action20Degrees);
355 perspectiveLinesAngleGroup->addAction(ui->action30Degrees);
357 if (action == ui->action2Degrees) mEditor->preference()->set(SETTING::OVERLAY_ANGLE, 2);
358 else if (action == ui->action3Degrees) mEditor->preference()->set(SETTING::OVERLAY_ANGLE, 3);
359 else if (action == ui->action5Degrees) mEditor->preference()->set(SETTING::OVERLAY_ANGLE, 5);
360 else if (action == ui->action7_5Degrees) mEditor->preference()->set(SETTING::OVERLAY_ANGLE, 7);
361 else if (action == ui->action10Degrees) mEditor->preference()->set(SETTING::OVERLAY_ANGLE, 10);
362 else if (action == ui->action15Degrees) mEditor->preference()->set(SETTING::OVERLAY_ANGLE, 15);
363 else if (action == ui->action20Degrees) mEditor->preference()->set(SETTING::OVERLAY_ANGLE, 20);
364 else if (action == ui->action30Degrees) mEditor->preference()->set(SETTING::OVERLAY_ANGLE, 30);
365 else Q_UNREACHABLE();
366 emit mEditor->view()->viewChanged();
369 switch (prefs->getInt(SETTING::OVERLAY_ANGLE)) {
370 case 2: ui->action2Degrees->setChecked(
true);
break;
371 case 3: ui->action3Degrees->setChecked(
true);
break;
372 case 5: ui->action5Degrees->setChecked(
true);
break;
373 case 7: ui->action7_5Degrees->setChecked(
true);
break;
374 case 10: ui->action10Degrees->setChecked(
true);
break;
375 case 15: ui->action15Degrees->setChecked(
true);
break;
376 case 20: ui->action20Degrees->setChecked(
true);
break;
377 case 30: ui->action30Degrees->setChecked(
true);
break;
384 connect(ui->actionLoop, &
QAction::triggered, pPlaybackManager, &PlaybackManager::setLooping);
385 connect(ui->actionLoopControl, &
QAction::triggered, pPlaybackManager, &PlaybackManager::enableRangedPlayback);
386 connect(pPlaybackManager, &PlaybackManager::loopStateChanged, ui->actionLoop, &
QAction::setChecked);
387 connect(pPlaybackManager, &PlaybackManager::loopStateChanged, mTimeLine, &TimeLine::setLoop);
388 connect(pPlaybackManager, &PlaybackManager::rangedPlaybackStateChanged, ui->actionLoopControl, &
QAction::setChecked);
389 connect(pPlaybackManager, &PlaybackManager::rangedPlaybackStateChanged, mTimeLine, &TimeLine::setRangeState);
390 connect(pPlaybackManager, &PlaybackManager::playStateChanged, mTimeLine, &TimeLine::setPlaying);
391 connect(pPlaybackManager, &PlaybackManager::playStateChanged,
this, &MainWindow2::changePlayState);
393 connect(ui->actionFlip_inbetween, &
QAction::triggered, pPlaybackManager, &PlaybackManager::playFlipInBetween);
394 connect(ui->actionFlip_rolling, &
QAction::triggered, pPlaybackManager, &PlaybackManager::playFlipRoll);
397 connect(ui->actionRemove_Frame, &
QAction::triggered, mCommands, &ActionCommands::removeKey);
398 connect(ui->actionAdd_Frame_Exposure, &
QAction::triggered, mCommands, &ActionCommands::addExposureToSelectedFrames);
399 connect(ui->actionSubtract_Frame_Exposure, &
QAction::triggered, mCommands, &ActionCommands::subtractExposureFromSelectedFrames);
400 connect(ui->actionNext_Frame, &
QAction::triggered, mCommands, &ActionCommands::GotoNextFrame);
401 connect(ui->actionPrevious_Frame, &
QAction::triggered, mCommands, &ActionCommands::GotoPrevFrame);
402 connect(ui->actionNext_KeyFrame, &
QAction::triggered, mCommands, &ActionCommands::GotoNextKeyFrame);
403 connect(ui->actionPrev_KeyFrame, &
QAction::triggered, mCommands, &ActionCommands::GotoPrevKeyFrame);
404 connect(ui->actionDuplicate_Frame, &
QAction::triggered, mCommands, &ActionCommands::duplicateKey);
405 connect(ui->actionMove_Frame_Forward, &
QAction::triggered, mCommands, &ActionCommands::moveFrameForward);
406 connect(ui->actionMove_Frame_Backward, &
QAction::triggered, mCommands, &ActionCommands::moveFrameBackward);
408 connect(ui->actionReverse_Frames_Order, &
QAction::triggered, mCommands, &ActionCommands::reverseSelectedFrames);
409 connect(ui->actionRemove_Frames, &
QAction::triggered, mCommands, &ActionCommands::removeSelectedFrames);
415 connect(ui->actionPolyline, &
QAction::triggered, mToolBox, &ToolBoxWidget::polylineOn);
421 connect(ui->actionEyedropper, &
QAction::triggered, mToolBox, &ToolBoxWidget::eyedropperOn);
423 connect(ui->actionResetToolsDefault, &
QAction::triggered, mEditor->tools(), &ToolManager::resetAllTools);
426 QMenu* winMenu = ui->menuWindows;
427 const std::vector<QAction*> actions
429 mToolBox->toggleViewAction(),
430 mToolOptions->toggleViewAction(),
431 mColorBox->toggleViewAction(),
432 mColorPalette->toggleViewAction(),
433 mTimeLine->toggleViewAction(),
434 mColorInspector->toggleViewAction(),
435 mOnionSkinWidget->toggleViewAction()
438 for (
QAction* action : actions)
441 winMenu->
insertAction(ui->menuToolbars->menuAction(), action);
444 connect(ui->actionResetWindows, &
QAction::triggered,
this, &MainWindow2::resetAndDockAllSubWidgets);
445 connect(ui->actionLockWindows, &
QAction::toggled,
this, &MainWindow2::lockWidgets);
446 bindPreferenceSetting(ui->actionLockWindows, prefs, SETTING::LAYOUT_LOCK);
450 connect(ui->actionQuick_Guide, &
QAction::triggered, mCommands, &ActionCommands::quickGuide);
454 connect(ui->actionCheck_for_Updates, &
QAction::triggered, mCommands, &ActionCommands::checkForUpdates);
455 connect(ui->actionReport_Bug, &
QAction::triggered, mCommands, &ActionCommands::reportbug);
456 connect(ui->actionOpen_Temporary_Directory, &
QAction::triggered, mCommands, &ActionCommands::openTemporaryDirectory);
461 mRecentFileMenu->loadFromDisk();
462 ui->menuFile->insertMenu(ui->actionSave, mRecentFileMenu);
464 connect(mRecentFileMenu, &RecentFileMenu::loadRecentFile,
this, &MainWindow2::openFile);
467void MainWindow2::setOpacity(
int opacity)
469 mEditor->preference()->set(SETTING::WINDOW_OPACITY, 100 - opacity);
473void MainWindow2::updateSaveState()
475 const bool hasUnsavedChanges = mEditor->currentBackup() != mBackupAtSave;
477 ui->statusBar->updateModifiedStatus(hasUnsavedChanges);
480void MainWindow2::openPegAlignDialog()
482 if (mPegAlign !=
nullptr)
485 tr(
"Dialog is already open!"),
495 flags &= (
~Qt::WindowContextHelpButtonHint);
504void MainWindow2::openLayerOpacityDialog()
506 if (mLayerOpacityDialog !=
nullptr)
509 tr(
"Dialog is already open!"),
515 mLayerOpacityDialog->setCore(mEditor);
516 mLayerOpacityDialog->initUI();
518 mLayerOpacityDialog->
show();
522 mLayerOpacityDialog =
nullptr;
526void MainWindow2::openRepositionDialog()
528 if (mEditor->layers()->currentLayer()->getSelectedFramesByPos().
count() < 2)
531 tr(
"Please select at least 2 frames!"),
535 if (mReposDialog !=
nullptr)
543 hideQuestionMark(*mReposDialog);
544 mReposDialog->setCore(mEditor);
545 mReposDialog->initUI();
546 mEditor->tools()->setCurrentTool(ToolType::MOVE);
548 mReposDialog->
show();
551void MainWindow2::closeRepositionDialog()
554 mReposDialog =
nullptr;
557void MainWindow2::currentLayerChanged()
559 bool isBitmap = (mEditor->layers()->currentLayer()->type() == Layer::BITMAP);
560 ui->menuChange_line_color->setEnabled(isBitmap);
562 bool isVector = (mEditor->layers()->currentLayer()->type() == Layer::VECTOR);
563 ui->actionShowInvisibleLines->setEnabled(isVector);
564 ui->actionShowOutlinesOnly->setEnabled(isVector);
567void MainWindow2::selectionChanged()
569 bool somethingSelected = mEditor->select()->somethingSelected();
570 ui->menuSelection->setEnabled(somethingSelected);
573void MainWindow2::viewFlipped()
575 ui->actionHorizontal_Flip->setChecked(mEditor->view()->isFlipHorizontal());
576 ui->actionVertical_Flip->setChecked(mEditor->view()->isFlipVertical());
595 m2ndCloseEvent =
true;
603void MainWindow2::newDocument()
605 if (maybeSave() && !tryLoadPreset())
611void MainWindow2::openDocument()
620 openObject(fileName);
624bool MainWindow2::saveAsNewDocument()
631 return saveObject(fileName);
634void MainWindow2::openStartupFile(
const QString& filename)
636 if (tryRecoverUnsavedProject())
641 if (!filename.
isEmpty() && openObject(filename))
646 loadMostRecent() || tryLoadPreset();
649void MainWindow2::openFile(
const QString& filename)
653 openObject(filename);
657bool MainWindow2::openObject(
const QString& strFilePath)
660 hideQuestionMark(progress);
664 Status s = mEditor->openObject(strFilePath, [&progress](
int p)
666 progress.setValue(p);
668 }, [&progress](
int max)
670 progress.setRange(0, max);
675 ErrorDialog errorDialog(s.title(), s.description(), s.details().str());
677 emptyDocumentWhenErrorOccurred();
682 settings.setValue(LAST_PCLX_PATH, mEditor->object()->filePath());
685 if (!mEditor->object()->filePath().
isEmpty())
687 mRecentFileMenu->addRecentFile(mEditor->object()->filePath());
688 mRecentFileMenu->saveToDisk();
695 ui->statusBar->updateModifiedStatus(
false);
697 progress.setValue(progress.maximum());
702 if (!
QFileInfo(strFilePath).isWritable())
705 tr(
"This program does not currently have permission to write to the file you have selected. "
706 "Please make sure you have write permission for this file before attempting to save it. "
707 "Alternatively, you can use the Save As... menu option to save to a writable location."),
714bool MainWindow2::saveObject(
QString strSavedFileName)
717 hideQuestionMark(progress);
721 mEditor->prepareSave();
725 connect(&fm, &FileManager::progressChanged, [&progress](
int p)
727 progress.setValue(p);
730 connect(&fm, &FileManager::progressRangeChanged, [&progress](
int max)
732 progress.setRange(0, max + 3);
735 Status st = fm.save(mEditor->object(), strSavedFileName);
740#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
745 errorLogFolder.mkpath(
"./logs");
746 errorLogFolder.cd(
"logs");
754 out << st.details().str();
759 st.description().append(
tr(
"<br><br>An error has occurred and your file may not have saved successfully."
760 "If you believe that this error is an issue with Pencil2D, please create a new issue at:"
761 "<br><a href='https://github.com/pencil2d/pencil/issues'>https://github.com/pencil2d/pencil/issues</a><br>"
762 "Please be sure to include the following details in your issue:")), st.details().html());
767 mEditor->object()->setFilePath(strSavedFileName);
768 mEditor->object()->setModified(
false);
770 mEditor->clearTemporary();
773 settings.setValue(LAST_PCLX_PATH, strSavedFileName);
775 mRecentFileMenu->addRecentFile(strSavedFileName);
776 mRecentFileMenu->saveToDisk();
778 mTimeLine->updateContent();
781 mBackupAtSave = mEditor->currentBackup();
784 progress.setValue(progress.maximum());
786 mEditor->resetAutoSaveCounter();
791bool MainWindow2::saveDocument()
793 if (!mEditor->object()->filePath().
isEmpty())
794 return saveObject(mEditor->object()->filePath());
796 return saveAsNewDocument();
799bool MainWindow2::maybeSave()
801 if (mEditor->currentBackup() == mBackupAtSave)
807 tr(
"This animation has been modified.\n Do you want to save your changes?"),
810 return saveDocument();
815bool MainWindow2::autoSave()
817 if (!mEditor->object()->filePath().
isEmpty())
819 return saveDocument();
822 if (mEditor->autoSaveNeverAskAgain())
825 if(mSuppressAutoSaveDialog)
830 msgBox.setWindowTitle(
tr(
"AutoSave Reminder"));
831 msgBox.setText(
tr(
"The animation is not saved yet.\n Do you want to save now?"));
836 int ret = msgBox.exec();
839 return saveDocument();
843 mEditor->dontAskAutoSave(
true);
849void MainWindow2::emptyDocumentWhenErrorOccurred()
857void MainWindow2::importImage()
861 if (strFilePath.
isEmpty()) {
return; }
865 OnScopeExit(
delete positionDialog)
867 positionDialog->
exec();
874 Status st = mEditor->importImage(strFilePath);
877 ErrorDialog errorDialog(st.title(), st.description(), st.details().html());
882 ui->scribbleArea->updateFrame();
883 mTimeLine->updateContent();
886void MainWindow2::importImageSequence()
888 mSuppressAutoSaveDialog =
true;
891 OnScopeExit(
delete imageSeqDialog)
892 imageSeqDialog->setCore(mEditor);
896 imageSeqDialog->
exec();
903 OnScopeExit(
delete positionDialog)
905 positionDialog->
exec();
911 imageSeqDialog->importArbitrarySequence();
913 mSuppressAutoSaveDialog =
false;
916void MainWindow2::importPredefinedImageSet()
919 OnScopeExit(
delete imageSeqDialog)
920 imageSeqDialog->setCore(mEditor);
924 mSuppressAutoSaveDialog =
true;
925 imageSeqDialog->
exec();
932 OnScopeExit(
delete positionDialog)
934 positionDialog->
exec();
940 imageSeqDialog->importPredefinedSet();
941 mSuppressAutoSaveDialog =
false;
944void MainWindow2::importLayers()
947 importLayers->setCore(mEditor);
949 importLayers->
open();
952void MainWindow2::importAnimatedImage()
955 mSuppressAutoSaveDialog =
true;
957 mCommands->importAnimatedImage();
959 mSuppressAutoSaveDialog =
false;
962void MainWindow2::lockWidgets(
bool shouldLock)
966 : (QDockWidget::DockWidgetFeature::DockWidgetClosable |
967 QDockWidget::DockWidgetFeature::DockWidgetMovable |
968 QDockWidget::DockWidgetFeature::DockWidgetFloatable);
972 d->setFeatures(feat);
977 QWidget* customTitleBarWidget = shouldLock ? (
new QWidget) :
nullptr;
978 d->setTitleBarWidget(customTitleBarWidget);
982void MainWindow2::preferences()
987 mPrefDialog->
raise();
993 mPrefDialog->init(mEditor->preference());
995 connect(mPrefDialog, &PreferencesDialog::windowOpacityChange,
this, &MainWindow2::setOpacity);
996 connect(mPrefDialog, &PreferencesDialog::soundScrubChanged, mEditor->playback(), &PlaybackManager::setSoundScrubActive);
997 connect(mPrefDialog, &PreferencesDialog::soundScrubMsecChanged, mEditor->playback(), &PlaybackManager::setSoundScrubMsec);
1000 clearKeyboardShortcuts();
1001 setupKeyboardShortcuts();
1002 mPrefDialog =
nullptr;
1005 mPrefDialog->
show();
1008void MainWindow2::resetAndDockAllSubWidgets()
1011 settings.remove(SETTING_WINDOW_GEOMETRY);
1012 settings.remove(SETTING_WINDOW_STATE);
1016 dock->setFloating(
false);
1030void MainWindow2::newObject()
1032 auto object =
new Object();
1036 object->addNewCameraLayer();
1037 object->addNewBitmapLayer();
1041 object->data()->setCurrentLayer(1);
1043 mEditor->setObject(
object);
1051bool MainWindow2::newObjectFromPresets(
int presetIndex)
1053 QString presetFilePath = PresetDialog::getPresetPath(presetIndex);
1061 Object*
object = fm.load(presetFilePath);
1063 if (!fm.error().ok() ||
object ==
nullptr)
1068 mEditor->setObject(
object);
1069 object->setFilePath(
QString());
1078bool MainWindow2::loadMostRecent()
1080 if(!mEditor->preference()->isOn(SETTING::LOAD_MOST_RECENT))
1086 QString myPath = settings.value(LAST_PCLX_PATH,
QVariant(
"")).toString();
1091 return openObject(myPath);
1094bool MainWindow2::tryLoadPreset()
1096 if (!mEditor->preference()->isOn(SETTING::ASK_FOR_PRESET))
1098 int defaultPreset = mEditor->preference()->getInt(SETTING::DEFAULT_PRESET);
1099 return newObjectFromPresets(defaultPreset);
1111 int presetIndex = presetDialog->getPresetIndex();
1112 if (presetDialog->shouldAlwaysUse())
1114 mEditor->preference()->set(SETTING::ASK_FOR_PRESET, false);
1115 mEditor->preference()->set(SETTING::DEFAULT_PRESET, presetIndex);
1117 if (!newObjectFromPresets(presetIndex))
1122 presetDialog->
open();
1126void MainWindow2::closeDialogs()
1133void MainWindow2::readSettings()
1137 QVariant winGeometry = settings.
value(SETTING_WINDOW_GEOMETRY);
1143 int opacity = mEditor->preference()->getInt(SETTING::WINDOW_OPACITY);
1144 setOpacity(100 - opacity);
1146 bool isWindowsLocked = mEditor->preference()->isOn(SETTING::LAYOUT_LOCK);
1147 lockWidgets(isWindowsLocked);
1150void MainWindow2::writeSettings()
1153 settings.setValue(SETTING_WINDOW_GEOMETRY,
saveGeometry());
1154 settings.setValue(SETTING_WINDOW_STATE,
saveState());
1157void MainWindow2::setupKeyboardShortcuts()
1159 checkExistingShortcuts();
1163 strCommandName =
QString(
"shortcuts/") + strCommandName;
1168 ui->actionNew->setShortcut(cmdKeySeq(CMD_NEW_FILE));
1169 ui->actionOpen->setShortcut(cmdKeySeq(CMD_OPEN_FILE));
1170 ui->actionSave->setShortcut(cmdKeySeq(CMD_SAVE_FILE));
1171 ui->actionSave_as->setShortcut(cmdKeySeq(CMD_SAVE_AS));
1173 ui->actionImport_Image->setShortcut(cmdKeySeq(CMD_IMPORT_IMAGE));
1174 ui->actionImport_ImageSeq->setShortcut(cmdKeySeq(CMD_IMPORT_IMAGE_SEQ));
1175 ui->actionImport_MovieVideo->setShortcut(cmdKeySeq(CMD_IMPORT_MOVIE_VIDEO));
1176 ui->actionImport_MovieAudio->setShortcut(cmdKeySeq(CMD_IMPORT_MOVIE_AUDIO));
1177 ui->actionImport_Append_Palette->setShortcut(cmdKeySeq(CMD_IMPORT_PALETTE));
1178 ui->actionImport_Sound->setShortcut(cmdKeySeq(CMD_IMPORT_SOUND));
1180 ui->actionExport_Image->setShortcut(cmdKeySeq(CMD_EXPORT_IMAGE));
1181 ui->actionExport_ImageSeq->setShortcut(cmdKeySeq(CMD_EXPORT_IMAGE_SEQ));
1182 ui->actionExport_Movie->setShortcut(cmdKeySeq(CMD_EXPORT_MOVIE));
1183 ui->actionExport_Palette->setShortcut(cmdKeySeq(CMD_EXPORT_PALETTE));
1186 ui->actionUndo->setShortcut(cmdKeySeq(CMD_UNDO));
1187 ui->actionRedo->setShortcut(cmdKeySeq(CMD_REDO));
1188 ui->actionCut->setShortcut(cmdKeySeq(CMD_CUT));
1189 ui->actionCopy->setShortcut(cmdKeySeq(CMD_COPY));
1190 ui->actionPaste_Previous->setShortcut(cmdKeySeq(CMD_PASTE_FROM_PREVIOUS));
1191 ui->actionPaste->setShortcut(cmdKeySeq(CMD_PASTE));
1192 ui->actionClearFrame->setShortcut(cmdKeySeq(CMD_CLEAR_FRAME));
1193 ui->actionFlip_X->setShortcut(cmdKeySeq(CMD_SELECTION_FLIP_HORIZONTAL));
1194 ui->actionFlip_Y->setShortcut(cmdKeySeq(CMD_SELECTION_FLIP_VERTICAL));
1195 ui->actionSelect_All->setShortcut(cmdKeySeq(CMD_SELECT_ALL));
1196 ui->actionDeselect_All->setShortcut(cmdKeySeq(CMD_DESELECT_ALL));
1197 ui->actionPreference->setShortcut(cmdKeySeq(CMD_PREFERENCE));
1200 ui->actionResetWindows->setShortcut(cmdKeySeq(CMD_RESET_WINDOWS));
1201 ui->actionReset_View->setShortcut(cmdKeySeq(CMD_RESET_ZOOM_ROTATE));
1202 ui->actionCenter_View->setShortcut(cmdKeySeq(CMD_CENTER_VIEW));
1203 ui->actionZoom_In->setShortcut(cmdKeySeq(CMD_ZOOM_IN));
1204 ui->actionZoom_Out->setShortcut(cmdKeySeq(CMD_ZOOM_OUT));
1205 ui->actionZoom400->setShortcut(cmdKeySeq(CMD_ZOOM_400));
1206 ui->actionZoom300->setShortcut(cmdKeySeq(CMD_ZOOM_300));
1207 ui->actionZoom200->setShortcut(cmdKeySeq(CMD_ZOOM_200));
1208 ui->actionZoom100->setShortcut(cmdKeySeq(CMD_ZOOM_100));
1209 ui->actionZoom50->setShortcut(cmdKeySeq(CMD_ZOOM_50));
1210 ui->actionZoom33->setShortcut(cmdKeySeq(CMD_ZOOM_33));
1211 ui->actionZoom25->setShortcut(cmdKeySeq(CMD_ZOOM_25));
1212 ui->actionRotate_Clockwise->setShortcut(cmdKeySeq(CMD_ROTATE_CLOCK));
1213 ui->actionRotate_Anticlockwise->setShortcut(cmdKeySeq(CMD_ROTATE_ANTI_CLOCK));
1214 ui->actionReset_Rotation->setShortcut(cmdKeySeq(CMD_RESET_ROTATION));
1215 ui->actionHorizontal_Flip->setShortcut(cmdKeySeq(CMD_FLIP_HORIZONTAL));
1216 ui->actionVertical_Flip->setShortcut(cmdKeySeq(CMD_FLIP_VERTICAL));
1217 ui->actionPreview->setShortcut(cmdKeySeq(CMD_PREVIEW));
1218 ui->actionGrid->setShortcut(cmdKeySeq(CMD_GRID));
1219 ui->actionOnionPrev->setShortcut(cmdKeySeq(CMD_ONIONSKIN_PREV));
1220 ui->actionOnionNext->setShortcut(cmdKeySeq(CMD_ONIONSKIN_NEXT));
1221 ui->actionStatusBar->setShortcut(cmdKeySeq(CMD_TOGGLE_STATUS_BAR));
1223 ui->actionPlay->setShortcut(cmdKeySeq(CMD_PLAY));
1224 ui->actionLoop->setShortcut(cmdKeySeq(CMD_LOOP));
1225 ui->actionPrevious_Frame->setShortcut(cmdKeySeq(CMD_GOTO_PREV_FRAME));
1226 ui->actionNext_Frame->setShortcut(cmdKeySeq(CMD_GOTO_NEXT_FRAME));
1227 ui->actionPrev_KeyFrame->setShortcut(cmdKeySeq(CMD_GOTO_PREV_KEY_FRAME));
1228 ui->actionNext_KeyFrame->setShortcut(cmdKeySeq(CMD_GOTO_NEXT_KEY_FRAME));
1229 ui->actionAdd_Frame->setShortcut(cmdKeySeq(CMD_ADD_FRAME));
1230 ui->actionDuplicate_Frame->setShortcut(cmdKeySeq(CMD_DUPLICATE_FRAME));
1231 ui->actionRemove_Frame->setShortcut(cmdKeySeq(CMD_REMOVE_FRAME));
1232 ui->actionAdd_Frame_Exposure->setShortcut(cmdKeySeq(CMD_SELECTION_ADD_FRAME_EXPOSURE));
1233 ui->actionSubtract_Frame_Exposure->setShortcut(cmdKeySeq(CMD_SELECTION_SUBTRACT_FRAME_EXPOSURE));
1234 ui->actionReverse_Frames_Order->setShortcut(cmdKeySeq(CMD_REVERSE_SELECTED_FRAMES));
1235 ui->actionRemove_Frames->setShortcut(cmdKeySeq(CMD_REMOVE_SELECTED_FRAMES));
1236 ui->actionMove_Frame_Backward->setShortcut(cmdKeySeq(CMD_MOVE_FRAME_BACKWARD));
1237 ui->actionMove_Frame_Forward->setShortcut(cmdKeySeq(CMD_MOVE_FRAME_FORWARD));
1238 ui->actionFlip_inbetween->setShortcut(cmdKeySeq(CMD_FLIP_INBETWEEN));
1239 ui->actionFlip_rolling->setShortcut(cmdKeySeq(CMD_FLIP_ROLLING));
1242 ui->actionMove->setShortcut(cmdKeySeq(CMD_TOOL_MOVE));
1243 ui->actionSelect->setShortcut(cmdKeySeq(CMD_TOOL_SELECT));
1244 ui->actionBrush->setShortcut(cmdKeySeq(CMD_TOOL_BRUSH));
1245 ui->actionPolyline->setShortcut(cmdKeySeq(CMD_TOOL_POLYLINE));
1246 ui->actionSmudge->setShortcut(cmdKeySeq(CMD_TOOL_SMUDGE));
1247 ui->actionPen->setShortcut(cmdKeySeq(CMD_TOOL_PEN));
1248 ui->actionHand->setShortcut(cmdKeySeq(CMD_TOOL_HAND));
1249 ui->actionPencil->setShortcut(cmdKeySeq(CMD_TOOL_PENCIL));
1250 ui->actionBucket->setShortcut(cmdKeySeq(CMD_TOOL_BUCKET));
1251 ui->actionEyedropper->setShortcut(cmdKeySeq(CMD_TOOL_EYEDROPPER));
1252 ui->actionEraser->setShortcut(cmdKeySeq(CMD_TOOL_ERASER));
1254 ui->actionMove->installEventFilter(shortcutFilter);
1255 ui->actionMove->installEventFilter(shortcutFilter);
1256 ui->actionSelect->installEventFilter(shortcutFilter);
1257 ui->actionBrush->installEventFilter(shortcutFilter);
1258 ui->actionPolyline->installEventFilter(shortcutFilter);
1259 ui->actionSmudge->installEventFilter(shortcutFilter);
1260 ui->actionPen->installEventFilter(shortcutFilter);
1261 ui->actionHand->installEventFilter(shortcutFilter);
1262 ui->actionPencil->installEventFilter(shortcutFilter);
1263 ui->actionBucket->installEventFilter(shortcutFilter);
1264 ui->actionEyedropper->installEventFilter(shortcutFilter);
1265 ui->actionEraser->installEventFilter(shortcutFilter);
1267 ui->actionNew_Bitmap_Layer->setShortcut(cmdKeySeq(CMD_NEW_BITMAP_LAYER));
1268 ui->actionNew_Vector_Layer->setShortcut(cmdKeySeq(CMD_NEW_VECTOR_LAYER));
1269 ui->actionNew_Camera_Layer->setShortcut(cmdKeySeq(CMD_NEW_CAMERA_LAYER));
1270 ui->actionNew_Sound_Layer->setShortcut(cmdKeySeq(CMD_NEW_SOUND_LAYER));
1271 ui->actionDelete_Current_Layer->setShortcut(cmdKeySeq(CMD_DELETE_CUR_LAYER));
1273 ui->actionVisibilityCurrentLayerOnly->setShortcut(cmdKeySeq(CMD_CURRENT_LAYER_VISIBILITY));
1274 ui->actionVisibilityRelative->setShortcut(cmdKeySeq(CMD_RELATIVE_LAYER_VISIBILITY));
1275 ui->actionVisibilityAll->setShortcut(cmdKeySeq(CMD_ALL_LAYER_VISIBILITY));
1277 mToolBox->toggleViewAction()->setShortcut(cmdKeySeq(CMD_TOGGLE_TOOLBOX));
1285 ui->actionHelp->setShortcut(cmdKeySeq(CMD_HELP));
1286 ui->actionExit->setShortcut(cmdKeySeq(CMD_EXIT));
1289void MainWindow2::clearKeyboardShortcuts()
1292 for (
QAction* action : actionList)
1298void MainWindow2::undoActSetText()
1300 if (mEditor->mBackupIndex < 0)
1302 ui->actionUndo->setText(
tr(
"Undo",
"Menu item text"));
1303 ui->actionUndo->setEnabled(
false);
1307 ui->actionUndo->setText(
QString(
"%1 %2 %3").arg(
tr(
"Undo",
"Menu item text"))
1308 .arg(mEditor->mBackupIndex + 1)
1309 .
arg(mEditor->mBackupList.
at(mEditor->mBackupIndex)->undoText));
1310 ui->actionUndo->setEnabled(
true);
1313 if (mEditor->mBackupIndex + 2 < mEditor->mBackupList.
size())
1315 ui->actionRedo->setText(
QString(
"%1 %2 %3").arg(
tr(
"Redo",
"Menu item text"))
1316 .arg(mEditor->mBackupIndex + 2)
1317 .
arg(mEditor->mBackupList.
at(mEditor->mBackupIndex + 1)->undoText));
1318 ui->actionRedo->setEnabled(
true);
1322 ui->actionRedo->setText(
tr(
"Redo",
"Menu item text"));
1323 ui->actionRedo->setEnabled(
false);
1327void MainWindow2::exportPalette()
1332 mEditor->object()->exportPalette(filePath);
1336void MainWindow2::importPalette()
1341 mEditor->object()->importPalette(filePath);
1342 mColorPalette->refreshColorList();
1343 mColorPalette->adjustSwatches();
1344 mEditor->color()->setColorNumber(0);
1348void MainWindow2::openPalette()
1350 for (
int i = 0; i < mEditor->object()->getColorCount(); i++)
1352 if (!mEditor->object()->isColorInUse(i))
1358 msgBox.
setText(
tr(
"Opening a palette will replace the old palette.\n"
1359 "Color(s) in strokes will be altered by this action!"));
1375 mEditor->object()->openPalette(filePath);
1376 mColorPalette->refreshColorList();
1377 mEditor->color()->setColorNumber(0);
1380void MainWindow2::makeConnections(
Editor* editor)
1382 connect(editor, &Editor::updateBackup,
this, &MainWindow2::updateSaveState);
1383 connect(editor, &Editor::needDisplayInfo,
this, &MainWindow2::displayMessageBox);
1384 connect(editor, &Editor::needDisplayInfoNoTitle,
this, &MainWindow2::displayMessageBoxNoTitle);
1385 connect(editor->layers(), &LayerManager::currentLayerChanged,
this, &MainWindow2::currentLayerChanged);
1386 connect(editor->select(), &SelectionManager::selectionChanged,
this, &MainWindow2::selectionChanged);
1387 connect(editor, &Editor::canCopyChanged,
this, [=](
bool canCopy) {
1388 ui->actionCopy->setEnabled(canCopy);
1389 ui->actionCut->setEnabled(canCopy);
1394void MainWindow2::makeConnections(
Editor* editor,
ColorBox* colorBox)
1396 connect(colorBox, &ColorBox::colorChanged, editor->color(), &ColorManager::setFrontColor);
1397 connect(editor->color(), &ColorManager::colorChanged, colorBox, &ColorBox::setColor);
1402 connect(colorInspector, &ColorInspector::colorChanged, editor->color(), &ColorManager::setFrontColor);
1403 connect(editor->color(), &ColorManager::colorChanged, colorInspector, &ColorInspector::setColor);
1408 connect(editor->tools(), &ToolManager::toolChanged, scribbleArea, &ScribbleArea::updateToolCursor);
1409 connect(editor->tools(), &ToolManager::toolChanged, mToolBox, &ToolBoxWidget::onToolSetActive);
1410 connect(editor->tools(), &ToolManager::toolPropertyChanged, scribbleArea, &ScribbleArea::updateToolCursor);
1422void MainWindow2::makeConnections(
Editor* pEditor,
TimeLine* pTimeline)
1425 connect(pTimeline, &TimeLine::duplicateLayerClick, mCommands, &ActionCommands::duplicateLayer);
1426 connect(pTimeline, &TimeLine::duplicateKeyClick, mCommands, &ActionCommands::duplicateKey);
1428 connect(pTimeline, &TimeLine::soundClick, pPlaybackManager, &PlaybackManager::enableSound);
1429 connect(pTimeline, &TimeLine::fpsChanged, pPlaybackManager, &PlaybackManager::setFps);
1430 connect(pTimeline, &TimeLine::fpsChanged, pEditor, &Editor::setFps);
1433 connect(pTimeline, &TimeLine::removeKeyClick, mCommands, &ActionCommands::removeKey);
1435 connect(pTimeline, &TimeLine::newBitmapLayer, mCommands, &ActionCommands::addNewBitmapLayer);
1436 connect(pTimeline, &TimeLine::newVectorLayer, mCommands, &ActionCommands::addNewVectorLayer);
1437 connect(pTimeline, &TimeLine::newSoundLayer, mCommands, &ActionCommands::addNewSoundLayer);
1438 connect(pTimeline, &TimeLine::newCameraLayer, mCommands, &ActionCommands::addNewCameraLayer);
1439 connect(mTimeLine, &TimeLine::playButtonTriggered, mCommands, &ActionCommands::PlayStop);
1440 connect(pTimeline, &TimeLine::deleteCurrentLayerClick, mCommands, &ActionCommands::deleteCurrentLayer);
1444 connect(pTimeline, &TimeLine::selectionChanged,
this, &MainWindow2::updateCopyCutPasteEnabled);
1446 connect(mEditor->select(), &SelectionManager::selectionChanged,
this, &MainWindow2::updateCopyCutPasteEnabled);
1448 connect(pEditor->layers(), &LayerManager::currentLayerChanged, pTimeline, &TimeLine::updateUI);
1450 connect(pEditor->sound(), &SoundManager::soundClipDurationChanged, pTimeline, &TimeLine::updateUI);
1455 connect(pEditor, &Editor::objectLoaded, pTimeline, &TimeLine::onObjectLoaded);
1456 connect(pEditor, &Editor::updateTimeLine, pTimeline, &TimeLine::updateUI);
1457 connect(pEditor, &Editor::updateTimeLineCached, pTimeline, &TimeLine::updateUICached);
1459 connect(pEditor->layers(), &LayerManager::currentLayerChanged,
this, &MainWindow2::updateLayerMenu);
1460 connect(pEditor->layers(), &LayerManager::currentLayerChanged, mToolOptions, &ToolOptionWidget::updateUI);
1469 toolOptions->makeConnectionToEditor(editor);
1474 connect(pEditor, &Editor::objectLoaded, pColorPalette, &ColorPaletteWidget::updateUI);
1477 ScribbleArea* pScribbleArea = pEditor->getScribbleArea();
1479 connect(pColorPalette, &ColorPaletteWidget::colorNumberChanged, pColorManager, &ColorManager::setColorNumber);
1480 connect(pColorManager, &ColorManager::colorNumberChanged, pScribbleArea, &ScribbleArea::paletteColorChanged);
1481 connect(pColorManager, &ColorManager::colorNumberChanged, pColorPalette, &ColorPaletteWidget::selectColorNumber);
1484void MainWindow2::makeConnections(
Editor* editor,
StatusBar *statusBar)
1493void MainWindow2::updateCopyCutPasteEnabled()
1495 bool canCopy = mEditor->canCopy();
1496 bool canPaste = mEditor->canPaste();
1498 ui->actionCopy->setEnabled(canCopy);
1499 ui->actionCut->setEnabled(canCopy);
1500 ui->actionPaste->setEnabled(canPaste);
1503void MainWindow2::updateLayerMenu()
1505 ui->actionDelete_Current_Layer->setEnabled(mEditor->layers()->canDeleteLayer(mEditor->currentLayerIndex()));
1508void MainWindow2::changePlayState(
bool isPlaying)
1512 ui->actionPlay->setText(
tr(
"Stop"));
1513 ui->actionPlay->setIcon(mStopIcon);
1517 ui->actionPlay->setText(
tr(
"Play"));
1518 ui->actionPlay->setIcon(mStartIcon);
1523void MainWindow2::importMovieVideo()
1526 mSuppressAutoSaveDialog =
true;
1528 mCommands->importMovieVideo();
1530 mSuppressAutoSaveDialog =
false;
1533bool MainWindow2::event(
QEvent* event)
1541void MainWindow2::displayMessageBox(
const QString& title,
const QString& body)
1546void MainWindow2::displayMessageBoxNoTitle(
const QString& body)
1551bool MainWindow2::tryRecoverUnsavedProject()
1554 QStringList recoverables = fm.searchForUnsavedProjects();
1556 if (recoverables.
empty())
1561 QString caption =
tr(
"Restore Project?");
1562 QString text =
tr(
"Pencil2D didn't close correctly. Would you like to restore the project?");
1564 QString recoverPath = recoverables[0];
1575 hideQuestionMark(*msgBox);
1582void MainWindow2::startProjectRecovery(
int result)
1597 Object* o = fm.recoverUnsavedProject(recoverPath);
1598 if (!fm.error().ok())
1600 Q_ASSERT(o ==
nullptr);
1601 const QString title =
tr(
"Recovery Failed.");
1602 const QString text =
tr(
"Sorry! Pencil2D is unable to restore your project");
1608 mEditor->setObject(o);
1612 const QString title =
tr(
"Recovery Succeeded!");
1613 const QString text =
tr(
"Please save your work immediately to prevent loss of data");
1617void MainWindow2::createToolbars()
1622 mMainToolbar->
addAction(ui->actionOpen);
1623 mMainToolbar->
addAction(ui->actionSave);
1625 mMainToolbar->
addAction(ui->actionUndo);
1626 mMainToolbar->
addAction(ui->actionRedo);
1629 mMainToolbar->
addAction(ui->actionCopy);
1630 mMainToolbar->
addAction(ui->actionPaste);
1631 mMainToolbar->
addAction(ui->actionClearFrame);
1635 mViewToolbar->
addAction(ui->actionZoom_In);
1636 mViewToolbar->
addAction(ui->actionZoom_Out);
1637 mViewToolbar->
addAction(ui->actionReset_View);
1639 mViewToolbar->
addAction(ui->actionHorizontal_Flip);
1640 mViewToolbar->
addAction(ui->actionVertical_Flip);
1642 mViewToolbar->
addAction(ui->actionShowInvisibleLines);
1643 mViewToolbar->
addAction(ui->actionShowOutlinesOnly);
1647 mOverlayToolbar->
addAction(ui->actionGrid);
1648 mOverlayToolbar->
addAction(ui->actionCenter);
1649 mOverlayToolbar->
addAction(ui->actionThirds);
1650 mOverlayToolbar->
addAction(ui->actionGoldenRatio);
1651 mOverlayToolbar->
addAction(ui->actionSafeAreas);
1652 mOverlayToolbar->
addAction(ui->actionOnePointPerspective);
1653 mOverlayToolbar->
addAction(ui->actionTwoPointPerspective);
1654 mOverlayToolbar->
addAction(ui->actionThreePointPerspective);
1660 perspectiveLinesAngleButton->
setDefaultAction(ui->menuPerspectiveLinesAngle->menuAction());
1662 mOverlayToolbar->
addWidget(perspectiveLinesAngleButton);
1664 mToolbars = { mMainToolbar, mViewToolbar, mOverlayToolbar };
1668 ui->menuToolbars->addAction(tb->toggleViewAction());
Status insertKeyFrameAtCurrentPosition()
Will insert a keyframe at the current position and push connected frames to the right.
void framesModified()
This should be emitted after modifying multiple frames.
void frameModified(int frameNumber)
This should be emitted after modifying the frame content.
void scrubbed(int frameNumber)
This should be emitted after scrubbing.
static QString getSaveFileName(QWidget *parent, FileType fileType, const QString &caption=QString())
Shows a file dialog which allows the user to select a file save path.
static QString getOpenFileName(QWidget *parent, FileType fileType, const QString &caption=QString())
Shows a file dialog which allows the user to select a file to open.
void notifyAnimationLengthChanged()
This should be emitted whenever the animation length frames, eg.
void windowActivated()
Emitted when window regains focus.
void onScrubbed(int frameNumber)
Frame scrubbed, invalidate relevant cache.
void onViewChanged()
View updated, invalidate relevant cache.
void onObjectLoaded()
Object updated, invalidate all cache.
void onFramesModified()
Multiple frames modified, invalidate cache for affected frames.
void onPlayStateChanged()
Playstate changed, invalidate relevant cache.
void onLayerChanged()
Layer changed, invalidate relevant cache.
void onFrameModified(int frameNumber)
Frame modified, invalidate cache for frame if any.
The status bar of Pencil2D's main window.
void updateToolStatus(ToolType tool)
Updates the status bar with information about the current tool.
void zoomChanged(double scale)
This signal is sent when the user chooses a new zoom level through the status bar.
void updateZoomStatus()
Updates the zoom level displayed in the status bar.
void extendLength(int frame)
Extends the timeline frame length if necessary.
void setShortcut(const QKeySequence &shortcut)
void toggled(bool checked)
void triggered(bool checked)
void triggered(QAction *action)
void processEvents(QEventLoop::ProcessEventsFlags flags)
QDateTime currentDateTime()
void setTimeSpec(Qt::TimeSpec spec)
QString toString(Qt::DateFormat format) const const
void finished(int result)
QEvent::Type type() const const
bool exists() const const
const T & at(int i) const const
int count(const T &value) const const
void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget)
void addToolBar(Qt::ToolBarArea area, QToolBar *toolbar)
void setDockNestingEnabled(bool enabled)
virtual bool event(QEvent *event) override
bool restoreState(const QByteArray &state, int version)
QByteArray saveState(int version) const const
QStatusBar * statusBar() const const
virtual int exec() override
void setIconPixmap(const QPixmap &pixmap)
void setInformativeText(const QString &text)
void open(QObject *receiver, const char *member)
void setWindowModality(Qt::WindowModality windowModality)
void setWindowTitle(const QString &title)
void setText(const QString &text)
QMessageBox::StandardButton warning(QWidget *parent, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setObjectName(const QString &name)
QVariant property(const char *name) const const
QObject * sender() const const
bool setProperty(const char *name, const QVariant &value)
QString tr(const char *sourceText, const char *disambiguation, int n)
QString writableLocation(QStandardPaths::StandardLocation type)
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
bool isEmpty() const const
QString & prepend(QChar ch)
void keySequence(QWindow *window, const QKeySequence &keySequence)
char * toString(const T &value)
QByteArray toByteArray() const const
QString toString() const const