Skip to content

Commit

Permalink
Sort and expand dock toggle action titles
Browse files Browse the repository at this point in the history
The names are kind of shortened to fit onto the tabs well, so now
there's a separate "full title" with a proper name, e.g. "Wheel" vs.
"Color Wheel". The toggles menu is also now sorted.

Also moves all of the dock titles into the docks themselves, before some
of them were passed via the main window and the translation was bungling
around in there with little context.
  • Loading branch information
askmeaboutlo0m committed Nov 8, 2024
1 parent 2c9747b commit 8c5ad8b
Show file tree
Hide file tree
Showing 18 changed files with 256 additions and 101 deletions.
4 changes: 1 addition & 3 deletions src/desktop/docks/brushpalettedock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ struct BrushPalette::Private {
};

BrushPalette::BrushPalette(QWidget *parent)
: DockBase(parent)
: DockBase(tr("Brushes"), QString(), parent)
, d(new Private)
{
d->tagModel = dpApp().brushPresets();
Expand All @@ -108,8 +108,6 @@ BrushPalette::BrushPalette(QWidget *parent)
d->presetProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
d->presetProxyModel->setFilterRole(brushes::BrushPresetModel::FilterRole);

setWindowTitle(tr("Brushes"));

TitleWidget *titleWidget = new TitleWidget(this);
setTitleBarWidget(titleWidget);

Expand Down
4 changes: 2 additions & 2 deletions src/desktop/docks/colorcircle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

namespace docks {

ColorCircleDock::ColorCircleDock(const QString &title, QWidget *parent)
: DockBase(title, parent)
ColorCircleDock::ColorCircleDock(QWidget *parent)
: DockBase(tr("Color Circle"), tr("Circle"), parent)
{
TitleWidget *titlebar = new TitleWidget(this);
setTitleBarWidget(titlebar);
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/docks/colorcircle.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace docks {
class ColorCircleDock final : public DockBase {
Q_OBJECT
public:
ColorCircleDock(const QString &title, QWidget *parent);
explicit ColorCircleDock(QWidget *parent);

void setColor(const QColor &color);
void setLastUsedColors(const color_widgets::ColorPalette &pal);
Expand Down
4 changes: 2 additions & 2 deletions src/desktop/docks/colorpalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ struct ColorPaletteDock::Private {
}
};

ColorPaletteDock::ColorPaletteDock(const QString &title, QWidget *parent)
: DockBase(title, parent)
ColorPaletteDock::ColorPaletteDock(QWidget *parent)
: DockBase(tr("Color Palette"), tr("Palette"), parent)
, d(new Private)
{
TitleWidget *titlebar = new TitleWidget(this);
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/docks/colorpalette.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace docks {
class ColorPaletteDock final : public DockBase {
Q_OBJECT
public:
ColorPaletteDock(const QString &title, QWidget *parent);
explicit ColorPaletteDock(QWidget *parent);
~ColorPaletteDock() override;

public slots:
Expand Down
4 changes: 2 additions & 2 deletions src/desktop/docks/colorsliders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ struct ColorSliderDock::Private {
bool updating = false;
};

ColorSliderDock::ColorSliderDock(const QString &title, QWidget *parent)
: DockBase(title, parent)
ColorSliderDock::ColorSliderDock(QWidget *parent)
: DockBase(tr("Color Sliders"), tr("Sliders"), parent)
, d(new Private)
{
// Create title bar widget
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/docks/colorsliders.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace docks {
class ColorSliderDock final : public DockBase {
Q_OBJECT
public:
ColorSliderDock(const QString &title, QWidget *parent);
explicit ColorSliderDock(QWidget *parent);
~ColorSliderDock() override;

public slots:
Expand Down
4 changes: 2 additions & 2 deletions src/desktop/docks/colorspinner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ struct ColorSpinnerDock::Private {
bool updating = false;
};

ColorSpinnerDock::ColorSpinnerDock(const QString &title, QWidget *parent)
: DockBase(title, parent)
ColorSpinnerDock::ColorSpinnerDock(QWidget *parent)
: DockBase(tr("Color Wheel"), tr("Wheel"), parent)
, d(new Private)
{
// Create title bar widget
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/docks/colorspinner.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace docks {
class ColorSpinnerDock final : public DockBase {
Q_OBJECT
public:
ColorSpinnerDock(const QString &title, QWidget *parent);
explicit ColorSpinnerDock(QWidget *parent);
~ColorSpinnerDock() override;

#ifdef DP_COLOR_SPINNER_ENABLE_PREVIEW
Expand Down
14 changes: 4 additions & 10 deletions src/desktop/docks/dockbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,10 @@

namespace docks {

DockBase::DockBase(QWidget *parent)
: QDockWidget{parent}
{
#ifdef Q_OS_MACOS
initConnection();
#endif
}

DockBase::DockBase(QString title, QWidget *parent)
: QDockWidget{title, parent}
DockBase::DockBase(
const QString &fullTitle, const QString &shortTitle, QWidget *parent)
: QDockWidget(shortTitle.isEmpty() ? fullTitle : shortTitle, parent)
, m_fullTitle(fullTitle)
{
#ifdef Q_OS_MACOS
initConnection();
Expand Down
11 changes: 9 additions & 2 deletions src/desktop/docks/dockbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,23 @@ namespace docks {
class DockBase : public QDockWidget {
Q_OBJECT
public:
explicit DockBase(QWidget *parent = nullptr);
explicit DockBase(const QString title, QWidget *parent = nullptr);
explicit DockBase(
const QString &fullTitle, const QString &shortTitle,
QWidget *parent = nullptr);

const QString &fullTitle() const { return m_fullTitle; }

#ifdef Q_OS_MACOS
private slots:
void addWindowDecorations(bool topLevel);
#endif

private:
#ifdef Q_OS_MACOS
void initConnection();
#endif

QString m_fullTitle;
};

}
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/docks/layerlistdock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
namespace docks {

LayerList::LayerList(QWidget *parent)
: DockBase(tr("Layers"), parent)
: DockBase(tr("Layers"), QString(), parent)
, m_canvas(nullptr)
, m_selectedId(0)
, m_nearestToDeletedId(0)
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/docks/navigator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ QPointF NavigatorView::getFocusPoint(const QPointF &eventPoint)
* Construct the navigator dock widget.
*/
Navigator::Navigator(QWidget *parent)
: DockBase(tr("Navigator"), parent), m_updating(false)
: DockBase(tr("Navigator"), QString(), parent), m_updating(false)
{
setObjectName("navigatordock");

Expand Down
4 changes: 2 additions & 2 deletions src/desktop/docks/onionskins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ struct OnionSkinsDock::Private {
QVector<QSlider *> skinsBelowSliders = {};
};

OnionSkinsDock::OnionSkinsDock(const QString &title, QWidget *parent)
: DockBase{title, parent}
OnionSkinsDock::OnionSkinsDock(QWidget *parent)
: DockBase(tr("Onion Skins"), QString(), parent)
, d{new Private}
{
TitleWidget *titlebar = new TitleWidget{this};
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/docks/onionskins.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace docks {
class OnionSkinsDock final : public DockBase {
Q_OBJECT
public:
OnionSkinsDock(const QString &title, QWidget *parent);
explicit OnionSkinsDock(QWidget *parent);
~OnionSkinsDock() override;

void triggerUpdate();
Expand Down
2 changes: 1 addition & 1 deletion src/desktop/docks/timeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace docks {

Timeline::Timeline(QWidget *parent)
: DockBase{tr("Timeline"), parent}
: DockBase(tr("Timeline"), QString(), parent)
, m_widget{new widgets::TimelineWidget{this}}
, m_frameSpinner{nullptr}
, m_framerateSpinner{nullptr}
Expand Down
4 changes: 1 addition & 3 deletions src/desktop/docks/toolsettingsdock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,9 @@ struct ToolSettings::Private {
};

ToolSettings::ToolSettings(tools::ToolController *ctrl, QWidget *parent)
: DockBase(parent)
: DockBase(tr("Tool Settings"), tr("Tool"), parent)
, d(new Private(ctrl))
{
setWindowTitle(tr("Tool"));

auto titleWidget = new TitleWidget(this);
setTitleBarWidget(titleWidget);

Expand Down
Loading

0 comments on commit 8c5ad8b

Please sign in to comment.