Skip to content

Commit

Permalink
Merge remote-tracking branch 'pencil2d/master' into feat-undo-polylin…
Browse files Browse the repository at this point in the history
…e-segment
  • Loading branch information
MrStevns committed Aug 18, 2024
2 parents 2b3cddf + 5d40d27 commit 08dcbb7
Show file tree
Hide file tree
Showing 89 changed files with 2,489 additions and 1,728 deletions.
6 changes: 3 additions & 3 deletions app/app.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ RESOURCES += data/app.qrc

MUI_TRANSLATIONS += \
translations/mui_cs.po \
translations/mui_de.po
translations/mui_de.po \
translations/mui_it.po

RC_LANGS.cs = --lang LANG_CZECH --sublang SUBLANG_NEUTRAL
RC_LANGS.de = --lang LANG_GERMAN --sublang SUBLANG_NEUTRAL
RC_LANGS.it = --lang LANG_ITALIAN --sublang SUBLANG_NEUTRAL

EXTRA_TRANSLATIONS += \
$$PWD/../translations/pencil_ar.ts \
Expand Down Expand Up @@ -88,7 +90,6 @@ HEADERS += \
src/shortcutspage.h \
src/timelinepage.h \
src/toolspage.h \
src/preview.h \
src/basedockwidget.h \
src/colorbox.h \
src/colorinspector.h \
Expand Down Expand Up @@ -140,7 +141,6 @@ SOURCES += \
src/shortcutspage.cpp \
src/timelinepage.cpp \
src/toolspage.cpp \
src/preview.cpp \
src/basedockwidget.cpp \
src/colorbox.cpp \
src/colorinspector.cpp \
Expand Down
26 changes: 0 additions & 26 deletions app/src/basedockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,8 @@ BaseDockWidget::BaseDockWidget(QWidget* pParent)
"border-width: 1px; }");
}
#endif

}

BaseDockWidget::~BaseDockWidget()
{
}

void BaseDockWidget::resizeEvent(QResizeEvent *event)
{
QDockWidget::resizeEvent(event);

// Not sure where the -2 comes from, but the event width is always 2 more than what is passed to FlowLayout::setGeometry
int minHeight = getMinHeightForWidth(event->size().width() - 2);

if (minHeight < 0) return;

#ifdef __APPLE__
// For some reason the behavior of minimumSize and the margin changes on mac when floating, so we need to do this
#else
int top, bottom;
layout()->getContentsMargins(nullptr, &top, nullptr, &bottom);
minHeight += top + bottom;
#endif
setMinimumSize(QSize(layout()->minimumSize().width(), minHeight));
}

int BaseDockWidget::getMinHeightForWidth(int width)
{
Q_UNUSED(width)
return -1;
}
5 changes: 0 additions & 5 deletions app/src/basedockwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,13 @@ class BaseDockWidget : public QDockWidget
explicit BaseDockWidget(QWidget* pParent);
virtual ~BaseDockWidget();

void resizeEvent(QResizeEvent *event) override;

public:
virtual void initUI() = 0;
virtual void updateUI() = 0;

Editor* editor() const { return mEditor; }
void setEditor( Editor* e ) { mEditor = e; }

protected:
virtual int getMinHeightForWidth(int width);

private:
Editor* mEditor = nullptr;
};
Expand Down
2 changes: 1 addition & 1 deletion app/src/colorbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void ColorBox::initUI()
mColorWheel = new ColorWheel(this);

QVBoxLayout* layout = new QVBoxLayout;
layout->setContentsMargins(5, 5, 5, 5);
layout->setContentsMargins(3, 3, 3, 3);
layout->addWidget(mColorWheel);
layout->setStretch(0, 1);
layout->setStretch(1, 0);
Expand Down
2 changes: 1 addition & 1 deletion app/src/filedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ QString FileDialog::saveDialogCaption(FileType fileType)
case FileType::GIF: return tr("Export Animated GIF");
case FileType::ANIMATED_IMAGE: return tr("Export animated image");
case FileType::MOVIE: return tr("Export movie");
case FileType::SOUND: return tr("Export sound");
case FileType::SOUND: return "";
case FileType::PALETTE: return tr("Export palette");
}
return "";
Expand Down
6 changes: 1 addition & 5 deletions app/src/importimageseqdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ void ImportImageSeqDialog::importArbitrarySequence()

