Skip to content

Commit

Permalink
Traktor: Fixed some deprecation warnings in UI. Also new checkbox ima…
Browse files Browse the repository at this point in the history
…ges.
  • Loading branch information
apistol78 committed May 14, 2024
1 parent 291947c commit e0ca872
Show file tree
Hide file tree
Showing 87 changed files with 348 additions and 265 deletions.
2 changes: 1 addition & 1 deletion code/Editor/App/BrowseInstanceDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ void BrowseInstanceDialog::updatePreviewList()
ui::PreviewItem* item = previewItems->get(i);
if (!item->getImage())
{
m_previewTasks.put([=](){ taskGeneratePreview(item); });
m_previewTasks.put([=, this](){ taskGeneratePreview(item); });
m_previewTaskEvent.pulse();
}
}
Expand Down
2 changes: 1 addition & 1 deletion code/Editor/App/EditorForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1877,7 +1877,7 @@ void EditorForm::buildAssets(const AlignedVector< Guid >& assetGuids, bool rebui
buildWaitUntilFinished();

// Create build thread.
m_threadBuild = ThreadManager::getInstance().create([=](){ buildAssetsThread(assetGuids, rebuild); }, L"Pipeline thread");
m_threadBuild = ThreadManager::getInstance().create([=, this](){ buildAssetsThread(assetGuids, rebuild); }, L"Pipeline thread");
if (m_threadBuild)
{
m_threadBuild->start(Thread::Above);
Expand Down
2 changes: 1 addition & 1 deletion code/Editor/App/SearchToolDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ void SearchToolDialog::search(const std::wstring& needle)
bool caseSensitive = m_checkCaseSensitive->isChecked();

m_gridResults->removeAllRows();
m_jobSearch = JobManager::getInstance().add([=](){
m_jobSearch = JobManager::getInstance().add([=, this](){
jobSearch(needle, regExp, caseSensitive);
});

Expand Down
2 changes: 1 addition & 1 deletion code/Render/Editor/Shader/ShaderViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ void ShaderViewer::eventTimer(ui::TimerEvent* event)
return;

Ref< ShaderGraph > shaderGraph = m_pendingShaderGraph;
m_reflectJob = JobManager::getInstance().add([=](){
m_reflectJob = JobManager::getInstance().add([=, this](){
jobReflect(shaderGraph, compiler);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ bool PerspectiveRenderControl::create(ui::Widget* parent, SceneEditorContext* co
m_renderGraph = new render::RenderGraph(
m_context->getRenderSystem(),
m_multiSample,
[=](int32_t pass, int32_t level, const std::wstring& name, double start, double duration) {
[=, this](int32_t pass, int32_t level, const std::wstring& name, double start, double duration) {
m_context->raiseMeasurement(pass, level, name, start, duration);
}
);
Expand Down
2 changes: 1 addition & 1 deletion code/Ui/AspectLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class T_DLLCLASS AspectLayout : public Layout
T_RTTI_CLASS;

public:
AspectLayout(float ratio = -1.0f);
explicit AspectLayout(float ratio = -1.0f);

virtual bool fit(Widget* widget, const Size& bounds, Size& result) override;

Expand Down
2 changes: 1 addition & 1 deletion code/Ui/Auto/AutoWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace traktor::ui

T_IMPLEMENT_RTTI_CLASS(L"traktor.ui.AutoWidget", AutoWidget, Widget)

bool AutoWidget::create(ui::Widget* parent, int32_t style)
bool AutoWidget::create(ui::Widget* parent, uint32_t style)
{
if (!ui::Widget::create(parent, style))
return false;
Expand Down
2 changes: 1 addition & 1 deletion code/Ui/Auto/AutoWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class T_DLLCLASS AutoWidget : public Widget
T_RTTI_CLASS;

public:
bool create(ui::Widget* parent, int32_t style);
bool create(ui::Widget* parent, uint32_t style);

void setFocusCell(AutoWidgetCell* focusCell);

Expand Down
2 changes: 1 addition & 1 deletion code/Ui/Auto/ChildWidgetCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class T_DLLCLASS ChildWidgetCell : public AutoWidgetCell
T_RTTI_CLASS;

public:
ChildWidgetCell(Widget* child);
explicit ChildWidgetCell(Widget* child);

virtual ~ChildWidgetCell();

Expand Down
2 changes: 1 addition & 1 deletion code/Ui/BuildChart/BuildChartControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ BuildChartControl::BuildChartControl()
{
}

bool BuildChartControl::create(Widget* parent, uint32_t laneCount, int style)
bool BuildChartControl::create(Widget* parent, uint32_t laneCount, uint32_t style)
{
if (!Widget::create(parent, style))
return false;
Expand Down
12 changes: 3 additions & 9 deletions code/Ui/BuildChart/BuildChartControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,15 @@ class T_DLLCLASS BuildChartControl : public Widget
public:
struct Task
{
double time0;
double time1;
double time0 = -1.0;
double time1 = -1.0;
std::wstring text;
Color4ub color;

Task()
: time0(-1.0)
, time1(-1.0)
{
}
};

BuildChartControl();

bool create(Widget* parent, uint32_t laneCount, int style = WsDoubleBuffer);
bool create(Widget* parent, uint32_t laneCount, uint32_t style = WsDoubleBuffer);

void showRange(double fromTime, double toTime);

Expand Down
4 changes: 2 additions & 2 deletions code/Ui/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ namespace traktor::ui

T_IMPLEMENT_RTTI_CLASS(L"traktor.ui.Button", Button, Widget)

bool Button::create(Widget* parent, const std::wstring& text, int style)
bool Button::create(Widget* parent, const std::wstring& text, uint32_t style)
{
if (!Widget::create(parent))
if (!Widget::create(parent, style))
return false;

addEventHandler< MouseTrackEvent >(this, &Button::eventMouseTrack);
Expand Down
9 changes: 3 additions & 6 deletions code/Ui/Button.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,10 @@ class T_DLLCLASS Button : public Widget
T_RTTI_CLASS;

public:
enum StyleFlags
{
WsDefaultButton = WsUser,
WsToggle = (WsUser << 1)
};
constexpr static uint32_t WsDefaultButton = WsUser;
constexpr static uint32_t WsToggle = (WsUser << 1);

bool create(Widget* parent, const std::wstring& text, int style = WsNone);
bool create(Widget* parent, const std::wstring& text, uint32_t style = WsNone);

virtual Size getPreferredSize(const Size& hint) const override;

Expand Down
2 changes: 1 addition & 1 deletion code/Ui/CaptionBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Unit c_preferedHeightMargin = 8_ut;

T_IMPLEMENT_RTTI_CLASS(L"traktor.ui.CaptionBar", CaptionBar, Widget)

bool CaptionBar::create(Widget* parent, int style)
bool CaptionBar::create(Widget* parent, uint32_t style)
{
if (!Widget::create(parent, style))
return false;
Expand Down
2 changes: 1 addition & 1 deletion code/Ui/CaptionBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class T_DLLCLASS CaptionBar : public Widget
T_RTTI_CLASS;

public:
bool create(Widget* parent, int style = WsNone);
bool create(Widget* parent, uint32_t style = WsNone);

virtual Size getPreferredSize(const Size& hint) const override;

Expand Down
2 changes: 1 addition & 1 deletion code/Ui/ColorPicker/ColorControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Unit c_height = 24_ut;

T_IMPLEMENT_RTTI_CLASS(L"traktor.ui.ColorControl", ColorControl, Widget)

bool ColorControl::create(Widget* parent, int style)
bool ColorControl::create(Widget* parent, uint32_t style)
{
if (!Widget::create(parent, style))
return false;
Expand Down
2 changes: 1 addition & 1 deletion code/Ui/ColorPicker/ColorControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class T_DLLCLASS ColorControl : public Widget
T_RTTI_CLASS;

public:
bool create(Widget* parent, int style);
bool create(Widget* parent, uint32_t style);

void setColor(const Color4ub& color);

Expand Down
2 changes: 1 addition & 1 deletion code/Ui/ColorPicker/ColorDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct AlphaGradient : public ColorSliderControl::IGradient

T_IMPLEMENT_RTTI_CLASS(L"traktor.ui.ColorDialog", ColorDialog, ConfigDialog)

bool ColorDialog::create(Widget* parent, const std::wstring& text, int32_t style, const Color4f& initialColor)
bool ColorDialog::create(Widget* parent, const std::wstring& text, uint32_t style, const Color4f& initialColor)
{
if (!ConfigDialog::create(
parent,
Expand Down
9 changes: 3 additions & 6 deletions code/Ui/ColorPicker/ColorDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,10 @@ class T_DLLCLASS ColorDialog : public ConfigDialog
T_RTTI_CLASS;

public:
enum StyleFlags
{
WsAlpha = WsUser,
WsHDR = (WsUser << 1)
};
constexpr static uint32_t WsAlpha = WsUser;
constexpr static uint32_t WsHDR = (WsUser << 1);

bool create(Widget* parent, const std::wstring& text, int32_t style = WsDefaultFixed, const Color4f& initialColor = Color4f(1.0f, 1.0f, 1.0f, 1.0f));
bool create(Widget* parent, const std::wstring& text, uint32_t style = WsDefaultFixed, const Color4f& initialColor = Color4f(1.0f, 1.0f, 1.0f, 1.0f));

void setColor(const Color4f& color);

Expand Down
2 changes: 1 addition & 1 deletion code/Ui/ColorPicker/ColorGradientControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace traktor::ui

T_IMPLEMENT_RTTI_CLASS(L"traktor.ui.ColorGradientControl", ColorGradientControl, Widget)

bool ColorGradientControl::create(Widget* parent, int style, const Color4ub& primaryColor)
bool ColorGradientControl::create(Widget* parent, uint32_t style, const Color4ub& primaryColor)
{
if (!Widget::create(parent, style))
return false;
Expand Down
2 changes: 1 addition & 1 deletion code/Ui/ColorPicker/ColorGradientControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class T_DLLCLASS ColorGradientControl : public Widget
T_RTTI_CLASS;

public:
bool create(Widget* parent, int style, const Color4ub& color = Color4ub(0, 0, 0, 255));
bool create(Widget* parent, uint32_t style, const Color4ub& color = Color4ub(0, 0, 0, 255));

virtual Size getPreferredSize(const Size& hint) const override;

Expand Down
2 changes: 1 addition & 1 deletion code/Ui/ColorPicker/ColorSliderControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace traktor::ui

T_IMPLEMENT_RTTI_CLASS(L"traktor.ui.ColorSliderControl", ColorSliderControl, Widget)

bool ColorSliderControl::create(Widget* parent, int style, IGradient* gradient)
bool ColorSliderControl::create(Widget* parent, uint32_t style, IGradient* gradient)
{
if (!Widget::create(parent, style))
return false;
Expand Down
2 changes: 1 addition & 1 deletion code/Ui/ColorPicker/ColorSliderControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class T_DLLCLASS ColorSliderControl : public Widget
virtual Color4ub get(int32_t at) const = 0;
};

bool create(Widget* parent, int style, IGradient* gradient);
bool create(Widget* parent, uint32_t style, IGradient* gradient);

void setMarker(int32_t marker);

Expand Down
2 changes: 1 addition & 1 deletion code/Ui/ComboBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace traktor::ui

T_IMPLEMENT_RTTI_CLASS(L"traktor.ui.ComboBox", ComboBox, Widget)

bool ComboBox::create(Widget* parent, const std::wstring& text, int style)
bool ComboBox::create(Widget* parent, const std::wstring& text, uint32_t style)
{
if (!Widget::create(parent, style))
return false;
Expand Down
2 changes: 1 addition & 1 deletion code/Ui/ComboBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class T_DLLCLASS ComboBox : public Widget
T_RTTI_CLASS;

public:
bool create(Widget* parent, const std::wstring& text, int style = WsNone);
bool create(Widget* parent, const std::wstring& text, uint32_t style = WsNone);

int add(const std::wstring& item);

Expand Down
2 changes: 1 addition & 1 deletion code/Ui/ConfigDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace traktor::ui

T_IMPLEMENT_RTTI_CLASS(L"traktor.ui.ConfigDialog", ConfigDialog, Dialog)

bool ConfigDialog::create(Widget* parent, const std::wstring& text, Unit width, Unit height, int style, Layout* layout)
bool ConfigDialog::create(Widget* parent, const std::wstring& text, Unit width, Unit height, uint32_t style, Layout* layout)
{
if (!Dialog::create(parent, text, width, height, style, layout))
return false;
Expand Down
13 changes: 5 additions & 8 deletions code/Ui/ConfigDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,11 @@ class T_DLLCLASS ConfigDialog : public Dialog
T_RTTI_CLASS;

public:
enum StyleFlags
{
WsOkCancelButtons = 0,
WsYesNoButtons = (WsUser << 1),
WsApplyButton = (WsUser << 2)
};

bool create(Widget* parent, const std::wstring& text, Unit width, Unit height, int style, Layout* layout);
constexpr static uint32_t WsOkCancelButtons = 0;
constexpr static uint32_t WsYesNoButtons = (WsUser << 1);
constexpr static uint32_t WsApplyButton = (WsUser << 2);

bool create(Widget* parent, const std::wstring& text, Unit width, Unit height, uint32_t style, Layout* layout);

virtual void destroy() override;

Expand Down
2 changes: 1 addition & 1 deletion code/Ui/Container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace traktor::ui

T_IMPLEMENT_RTTI_CLASS(L"traktor.ui.Container", Container, Widget)

bool Container::create(Widget* parent, int style, Layout* layout)
bool Container::create(Widget* parent, uint32_t style, Layout* layout)
{
m_layout = layout;

Expand Down
2 changes: 1 addition & 1 deletion code/Ui/Container.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class T_DLLCLASS Container : public Widget
Both = (Horizontal | Vertical)
};

bool create(Widget* parent, int style = WsNone, Layout* layout = nullptr);
bool create(Widget* parent, uint32_t style = WsNone, Layout* layout = nullptr);

virtual void fit(uint32_t axis);

Expand Down
2 changes: 1 addition & 1 deletion code/Ui/Dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ WidgetType* getAncestorOf(Widget* widget)

T_IMPLEMENT_RTTI_CLASS(L"traktor.ui.Dialog", Dialog, Container)

bool Dialog::create(Widget* parent, const std::wstring& text, Unit width, Unit height, int style, Layout* layout)
bool Dialog::create(Widget* parent, const std::wstring& text, Unit width, Unit height, uint32_t style, Layout* layout)
{
IDialog* dialog = Application::getInstance()->getWidgetFactory()->createDialog(this);
if (!dialog)
Expand Down
15 changes: 6 additions & 9 deletions code/Ui/Dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@ class T_DLLCLASS Dialog : public Container
T_RTTI_CLASS;

public:
enum StyleFlags
{
WsCenterParent = WsUser,
WsCenterDesktop = (WsUser << 1),
WsDefaultFixed = WsSystemBox | WsMinimizeBox | WsCloseBox | WsCaption,
WsDefaultResizable = WsResizable | WsSystemBox | WsMinimizeBox | WsMaximizeBox | WsCloseBox | WsCaption
};

bool create(Widget* parent, const std::wstring& text, Unit width, Unit height, int style = WsDefaultResizable, Layout* layout = 0);
constexpr static uint32_t WsCenterParent = WsUser;
constexpr static uint32_t WsCenterDesktop = (WsUser << 1);
constexpr static uint32_t WsDefaultFixed = WsSystemBox | WsMinimizeBox | WsCloseBox | WsCaption;
constexpr static uint32_t WsDefaultResizable = WsResizable | WsSystemBox | WsMinimizeBox | WsMaximizeBox | WsCloseBox | WsCaption;

bool create(Widget* parent, const std::wstring& text, Unit width, Unit height, uint32_t style = WsDefaultResizable, Layout* layout = 0);

void setIcon(IBitmap* icon);

Expand Down
2 changes: 1 addition & 1 deletion code/Ui/DropDown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace traktor::ui

T_IMPLEMENT_RTTI_CLASS(L"traktor.ui.DropDown", DropDown, Widget)

bool DropDown::create(Widget* parent, int32_t style)
bool DropDown::create(Widget* parent, uint32_t style)
{
if (!Widget::create(parent, style))
return false;
Expand Down
11 changes: 4 additions & 7 deletions code/Ui/DropDown.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,11 @@ class T_DLLCLASS DropDown : public Widget
T_RTTI_CLASS;

public:
enum Styles
{
WsSingle = 0,
WsMultiple = WsUser,
WsDefault = WsSingle
};
constexpr static uint32_t WsSingle = 0;
constexpr static uint32_t WsMultiple = WsUser;
constexpr static uint32_t WsDefault = WsSingle;

bool create(Widget* parent, int32_t style = WsDefault);
bool create(Widget* parent, uint32_t style = WsDefault);

int32_t add(const std::wstring& item, Object* data = 0);

Expand Down
2 changes: 1 addition & 1 deletion code/Ui/Edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Edit::Edit()
{
}

bool Edit::create(Widget* parent, const std::wstring& text, int style, const EditValidator* validator)
bool Edit::create(Widget* parent, const std::wstring& text, uint32_t style, const EditValidator* validator)
{
if (!Widget::create(parent, style | WsDoubleBuffer))
return false;
Expand Down
7 changes: 2 additions & 5 deletions code/Ui/Edit.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ class T_DLLCLASS Edit : public Widget
T_RTTI_CLASS;

public:
enum Styles
{
WsReadOnly = WsUser
};
constexpr static uint32_t WsReadOnly = WsUser;

Edit();

bool create(Widget* parent, const std::wstring& text = L"", int style = WsNone, const EditValidator* validator = nullptr);
bool create(Widget* parent, const std::wstring& text = L"", uint32_t style = WsNone, const EditValidator* validator = nullptr);

virtual void destroy() override;

Expand Down
Loading

0 comments on commit e0ca872

Please sign in to comment.