diff --git a/app/app.pro b/app/app.pro index 327028e6d8..5cbdafe321 100644 --- a/app/app.pro +++ b/app/app.pro @@ -73,7 +73,8 @@ HEADERS += \ src/doubleprogressdialog.h \ src/colorslider.h \ src/checkupdatesdialog.h \ - src/presetdialog.h + src/presetdialog.h \ + src/statusbar.h SOURCES += \ src/importlayersdialog.cpp \ @@ -109,7 +110,8 @@ SOURCES += \ src/colorslider.cpp \ src/checkupdatesdialog.cpp \ src/presetdialog.cpp \ - src/app_util.cpp + src/app_util.cpp \ + src/statusbar.cpp FORMS += \ ui/importimageseqpreview.ui \ diff --git a/app/src/mainwindow2.cpp b/app/src/mainwindow2.cpp index 6f48d8af9c..a5795ae0df 100644 --- a/app/src/mainwindow2.cpp +++ b/app/src/mainwindow2.cpp @@ -19,9 +19,6 @@ GNU General Public License for more details. #include "mainwindow2.h" #include "ui_mainwindow2.h" -// standard headers -#include - // Qt headers #include #include @@ -31,11 +28,6 @@ GNU General Public License for more details. #include #include #include -#include -#include -#include -#include -#include // core_lib headers #include "pencildef.h" @@ -117,12 +109,15 @@ MainWindow2::MainWindow2(QWidget* parent) : mEditor->setScribbleArea(ui->scribbleArea); makeConnections(mEditor, ui->scribbleArea); + ui->statusBar->setEditor(mEditor); + ui->statusBar->updateLayerStatus(); + ui->statusBar->updateZoomStatus(); + mCommands = new ActionCommands(this); mCommands->setCore(mEditor); createDockWidgets(); createMenus(); - createStatusBar(); setupKeyboardShortcuts(); readSettings(); @@ -227,6 +222,7 @@ void MainWindow2::createDockWidgets() makeConnections(mEditor, mColorInspector); makeConnections(mEditor, mColorPalette); makeConnections(mEditor, mToolOptions); + makeConnections(mEditor, ui->statusBar); for (BaseDockWidget* w : mDockWidgets) { @@ -424,55 +420,6 @@ void MainWindow2::createMenus() connect(ui->menuEdit, &QMenu::aboutToHide, this, &MainWindow2::undoActSetEnabled); } -void MainWindow2::createStatusBar() { - mToolIcon = new QLabel(this); - ui->statusbar->addWidget(mToolIcon); - mToolLabel = new QLabel(this); - ui->statusbar->addWidget(mToolLabel); - connect(mEditor->tools(), &ToolManager::toolChanged, this, &MainWindow2::updateToolStatus); - connect(mEditor->tools()->getTool(POLYLINE), &BaseTool::isActiveChanged, this, &MainWindow2::updateToolStatus); - - mModifiedLabel = new QLabel("*", this); - mModifiedLabel->setToolTip(tr("The file has unsaved changes")); - ui->statusbar->addPermanentWidget(mModifiedLabel); - - mBitmapIcon = QIcon(":/icons/layer-bitmap.png"); - mVectorIcon = QIcon(":/icons/layer-vector.png"); - mSoundIcon = QIcon(":/icons/layer-sound.png"); - mCameraIcon = QIcon(":/icons/layer-camera.png"); - - mLayerBox = new QComboBox(this); - ui->statusbar->addPermanentWidget(mLayerBox); - updateLayerStatus(); - connect(mEditor->layers(), &LayerManager::layerCountChanged, this, QOverload<>::of(&MainWindow2::updateLayerStatus)); - connect(mEditor->layers(), &LayerManager::currentLayerChanged, this, QOverload::of(&MainWindow2::updateLayerStatus)); - connect(mLayerBox, QOverload::of(&QComboBox::currentIndexChanged), mEditor->layers(), QOverload::of(&LayerManager::setCurrentLayer)); - - mZoomBox = new QComboBox(this); - mZoomBox->setEditable(true); - mZoomBox->lineEdit()->setAlignment(Qt::AlignRight); - ui->statusbar->addPermanentWidget(mZoomBox); - connect(mZoomBox, QOverload::of(&QComboBox::activated), [this](const QString ¤tText) { - QString zoomString = currentText; - zoomString = zoomString.remove('%'); - mEditor->view()->scale(zoomString.toDouble() / 100); - }); - - mZoomSlider = new QSlider(Qt::Horizontal, this); - mZoomSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - mZoomSlider->setMinimum(-200); - mZoomSlider->setMaximum(200); - mZoomSlider->setTickPosition(QSlider::TicksBelow); - mZoomSlider->setTickInterval(200); - ui->statusbar->addPermanentWidget(mZoomSlider); - connect(mZoomSlider, &QSlider::valueChanged, [this](int value) { - mEditor->view()->scale(std::pow(10, value / 100.)); - }); - - connect(mEditor->view(), &ViewManager::viewChanged, this, &MainWindow2::updateZoomStatus); - updateZoomStatus(); -} - void MainWindow2::setOpacity(int opacity) { mEditor->preference()->set(SETTING::WINDOW_OPACITY, 100 - opacity); @@ -482,7 +429,7 @@ void MainWindow2::setOpacity(int opacity) void MainWindow2::updateSaveState() { setWindowModified(mEditor->currentBackup() != mBackupAtSave); - mModifiedLabel->setVisible(mEditor->currentBackup() != mBackupAtSave); + ui->statusBar->updateModifiedStatus(mEditor->currentBackup() != mBackupAtSave); } void MainWindow2::clearRecentFilesList() @@ -732,7 +679,7 @@ bool MainWindow2::openObject(QString strFilePath) setWindowTitle(object->filePath().prepend("[*]")); setWindowModified(false); - mModifiedLabel->hide(); + ui->statusBar->updateModifiedStatus(false); progress.setValue(progress.value() + 1); @@ -1544,6 +1491,19 @@ void MainWindow2::makeConnections(Editor* pEditor, ColorPaletteWidget* pColorPal connect(pColorManager, &ColorManager::colorNumberChanged, pColorPalette, &ColorPaletteWidget::selectColorNumber); } +void MainWindow2::makeConnections(Editor* editor, StatusBar *statusBar) +{ + connect(editor->tools(), &ToolManager::toolChanged, statusBar, &StatusBar::updateToolStatus); + connect(editor->tools()->getTool(POLYLINE), &BaseTool::isActiveChanged, statusBar, &StatusBar::updateToolStatus); + + connect(editor->layers(), &LayerManager::layerCountChanged, statusBar, QOverload<>::of(&StatusBar::updateLayerStatus)); + connect(editor->layers(), &LayerManager::currentLayerChanged, statusBar, QOverload::of(&StatusBar::updateLayerStatus)); + connect(statusBar, &StatusBar::layerIndexChanged, editor->layers(), QOverload::of(&LayerManager::setCurrentLayer)); + + connect(editor->view(), &ViewManager::viewChanged, statusBar, &StatusBar::updateZoomStatus); + connect(statusBar, &StatusBar::zoomChanged, editor->view(), &ViewManager::scale); +} + void MainWindow2::bindActionWithSetting(QAction* action, const SETTING& setting) { PreferenceManager* prefs = mEditor->preference(); @@ -1566,117 +1526,6 @@ void MainWindow2::bindActionWithSetting(QAction* action, const SETTING& setting) }); } -void MainWindow2::updateToolStatus(ToolType tool) -{ - switch (tool) { - case PENCIL: - mToolIcon->setPixmap(QPixmap(":icons/new/svg/pencil_detailed.svg")); - mToolLabel->setText(tr("Click to draw. Hold Ctrl and Shift to erase or Alt to select a color from the canvas.")); - break; - case ERASER: - mToolIcon->setPixmap(QPixmap(":icons/new/svg/eraser_detailed.svg")); - mToolLabel->setText(tr("Click to erase.")); - break; - case SELECT: - mToolIcon->setPixmap(QPixmap(":icons/new/svg/selection.svg")); - mToolLabel->setText(tr("Click and drag to create or modify a selection. Hold Alt to modify its contents.")); - break; - case MOVE: - mToolIcon->setPixmap(QPixmap(":icons/new/svg/arrow.svg")); - if (ui->scribbleArea->isTemporaryTool()) { - mToolLabel->setText(tr("Click and drag to move an object.")); - } else { - mToolLabel->setText(tr("Click and drag to move an object. Hold Ctrl to rotate.")); - } - break; - case HAND: - mToolIcon->setPixmap(QPixmap(":icons/new/svg/hand_detailed.svg")); - mToolLabel->setText(tr("Click and drag to pan. Hold Ctrl to zoom or Alt to rotate.")); - break; - case SMUDGE: - mToolIcon->setPixmap(QPixmap(":icons/new/svg/smudge_detailed.svg")); - mToolLabel->setText(tr("Click to liquefy pixels or modify a vector line. Hold Alt to smooth.")); - break; - case PEN: - mToolIcon->setPixmap(QPixmap(":icons/new/svg/pen_detailed.svg")); - mToolLabel->setText(tr("Click to draw. Hold Ctrl and Shift to erase or Alt to select a color from the canvas.")); - break; - case POLYLINE: - mToolIcon->setPixmap(QPixmap(":icons/new/svg/line.svg")); - if (mEditor->tools()->getTool(tool)->isActive()) { - mToolLabel->setText(tr("Click to continue the polyline. Double-click or press enter to complete the line or press Escape to discard it.")); - } else { - mToolLabel->setText(tr("Click to create a new polyline. Hold Ctrl and Shift to erase or Alt to select a color from the canvas.")); - } - break; - case BUCKET: - mToolIcon->setPixmap(QPixmap(":icons/new/svg/bucket_detailed.svg")); - mToolLabel->setText(tr("Click to fill an area with the current color. Hold Alt to select a color from the canvas.")); - break; - case EYEDROPPER: - mToolIcon->setPixmap(QPixmap(":icons/new/svg/eyedropper_detailed.svg")); - mToolLabel->setText(tr("Click to select a color from the canvas.")); - break; - case BRUSH: - mToolIcon->setPixmap(QPixmap(":icons/new/svg/brush_detailed.svg")); - mToolLabel->setText(tr("Click to paint. Hold Ctrl and Shift to erase or Alt to select a color from the canvas.")); - break; - default: - Q_ASSERT(false); - } - mToolIcon->setToolTip(BaseTool::TypeName(tool)); -} - -void MainWindow2::updateLayerStatus() -{ - QSignalBlocker b(mLayerBox); - mLayerBox->clear(); - for (int i = 0; i < mEditor->layers()->count(); i++) - { - Layer *layer = mEditor->layers()->getLayer(i); - mLayerBox->addItem(layer->name()); - switch (layer->type()) - { - case Layer::BITMAP: - mLayerBox->setItemIcon(i, mBitmapIcon); - break; - case Layer::VECTOR: - mLayerBox->setItemIcon(i, mVectorIcon); - break; - case Layer::SOUND: - mLayerBox->setItemIcon(i, mSoundIcon); - break; - case Layer::CAMERA: - mLayerBox->setItemIcon(i, mCameraIcon); - break; - case Layer::MOVIE: - case Layer::UNDEFINED: - // no icon - break; - } - } - mLayerBox->setCurrentIndex(mEditor->layers()->currentLayerIndex()); -} - -void MainWindow2::updateLayerStatus(int layer) -{ - mLayerBox->setItemText(layer, mEditor->layers()->getLayer(layer)->name()); - mLayerBox->setCurrentIndex(layer); -} - -void MainWindow2::updateZoomStatus() -{ - double zoom = mEditor->view()->scaling() * 100; - QSignalBlocker b1(mZoomBox); - mZoomBox->clear(); - // Keep the dropdown list limited to our predefined entries - // insertPolicy can't handle that without preventing custom values outright - mZoomBox->addItems(QStringList() << "10000.0%" << "6400.0%" << "1600.0%" << "800.0%" << "400.0%" << "200.0%" << "100.0%" << "75.0%" << "50.0%" << "33.0%" << "25.0%" << "12.0%" << "1.0%"); - mZoomBox->setCurrentText(QString("%0%").arg(zoom, 0, 'f', 1)); - QSignalBlocker b2(mZoomSlider); - mZoomSlider->setValue(static_cast(std::round(std::log10(mEditor->view()->scaling()) * 100))); -} - void MainWindow2::changePlayState(bool isPlaying) { if (isPlaying) diff --git a/app/src/mainwindow2.h b/app/src/mainwindow2.h index 652e7d549c..1ec9c35e6e 100644 --- a/app/src/mainwindow2.h +++ b/app/src/mainwindow2.h @@ -19,13 +19,9 @@ GNU General Public License for more details. #define MAINWINDOW2_H #include -#include "pencildef.h" template class QList; class QActionGroup; -class QComboBox; -class QLabel; -class QSlider; class Object; class Editor; class ScribbleArea; @@ -46,6 +42,7 @@ class ActionCommands; class ImportImageSeqDialog; class BackupElement; class PegBarAlignmentDialog; +class StatusBar; enum class SETTING; @@ -127,13 +124,8 @@ private slots: void createDockWidgets(); void createMenus(); - void createStatusBar(); void setupKeyboardShortcuts(); void clearKeyboardShortcuts(); - void updateToolStatus(ToolType tool); - void updateLayerStatus(); - void updateLayerStatus(int layer); - void updateZoomStatus(); bool loadMostRecent(); bool tryLoadPreset(); @@ -155,19 +147,13 @@ private slots: void makeConnections(Editor*, DisplayOptionWidget*); void makeConnections(Editor*, ToolOptionWidget*); void makeConnections(Editor*, OnionSkinWidget*); + void makeConnections(Editor*, StatusBar*); void bindActionWithSetting(QAction*, const SETTING&); bool tryRecoverUnsavedProject(); void startProjectRecovery(int result); - QLabel* mToolIcon = nullptr; - QLabel* mToolLabel = nullptr; - QLabel* mModifiedLabel = nullptr; - QComboBox* mLayerBox = nullptr; - QComboBox* mZoomBox = nullptr; - QSlider* mZoomSlider = nullptr; - // UI: Dock widgets ColorBox* mColorBox = nullptr; ColorPaletteWidget* mColorPalette = nullptr; @@ -194,11 +180,6 @@ private slots: QIcon mStartIcon; QIcon mStopIcon; - QIcon mBitmapIcon; - QIcon mVectorIcon; - QIcon mSoundIcon; - QIcon mCameraIcon; - // a hack for MacOS because closeEvent fires twice bool m2ndCloseEvent = false; diff --git a/app/src/statusbar.cpp b/app/src/statusbar.cpp new file mode 100644 index 0000000000..7f388816e7 --- /dev/null +++ b/app/src/statusbar.cpp @@ -0,0 +1,211 @@ +/* + +Pencil - Traditional Animation Software +Copyright (C) 2020 Jakob Gahde + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +*/ + +#include +#include +#include +#include + +#include "editor.h" +#include "layermanager.h" +#include "scribblearea.h" +#include "toolmanager.h" +#include "viewmanager.h" + +#include "statusbar.h" + +StatusBar::StatusBar(QWidget *parent) : QStatusBar(parent) +{ + setContentsMargins(3, 0, 3, 0); + + mToolIcon = new QLabel(this); + addWidget(mToolIcon); + mToolLabel = new QLabel(this); + addWidget(mToolLabel); + + mModifiedLabel = new QLabel(this); + updateModifiedStatus(false); + addPermanentWidget(mModifiedLabel); + + mLayerBox = new QComboBox(this); + connect(mLayerBox, QOverload::of(&QComboBox::currentIndexChanged), this, &StatusBar::layerIndexChanged); + addPermanentWidget(mLayerBox); + + mZoomBox = new QComboBox(this); + mZoomBox->addItems(QStringList() + << "10000.0%" << "6400.0%" << "1600.0%" << "800.0%" << "400.0%" << "200.0%" + << "100.0%" << "75.0%" << "50.0%" << "33.0%" << "25.0%" << "12.0%" << "1.0%"); + mZoomBox->setMaxCount(mZoomBox->count() + 1); + mZoomBox->setEditable(true); + mZoomBox->lineEdit()->setAlignment(Qt::AlignRight); + connect(mZoomBox, QOverload::of(&QComboBox::activated), [this](const QString ¤tText) + { + if (mZoomBox->count() == mZoomBox->maxCount()) + { + // Keep the size of the list reasonable by preventing user entries + mZoomBox->removeItem(mZoomBox->maxCount() - 1); + } + emit zoomChanged(QString(currentText).remove('%').toDouble() / 100); + }); + addPermanentWidget(mZoomBox); + + mZoomSlider = new QSlider(Qt::Horizontal, this); + mZoomSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + mZoomSlider->setRange(-20, 20); + mZoomSlider->setTickPosition(QSlider::TicksBelow); + mZoomSlider->setTickInterval(20); + connect(mZoomSlider, &QSlider::valueChanged, [this](int value) + { + emit zoomChanged(std::pow(10, value / 10.)); + }); + addPermanentWidget(mZoomSlider); +} + +void StatusBar::updateToolStatus(ToolType tool) +{ + Q_ASSERT(mEditor); + switch (tool) { + case PENCIL: + mToolLabel->setText(tr("Click to draw. Hold Ctrl and Shift to erase or Alt to select a color from the canvas.")); + break; + case ERASER: + mToolLabel->setText(tr("Click to erase.")); + break; + case SELECT: + mToolLabel->setText(tr("Click and drag to create or modify a selection. Hold Alt to modify its contents.")); + break; + case MOVE: + if (mEditor->getScribbleArea()->isTemporaryTool()) { + mToolLabel->setText(tr("Click and drag to move an object.")); + } else { + mToolLabel->setText(tr("Click and drag to move an object. Hold Ctrl to rotate.")); + } + break; + case HAND: + mToolLabel->setText(tr("Click and drag to pan. Hold Ctrl to zoom or Alt to rotate.")); + break; + case SMUDGE: + mToolLabel->setText(tr("Click to liquefy pixels or modify a vector line. Hold Alt to smooth.")); + break; + case PEN: + mToolLabel->setText(tr("Click to draw. Hold Ctrl and Shift to erase or Alt to select a color from the canvas.")); + break; + case POLYLINE: + if (mEditor->tools()->getTool(tool)->isActive()) { + mToolLabel->setText(tr("Click to continue the polyline. Double-click or press enter to complete the line or press Escape to discard it.")); + } else { + mToolLabel->setText(tr("Click to create a new polyline. Hold Ctrl and Shift to erase.")); + } + break; + case BUCKET: + mToolLabel->setText(tr("Click to fill an area with the current color. Hold Alt to select a color from the canvas.")); + break; + case EYEDROPPER: + mToolLabel->setText(tr("Click to select a color from the canvas.")); + break; + case BRUSH: + mToolLabel->setText(tr("Click to paint. Hold Ctrl and Shift to erase or Alt to select a color from the canvas.")); + break; + default: + Q_ASSERT(false); + } + + static QPixmap toolIcons[TOOL_TYPE_COUNT]{ + {":icons/new/svg/pencil_detailed.svg"}, + {":icons/new/svg/eraser_detailed.svg"}, + {":icons/new/svg/selection.svg"}, + {":icons/new/svg/arrow.svg"}, + {":icons/new/svg/hand_detailed.svg"}, + {":icons/new/svg/smudge_detailed.svg"}, + {":icons/new/svg/pen_detailed.svg"}, + {":icons/new/svg/line.svg"}, + {":icons/new/svg/bucket_detailed.svg"}, + {":icons/new/svg/eyedropper_detailed.svg"}, + {":icons/new/svg/brush_detailed.svg"} + }; + mToolIcon->setPixmap(toolIcons[tool]); + mToolIcon->setToolTip(BaseTool::TypeName(tool)); +} + +void StatusBar::updateModifiedStatus(bool modified) +{ + static QPixmap modifiedIcon(":/icons/saveas.png"), + unmodifiedIcon(":/icons/save.png"); + + if (modified) + { + mModifiedLabel->setPixmap(modifiedIcon); + mModifiedLabel->setToolTip(tr("The file has unsaved changes")); + return; + } + mModifiedLabel->setPixmap(unmodifiedIcon); + mModifiedLabel->setToolTip(tr("The file has no unsaved changes")); +} + +void StatusBar::updateLayerStatus() +{ + Q_ASSERT(mEditor); + static QIcon bitmapIcon(":/icons/layer-bitmap.png"), + vectorIcon(":/icons/layer-vector.png"), + soundIcon(":/icons/layer-sound.png"), + cameraIcon(":/icons/layer-camera.png"); + + QSignalBlocker b(mLayerBox); + mLayerBox->clear(); + for (int i = 0; i < mEditor->layers()->count(); i++) + { + Layer *layer = mEditor->layers()->getLayer(i); + mLayerBox->addItem(layer->name()); + switch (layer->type()) + { + case Layer::BITMAP: + mLayerBox->setItemIcon(i, bitmapIcon); + break; + case Layer::VECTOR: + mLayerBox->setItemIcon(i, vectorIcon); + break; + case Layer::SOUND: + mLayerBox->setItemIcon(i, soundIcon); + break; + case Layer::CAMERA: + mLayerBox->setItemIcon(i, cameraIcon); + break; + case Layer::MOVIE: + case Layer::UNDEFINED: + // no icon + break; + } + } + mLayerBox->setCurrentIndex(mEditor->layers()->currentLayerIndex()); +} + +void StatusBar::updateLayerStatus(int layer) +{ + Q_ASSERT(mEditor); + mLayerBox->setItemText(layer, mEditor->layers()->getLayer(layer)->name()); + mLayerBox->setCurrentIndex(layer); +} + +void StatusBar::updateZoomStatus() +{ + Q_ASSERT(mEditor); + + QSignalBlocker b1(mZoomBox); + mZoomBox->setCurrentText(QString("%0%").arg(mEditor->view()->scaling() * 100, 0, 'f', 1)); + + QSignalBlocker b2(mZoomSlider); + mZoomSlider->setValue(static_cast(std::round(std::log10(mEditor->view()->scaling()) * 10))); +} diff --git a/app/src/statusbar.h b/app/src/statusbar.h new file mode 100644 index 0000000000..fdf038f217 --- /dev/null +++ b/app/src/statusbar.h @@ -0,0 +1,124 @@ +/* + +Pencil - Traditional Animation Software +Copyright (C) 2020 Jakob Gahde + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +*/ + +#ifndef STATUSBAR_H +#define STATUSBAR_H + +#include + +#include "pencildef.h" + +class Editor; +class QComboBox; +class QLabel; +class QSlider; + +/** + * The status bar of Pencil2D's main window. + */ +class StatusBar : public QStatusBar +{ + Q_OBJECT + +public: + /** + * Constructs a new status bar. For the status bar to work properly, you must also use setEditor() to pass an Editor instance to it. + * + * @param parent The parent object of the status bar + */ + explicit StatusBar(QWidget *parent); + + /** + * Associates an Editor instance with the status bar. + * + * This is necessary for most functionality to work. + * + * @param editor + */ + void setEditor(Editor *editor) { mEditor = editor; } + +public slots: + /** + * Updates the status bar with information about the current tool. + * + * @param tool The currently active tool + */ + void updateToolStatus(ToolType tool); + + /** + * Updates the file modification status. + * + * @param modified Whether the current file contains unsaved modifications + */ + void updateModifiedStatus(bool modified); + + /** + * Completely rebuilds the layer status for all layers. + * + * This is necessary when layers are added, removed or reordered. + * + * @see updateLayerStatus(int) + */ + void updateLayerStatus(); + + /** + * Updates the current layer. + * + * @param layer The index of the currently active layer + * + * @see updateLayerStatus() + */ + void updateLayerStatus(int layer); + + /** + * Updates the zoom level displayed in the status bar. + */ + void updateZoomStatus(); + +signals: + /** + * This signal is sent when the user selects a new active layer through the status bar. + * + * @param index The index of the newly selected layer + */ + void layerIndexChanged(int index); + + /** + * This signal is sent when the user chooses a new zoom level through the status bar. + * + * @param scale The new zoom level selected by the user, represented as a scale factor + */ + void zoomChanged(double scale); + +private: + /** The editor associated with this status bar */ + Editor *mEditor = nullptr; + + /** Label used to display the icon of the current tool */ + QLabel *mToolIcon = nullptr; + /** Label used to display a short help text for the current tool */ + QLabel *mToolLabel = nullptr; + /** Label indicating that the current file contains unsaved changes */ + QLabel *mModifiedLabel = nullptr; + /** Combo box for the active layer */ + QComboBox *mLayerBox = nullptr; + /** Combo box for choosing pre-defined or custom zoom levels */ + QComboBox *mZoomBox = nullptr; + /** Slider for adjusting the zoom level */ + QSlider *mZoomSlider = nullptr; +}; + +#endif // STATUSBAR_H diff --git a/app/ui/mainwindow2.ui b/app/ui/mainwindow2.ui index 3e312785d2..5cb68727b5 100644 --- a/app/ui/mainwindow2.ui +++ b/app/ui/mainwindow2.ui @@ -42,8 +42,8 @@ - - + + 0 @@ -1103,6 +1103,11 @@
scribblearea.h
1 + + StatusBar + QStatusBar +
statusbar.h
+
diff --git a/core_lib/src/tool/polylinetool.cpp b/core_lib/src/tool/polylinetool.cpp index 72a14c6b0a..a89f12128d 100644 --- a/core_lib/src/tool/polylinetool.cpp +++ b/core_lib/src/tool/polylinetool.cpp @@ -24,7 +24,6 @@ GNU General Public License for more details. #include "strokemanager.h" #include "layermanager.h" #include "colormanager.h" -#include "toolmanager.h" #include "viewmanager.h" #include "pointerevent.h" #include "layervector.h"