for (const QString& strImgFile : files)
{
QString strImgFileLower = strImgFile.toLower();

Status st = mEditor->importImage(strImgFile);
if (!st.ok())
{
Expand Down Expand Up @@ -225,7 +223,6 @@ const PredefinedKeySetParams ImportImageSeqDialog::predefinedKeySetParams() cons
// local vars for testing file validity
int dot = strFilePath.lastIndexOf(".");
int slash = strFilePath.lastIndexOf("/");
QString fName = strFilePath.mid(slash + 1);
QString path = strFilePath.left(slash + 1);
QString digit = strFilePath.mid(slash + 1, dot - slash - 1);

Expand Down Expand Up @@ -275,7 +272,7 @@ const PredefinedKeySetParams ImportImageSeqDialog::predefinedKeySetParams() cons
dot = finalList[0].lastIndexOf(".");

QStringList absolutePaths;
for (QString fileName : finalList) {
for (const QString& fileName : finalList) {
absolutePaths << path + fileName;
}

Expand Down Expand Up @@ -338,7 +335,6 @@ QStringList ImportImageSeqDialog::getFilePaths()

Status ImportImageSeqDialog::validateKeySet(const PredefinedKeySet& keySet, const QStringList& filepaths)
{
QString msg = "";
QString failedPathsString;

Status status = Status::OK;
Expand Down
27 changes: 24 additions & 3 deletions app/src/mainwindow2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ GNU General Public License for more details.
#include "pegbaralignmentdialog.h"
#include "repositionframesdialog.h"

//#include "preview.h"
#include "errordialog.h"
#include "filedialog.h"
#include "importimageseqdialog.h"
Expand Down Expand Up @@ -1166,21 +1165,27 @@ void MainWindow2::setupKeyboardShortcuts()
return keySequence;
};

// File menu
ui->actionNew->setShortcut(cmdKeySeq(CMD_NEW_FILE));
ui->actionOpen->setShortcut(cmdKeySeq(CMD_OPEN_FILE));
ui->actionSave->setShortcut(cmdKeySeq(CMD_SAVE_FILE));
ui->actionSave_as->setShortcut(cmdKeySeq(CMD_SAVE_AS));

ui->actionImport_Image->setShortcut(cmdKeySeq(CMD_IMPORT_IMAGE));
ui->actionImport_ImageSeq->setShortcut(cmdKeySeq(CMD_IMPORT_IMAGE_SEQ));
ui->actionImport_ImageSeqNum->setShortcut(cmdKeySeq(CMD_IMPORT_IMAGE_PREDEFINED_SET));
ui->actionImport_MovieVideo->setShortcut(cmdKeySeq(CMD_IMPORT_MOVIE_VIDEO));
ui->actionImport_AnimatedImage->setShortcut(cmdKeySeq(CMD_IMPORT_ANIMATED_IMAGE));
ui->actionImportLayers_from_pclx->setShortcut(cmdKeySeq(CMD_IMPORT_LAYERS));
ui->actionImport_Sound->setShortcut(cmdKeySeq(CMD_IMPORT_SOUND));
ui->actionImport_MovieAudio->setShortcut(cmdKeySeq(CMD_IMPORT_MOVIE_AUDIO));
ui->actionImport_Append_Palette->setShortcut(cmdKeySeq(CMD_IMPORT_PALETTE));
ui->actionImport_Sound->setShortcut(cmdKeySeq(CMD_IMPORT_SOUND));
ui->actionImport_Replace_Palette->setShortcut(cmdKeySeq(CMD_IMPORT_PALETTE_REPLACE));

ui->actionExport_Image->setShortcut(cmdKeySeq(CMD_EXPORT_IMAGE));
ui->actionExport_ImageSeq->setShortcut(cmdKeySeq(CMD_EXPORT_IMAGE_SEQ));
ui->actionExport_Movie->setShortcut(cmdKeySeq(CMD_EXPORT_MOVIE));
ui->actionExport_Animated_GIF->setShortcut(cmdKeySeq(CMD_EXPORT_GIF));
ui->actionExport_Palette->setShortcut(cmdKeySeq(CMD_EXPORT_PALETTE));

// edit menu
Expand All @@ -1196,10 +1201,12 @@ void MainWindow2::setupKeyboardShortcuts()
ui->actionFlip_Y->setShortcut(cmdKeySeq(CMD_SELECTION_FLIP_VERTICAL));
ui->actionSelect_All->setShortcut(cmdKeySeq(CMD_SELECT_ALL));
ui->actionDeselect_All->setShortcut(cmdKeySeq(CMD_DESELECT_ALL));
ui->actionPegbarAlignment->setShortcut(cmdKeySeq(CMD_PEGBAR_ALIGNMENT));
ui->actionPreference->setShortcut(cmdKeySeq(CMD_PREFERENCE));

// View menu
ui->actionResetWindows->setShortcut(cmdKeySeq(CMD_RESET_WINDOWS));
ui->actionLockWindows->setShortcut(cmdKeySeq(CMD_LOCK_WINDOWS));
ui->actionReset_View->setShortcut(cmdKeySeq(CMD_RESET_ZOOM_ROTATE));
ui->actionCenter_View->setShortcut(cmdKeySeq(CMD_CENTER_VIEW));
ui->actionZoom_In->setShortcut(cmdKeySeq(CMD_ZOOM_IN));
Expand All @@ -1216,14 +1223,22 @@ void MainWindow2::setupKeyboardShortcuts()
ui->actionReset_Rotation->setShortcut(cmdKeySeq(CMD_RESET_ROTATION));
ui->actionHorizontal_Flip->setShortcut(cmdKeySeq(CMD_FLIP_HORIZONTAL));
ui->actionVertical_Flip->setShortcut(cmdKeySeq(CMD_FLIP_VERTICAL));
ui->actionPreview->setShortcut(cmdKeySeq(CMD_PREVIEW));
ui->actionGrid->setShortcut(cmdKeySeq(CMD_GRID));
ui->actionCenter->setShortcut(cmdKeySeq(CMD_OVERLAY_CENTER));
ui->actionThirds->setShortcut(cmdKeySeq(CMD_OVERLAY_THIRDS));
ui->actionGoldenRatio->setShortcut(cmdKeySeq(CMD_OVERLAY_GOLDEN_RATIO));
ui->actionSafeAreas->setShortcut(cmdKeySeq(CMD_OVERLAY_SAFE_AREAS));
ui->actionOnePointPerspective->setShortcut(cmdKeySeq(CMD_OVERLAY_ONE_POINT_PERSPECTIVE));
ui->actionTwoPointPerspective->setShortcut(cmdKeySeq(CMD_OVERLAY_TWO_POINT_PERSPECTIVE));
ui->actionThreePointPerspective->setShortcut(cmdKeySeq(CMD_OVERLAY_THREE_POINT_PERSPECTIVE));
ui->actionOnionPrev->setShortcut(cmdKeySeq(CMD_ONIONSKIN_PREV));
ui->actionOnionNext->setShortcut(cmdKeySeq(CMD_ONIONSKIN_NEXT));
ui->actionStatusBar->setShortcut(cmdKeySeq(CMD_TOGGLE_STATUS_BAR));

// Animation menu
ui->actionPlay->setShortcut(cmdKeySeq(CMD_PLAY));
ui->actionLoop->setShortcut(cmdKeySeq(CMD_LOOP));
ui->actionLoopControl->setShortcut(cmdKeySeq(CMD_LOOP_CONTROL));
ui->actionPrevious_Frame->setShortcut(cmdKeySeq(CMD_GOTO_PREV_FRAME));
ui->actionNext_Frame->setShortcut(cmdKeySeq(CMD_GOTO_NEXT_FRAME));
ui->actionPrev_KeyFrame->setShortcut(cmdKeySeq(CMD_GOTO_PREV_KEY_FRAME));
Expand All @@ -1239,6 +1254,7 @@ void MainWindow2::setupKeyboardShortcuts()
ui->actionMove_Frame_Forward->setShortcut(cmdKeySeq(CMD_MOVE_FRAME_FORWARD));
ui->actionFlip_inbetween->setShortcut(cmdKeySeq(CMD_FLIP_INBETWEEN));
ui->actionFlip_rolling->setShortcut(cmdKeySeq(CMD_FLIP_ROLLING));
ui->actionReposition_Selected_Frames->setShortcut(cmdKeySeq(CMD_SELECTION_REPOSITION_FRAMES));

ShortcutFilter* shortcutFilter = new ShortcutFilter(ui->scribbleArea, this);
ui->actionMove->setShortcut(cmdKeySeq(CMD_TOOL_MOVE));
Expand All @@ -1252,6 +1268,7 @@ void MainWindow2::setupKeyboardShortcuts()
ui->actionBucket->setShortcut(cmdKeySeq(CMD_TOOL_BUCKET));
ui->actionEyedropper->setShortcut(cmdKeySeq(CMD_TOOL_EYEDROPPER));
ui->actionEraser->setShortcut(cmdKeySeq(CMD_TOOL_ERASER));
ui->actionResetToolsDefault->setShortcut(cmdKeySeq(CMD_RESET_ALL_TOOLS));

ui->actionMove->installEventFilter(shortcutFilter);
ui->actionMove->installEventFilter(shortcutFilter);
Expand All @@ -1266,11 +1283,15 @@ void MainWindow2::setupKeyboardShortcuts()
ui->actionEyedropper->installEventFilter(shortcutFilter);
ui->actionEraser->installEventFilter(shortcutFilter);

// Layer menu
ui->actionNew_Bitmap_Layer->setShortcut(cmdKeySeq(CMD_NEW_BITMAP_LAYER));
ui->actionNew_Vector_Layer->setShortcut(cmdKeySeq(CMD_NEW_VECTOR_LAYER));
ui->actionNew_Camera_Layer->setShortcut(cmdKeySeq(CMD_NEW_CAMERA_LAYER));
ui->actionNew_Sound_Layer->setShortcut(cmdKeySeq(CMD_NEW_SOUND_LAYER));
ui->actionDelete_Current_Layer->setShortcut(cmdKeySeq(CMD_DELETE_CUR_LAYER));
ui->actionChangeLineColorCurrent_keyframe->setShortcut(cmdKeySeq(CMD_CHANGE_LINE_COLOR_KEYFRAME));
ui->actionChangeLineColorAll_keyframes_on_layer->setShortcut(cmdKeySeq(CMD_CHANGE_LINE_COLOR_LAYER));
ui->actionChangeLayerOpacity->setShortcut(cmdKeySeq(CMD_CHANGE_LAYER_OPACITY));

ui->actionVisibilityCurrentLayerOnly->setShortcut(cmdKeySeq(CMD_CURRENT_LAYER_VISIBILITY));
ui->actionVisibilityRelative->setShortcut(cmdKeySeq(CMD_RELATIVE_LAYER_VISIBILITY));
Expand Down
46 changes: 0 additions & 46 deletions app/src/preview.cpp

This file was deleted.

54 changes: 0 additions & 54 deletions app/src/preview.h

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/repositionframesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void RepositionFramesDialog::updateLayersBox()

void RepositionFramesDialog::closeClicked()
{
rejected();
emit rejected();
}

void RepositionFramesDialog::updateLayersToSelect()
Expand Down
Loading

0 comments on commit 08dcbb7

Please sign in to comment.