mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
eepp: Layouts improvements. Added UICodeEditorSplitter::createWidget. Fixed a bug in UITouchDraggableWidget.
ecode: WIP Build Settings UI.
This commit is contained in:
@@ -43,8 +43,8 @@ class EE_API Translator {
|
||||
void setCurrentLanguage( const std::string& currentLanguage );
|
||||
|
||||
protected:
|
||||
typedef std::map<std::string, String> StringDictionary;
|
||||
typedef std::map<std::string, StringDictionary> StringLocaleDictionary;
|
||||
typedef std::unordered_map<std::string, String> StringDictionary;
|
||||
typedef std::unordered_map<std::string, StringDictionary> StringLocaleDictionary;
|
||||
|
||||
std::string mDefaultLanguage;
|
||||
std::string mCurrentLanguage;
|
||||
|
||||
@@ -85,6 +85,9 @@ class EE_API UICodeEditorSplitter {
|
||||
const std::string& tabName,
|
||||
bool focus = true );
|
||||
|
||||
std::pair<UITab*, UIWidget*> createWidget( UIWidget* widget, const std::string& tabName,
|
||||
bool focus = true );
|
||||
|
||||
std::vector<std::pair<UITab*, UITabWidget*>> getTabFromOwnedWidgetId( const std::string& id );
|
||||
|
||||
bool removeTabWithOwnedWidgetId( const std::string& id, bool destroyOwnedNode = true,
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <eepp/ui/uiwidget.hpp>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <variant>
|
||||
|
||||
namespace EE { namespace UI {
|
||||
|
||||
@@ -29,6 +30,18 @@ template <typename T> class UIDataBind {
|
||||
} );
|
||||
}
|
||||
|
||||
static Converter converterString() {
|
||||
return Converter(
|
||||
[]( const UIDataBind<T>*, T& val, const std::string& str ) {
|
||||
val = str;
|
||||
return true;
|
||||
},
|
||||
[]( const UIDataBind<T>*, std::string& str, const T& val ) {
|
||||
str = val;
|
||||
return true;
|
||||
} );
|
||||
}
|
||||
|
||||
static Converter converterBool() {
|
||||
return Converter(
|
||||
[]( const UIDataBind<T>* databind, T& val, const std::string& str ) -> bool {
|
||||
@@ -44,39 +57,45 @@ template <typename T> class UIDataBind {
|
||||
static std::unique_ptr<UIDataBind<T>>
|
||||
New( T* t, const std::set<UIWidget*>& widgets,
|
||||
const Converter& converter = UIDataBind<T>::converterDefault(),
|
||||
const std::string& valueKey = "value" ) {
|
||||
const std::string& valueKey = "value",
|
||||
const Event::EventType& eventType = Event::OnValueChange ) {
|
||||
return std::unique_ptr<UIDataBind<T>>(
|
||||
new UIDataBind<T>( t, widgets, converter, valueKey ) );
|
||||
new UIDataBind<T>( t, widgets, converter, valueKey, eventType ) );
|
||||
}
|
||||
|
||||
static std::unique_ptr<UIDataBind<T>>
|
||||
New( T* t, UIWidget* widget, const Converter& converter = UIDataBind<T>::converterDefault(),
|
||||
const std::string& valueKey = "value" ) {
|
||||
const std::string& valueKey = "value",
|
||||
const Event::EventType& eventType = Event::OnValueChange ) {
|
||||
return std::unique_ptr<UIDataBind<T>>(
|
||||
new UIDataBind<T>( t, widget, converter, valueKey ) );
|
||||
new UIDataBind<T>( t, widget, converter, valueKey, eventType ) );
|
||||
}
|
||||
|
||||
UIDataBind() {}
|
||||
|
||||
UIDataBind( T* t, const std::set<UIWidget*>& widgets,
|
||||
const Converter& converter = UIDataBind<T>::converterDefault(),
|
||||
const std::string& valueKey = "value" ) {
|
||||
init( t, widgets, converter, valueKey );
|
||||
const std::string& valueKey = "value",
|
||||
const Event::EventType& eventType = Event::OnValueChange ) {
|
||||
init( t, widgets, converter, valueKey, eventType );
|
||||
}
|
||||
|
||||
UIDataBind( T* t, UIWidget* widget,
|
||||
const Converter& converter = UIDataBind<T>::converterDefault(),
|
||||
const std::string& valueKey = "value" ) {
|
||||
init( t, { widget }, converter, valueKey );
|
||||
const std::string& valueKey = "value",
|
||||
const Event::EventType& eventType = Event::OnValueChange ) {
|
||||
init( t, { widget }, converter, valueKey, eventType );
|
||||
}
|
||||
|
||||
void init( T* t, const std::set<UIWidget*>& widgets,
|
||||
const Converter& converter = UIDataBind<T>::converterDefault(),
|
||||
const std::string& valueKey = "value" ) {
|
||||
const std::string& valueKey = "value",
|
||||
const Event::EventType& eventType = Event::OnValueChange ) {
|
||||
data = t;
|
||||
this->widgets = widgets;
|
||||
this->property = StyleSheetSpecification::instance()->getProperty( valueKey );
|
||||
this->converter = converter;
|
||||
this->eventType = eventType;
|
||||
for ( auto widget : widgets )
|
||||
bindListeners( widget );
|
||||
set( *data );
|
||||
@@ -134,17 +153,17 @@ template <typename T> class UIDataBind {
|
||||
protected:
|
||||
T* data{ nullptr };
|
||||
std::set<UIWidget*> widgets;
|
||||
std::map<UIWidget*, Uint32> valueCbs;
|
||||
std::map<UIWidget*, Uint32> closeCbs;
|
||||
std::unordered_map<UIWidget*, Uint32> valueCbs;
|
||||
std::unordered_map<UIWidget*, Uint32> closeCbs;
|
||||
bool inSetValue{ false };
|
||||
const PropertyDefinition* property{ nullptr };
|
||||
Converter converter;
|
||||
Event::EventType eventType{ Event::OnValueChange };
|
||||
|
||||
void bindListeners( UIWidget* widget ) {
|
||||
valueCbs[widget] =
|
||||
widget->addEventListener( Event::OnValueChange, [this]( const Event* event ) {
|
||||
processValueChange( event->getNode()->asType<UIWidget>() );
|
||||
} );
|
||||
valueCbs[widget] = widget->addEventListener( eventType, [this]( const Event* event ) {
|
||||
processValueChange( event->getNode()->asType<UIWidget>() );
|
||||
} );
|
||||
closeCbs[widget] = widget->addEventListener( Event::OnClose, [this]( const Event* event ) {
|
||||
closeCbs.erase( event->getNode()->asType<UIWidget>() );
|
||||
this->widgets.erase( event->getNode()->asType<UIWidget>() );
|
||||
@@ -190,14 +209,16 @@ template <typename T> class UIDataBind {
|
||||
|
||||
class UIDataBindBool {
|
||||
public:
|
||||
static std::unique_ptr<UIDataBind<bool>>
|
||||
using Ptr = std::unique_ptr<UIDataBind<bool>>;
|
||||
|
||||
static Ptr
|
||||
New( bool* t, const std::set<UIWidget*>& widgets,
|
||||
const UIDataBind<bool>::Converter& converter = UIDataBind<bool>::converterBool(),
|
||||
const std::string& valueKey = "value" ) {
|
||||
return UIDataBind<bool>::New( t, widgets, converter, valueKey );
|
||||
}
|
||||
|
||||
static std::unique_ptr<UIDataBind<bool>>
|
||||
static Ptr
|
||||
New( bool* t, UIWidget* widget,
|
||||
const UIDataBind<bool>::Converter& converter = UIDataBind<bool>::converterBool(),
|
||||
const std::string& valueKey = "value" ) {
|
||||
@@ -205,6 +226,51 @@ class UIDataBindBool {
|
||||
}
|
||||
};
|
||||
|
||||
class UIDataBindString {
|
||||
public:
|
||||
using Ptr = std::unique_ptr<UIDataBind<std::string>>;
|
||||
|
||||
static Ptr New( std::string* t, const std::set<UIWidget*>& widgets,
|
||||
const UIDataBind<std::string>::Converter& converter =
|
||||
UIDataBind<std::string>::converterString(),
|
||||
const std::string& valueKey = "text",
|
||||
const Event::EventType& eventType = Event::OnTextChanged ) {
|
||||
return UIDataBind<std::string>::New( t, widgets, converter, valueKey, eventType );
|
||||
}
|
||||
|
||||
static Ptr New( std::string* t, UIWidget* widget,
|
||||
const UIDataBind<std::string>::Converter& converter =
|
||||
UIDataBind<std::string>::converterString(),
|
||||
const std::string& valueKey = "text",
|
||||
const Event::EventType& eventType = Event::OnTextChanged ) {
|
||||
return UIDataBind<std::string>::New( t, widget, converter, valueKey, eventType );
|
||||
}
|
||||
};
|
||||
|
||||
class UIDataBindHolder {
|
||||
public:
|
||||
using UIDataBindVariant =
|
||||
std::variant<UIDataBindString::Ptr, UIDataBindBool::Ptr, UIDataBind<Uint32>,
|
||||
UIDataBind<Int32>, UIDataBind<Uint64>, UIDataBind<Int64>, UIDataBind<Uint8>,
|
||||
UIDataBind<Int8>, UIDataBind<Uint16>, UIDataBind<Int16>, UIDataBind<float>,
|
||||
UIDataBind<double>>;
|
||||
|
||||
UIDataBindHolder& hold( UIDataBindVariant&& ptr ) {
|
||||
mHolder.emplace_back( std::move( ptr ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
UIDataBindHolder& operator+=( UIDataBindVariant&& ptr ) {
|
||||
mHolder.emplace_back( std::move( ptr ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
void clear() { mHolder.clear(); }
|
||||
|
||||
protected:
|
||||
std::vector<UIDataBindVariant> mHolder;
|
||||
};
|
||||
|
||||
}} // namespace EE::UI
|
||||
|
||||
#endif // EE_UI_UIDATABIND_HPP
|
||||
|
||||
@@ -1214,6 +1214,8 @@
|
||||
../../src/tools/ecode/statusterminalcontroller.hpp
|
||||
../../src/tools/ecode/terminalmanager.cpp
|
||||
../../src/tools/ecode/terminalmanager.hpp
|
||||
../../src/tools/ecode/uibuildsettings.cpp
|
||||
../../src/tools/ecode/uibuildsettings.hpp
|
||||
../../src/tools/ecode/uicodeeditorsplitter.cpp
|
||||
../../src/tools/ecode/uicodeeditorsplitter.hpp
|
||||
../../src/tools/ecode/uistatusbar.cpp
|
||||
|
||||
@@ -199,7 +199,10 @@ void UIAbstractTableView::createOrUpdateColumns( bool resetColumnData ) {
|
||||
}
|
||||
|
||||
mHeader->setPixelsSize( totalWidth, getHeaderHeight() );
|
||||
bool visible = mHeader->isVisible();
|
||||
mHeader->setVisible( true );
|
||||
mHeader->updateLayout();
|
||||
mHeader->setVisible( visible );
|
||||
|
||||
updateColumnsWidth();
|
||||
}
|
||||
|
||||
@@ -465,6 +465,26 @@ UICodeEditorSplitter::createCodeEditorInTabWidget( UITabWidget* tabWidget ) {
|
||||
return std::make_pair( tab, editor );
|
||||
}
|
||||
|
||||
std::pair<UITab*, UIWidget*>
|
||||
UICodeEditorSplitter::createWidget( UIWidget* widget, const std::string& tabName, bool focus ) {
|
||||
UITabWidget* tabWidget = nullptr;
|
||||
|
||||
UIWidget* curWidget = getCurWidget();
|
||||
if ( !curWidget )
|
||||
return std::make_pair( (UITab*)nullptr, (UIWidget*)nullptr );
|
||||
tabWidget = tabWidgetFromWidget( curWidget );
|
||||
|
||||
if ( !tabWidget ) {
|
||||
if ( !getTabWidgets().empty() ) {
|
||||
tabWidget = getTabWidgets()[0];
|
||||
} else {
|
||||
return std::make_pair( (UITab*)nullptr, (UIWidget*)nullptr );
|
||||
}
|
||||
}
|
||||
|
||||
return createWidgetInTabWidget( tabWidget, widget, tabName, focus );
|
||||
}
|
||||
|
||||
std::pair<UITab*, UIWidget*>
|
||||
UICodeEditorSplitter::createWidgetInTabWidget( UITabWidget* tabWidget, UIWidget* widget,
|
||||
const std::string& tabName, bool focus ) {
|
||||
|
||||
@@ -110,6 +110,15 @@ void UIGridLayout::updateLayout() {
|
||||
if ( mPacking )
|
||||
return;
|
||||
mPacking = true;
|
||||
|
||||
if ( !mVisible ) {
|
||||
setInternalPixelsSize( Sizef::Zero );
|
||||
notifyLayoutAttrChangeParent();
|
||||
mPacking = false;
|
||||
mDirtyLayout = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Sizef oldSize( getSize() );
|
||||
|
||||
if ( getParent()->isUINode() &&
|
||||
|
||||
@@ -51,10 +51,19 @@ UILinearLayout* UILinearLayout::setOrientation( const UIOrientation& orientation
|
||||
}
|
||||
|
||||
void UILinearLayout::updateLayout() {
|
||||
if ( mOrientation == UIOrientation::Vertical )
|
||||
packVertical();
|
||||
else
|
||||
packHorizontal();
|
||||
if ( !mVisible ) {
|
||||
if ( mPacking )
|
||||
return;
|
||||
mPacking = true;
|
||||
setInternalPixelsSize( Sizef::Zero );
|
||||
notifyLayoutAttrChangeParent();
|
||||
mPacking = false;
|
||||
} else {
|
||||
if ( mOrientation == UIOrientation::Vertical )
|
||||
packVertical();
|
||||
else
|
||||
packHorizontal();
|
||||
}
|
||||
mDirtyLayout = false;
|
||||
}
|
||||
|
||||
@@ -206,9 +215,10 @@ void UILinearLayout::packVertical() {
|
||||
? getPixelsSize().getHeight() - mPaddingPx.Top - mPaddingPx.Bottom
|
||||
: getParent()->getPixelsSize().getHeight() - mLayoutMarginPx.Bottom -
|
||||
mLayoutMarginPx.Top - mPaddingPx.Top - mPaddingPx.Bottom;
|
||||
Float size = (Float)( totSize - freeSize.getHeight() ) * widget->getLayoutWeight();
|
||||
Float newSize =
|
||||
eeceil( totSize - freeSize.getHeight() ) * widget->getLayoutWeight();
|
||||
|
||||
widget->setPixelsSize( widget->getPixelsSize().getWidth(), (Int32)size );
|
||||
widget->setPixelsSize( widget->getPixelsSize().getWidth(), newSize );
|
||||
}
|
||||
|
||||
switch ( Font::getHorizontalAlign( widget->getLayoutGravity() ) ) {
|
||||
@@ -333,9 +343,9 @@ void UILinearLayout::packHorizontal() {
|
||||
? getPixelsSize().getWidth() - mPaddingPx.Left - mPaddingPx.Right
|
||||
: getParent()->getPixelsSize().getWidth() - mLayoutMarginPx.Right -
|
||||
mLayoutMarginPx.Left - mPaddingPx.Left - mPaddingPx.Right;
|
||||
Float size = (Float)( totSize - freeSize.getWidth() ) * widget->getLayoutWeight();
|
||||
Float newSize = eeceil( totSize - freeSize.getWidth() ) * widget->getLayoutWeight();
|
||||
|
||||
widget->setPixelsSize( (Int32)size, widget->getPixelsSize().getHeight() );
|
||||
widget->setPixelsSize( newSize, widget->getPixelsSize().getHeight() );
|
||||
}
|
||||
|
||||
switch ( Font::getVerticalAlign( widget->getLayoutGravity() ) ) {
|
||||
|
||||
@@ -33,28 +33,34 @@ void UIRelativeLayout::updateLayout() {
|
||||
return;
|
||||
mPacking = true;
|
||||
|
||||
if ( getParent()->isUINode() &&
|
||||
( !getParent()->asType<UINode>()->ownsChildPosition() || isGravityOwner() ) ) {
|
||||
setInternalPosition( Vector2f( mLayoutMargin.Left, mLayoutMargin.Top ) );
|
||||
}
|
||||
if ( !mVisible ) {
|
||||
setInternalPixelsSize( Sizef::Zero );
|
||||
notifyLayoutAttrChangeParent();
|
||||
} else {
|
||||
|
||||
Sizef s( getSizeFromLayoutPolicy() );
|
||||
|
||||
if ( s != getPixelsSize() )
|
||||
setInternalPixelsSize( s );
|
||||
|
||||
Node* child = mChild;
|
||||
|
||||
while ( NULL != child ) {
|
||||
if ( child->isWidget() ) {
|
||||
UIWidget* widget = static_cast<UIWidget*>( child );
|
||||
|
||||
fixChildSize( widget );
|
||||
|
||||
fixChildPos( widget );
|
||||
if ( getParent()->isUINode() &&
|
||||
( !getParent()->asType<UINode>()->ownsChildPosition() || isGravityOwner() ) ) {
|
||||
setInternalPosition( Vector2f( mLayoutMargin.Left, mLayoutMargin.Top ) );
|
||||
}
|
||||
|
||||
child = child->getNextNode();
|
||||
Sizef s( getSizeFromLayoutPolicy() );
|
||||
|
||||
if ( s != getPixelsSize() )
|
||||
setInternalPixelsSize( s );
|
||||
|
||||
Node* child = mChild;
|
||||
|
||||
while ( NULL != child ) {
|
||||
if ( child->isWidget() ) {
|
||||
UIWidget* widget = static_cast<UIWidget*>( child );
|
||||
|
||||
fixChildSize( widget );
|
||||
|
||||
fixChildPos( widget );
|
||||
}
|
||||
|
||||
child = child->getNextNode();
|
||||
}
|
||||
}
|
||||
|
||||
mDirtyLayout = false;
|
||||
|
||||
@@ -199,6 +199,14 @@ void UIStackLayout::updateLayout() {
|
||||
return;
|
||||
mPacking = true;
|
||||
|
||||
if ( !mVisible ) {
|
||||
setInternalPixelsSize( Sizef::Zero );
|
||||
notifyLayoutAttrChangeParent();
|
||||
mPacking = false;
|
||||
mDirtyLayout = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Sizef size( getSizeFromLayoutPolicy() );
|
||||
|
||||
if ( getLayoutWidthPolicy() == SizePolicy::WrapContent )
|
||||
|
||||
@@ -131,13 +131,14 @@ void UITouchDraggableWidget::scheduledUpdate( const Time& time ) {
|
||||
Uint32 UITouchDraggableWidget::onMessage( const NodeMessage* msg ) {
|
||||
if ( msg->getMsg() == NodeMessage::MouseDown && ( msg->getFlags() & EE_BUTTON_LMASK ) &&
|
||||
!isTouchDragging() && isTouchOverAllowedChilds() &&
|
||||
!getEventDispatcher()->isNodeDragging() ) {
|
||||
!getEventDispatcher()->isNodeDragging() && isTouchDragEnabled() ) {
|
||||
setTouchDragging( true );
|
||||
getEventDispatcher()->setNodeDragging( this );
|
||||
mTouchDragPoint = getEventDispatcher()->getMousePosf();
|
||||
mTouchDragAcceleration = Vector2f( 0, 0 );
|
||||
return 1;
|
||||
} else if ( msg->getMsg() == NodeMessage::MouseUp && ( msg->getFlags() & EE_BUTTON_LMASK ) && isTouchDragging() && isTouchOverAllowedChilds() ) {
|
||||
} else if ( msg->getMsg() == NodeMessage::MouseUp && ( msg->getFlags() & EE_BUTTON_LMASK ) &&
|
||||
isTouchDragging() && isTouchOverAllowedChilds() ) {
|
||||
setTouchDragging( false );
|
||||
getEventDispatcher()->setNodeDragging( nullptr );
|
||||
return 1;
|
||||
|
||||
@@ -3278,6 +3278,142 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe
|
||||
#status_bar > TextView.selected {
|
||||
background-color: var(--primary);
|
||||
}
|
||||
.settings_panel {
|
||||
padding: 4dp;
|
||||
}
|
||||
.settings_panel .title {
|
||||
font-size:17dp;
|
||||
}
|
||||
.settings_panel .subtitle {
|
||||
font-size:15dp;
|
||||
margin-top: 12dp;
|
||||
}
|
||||
.settings_panel > .subtitle {
|
||||
margin-top: 4dp;
|
||||
}
|
||||
.settings_panel .advance_opt {
|
||||
font-size:15dp;
|
||||
}
|
||||
.settings_panel .separator {
|
||||
margin-top: 4dp;
|
||||
background-color: var(--font-hint);
|
||||
}
|
||||
.settings_panel PushButton {
|
||||
padding-top: 2dp;
|
||||
padding-bottom: 2dp;
|
||||
}
|
||||
.settings_panel .build_step,
|
||||
.settings_panel .os_select {
|
||||
background-color: var(--list-back);
|
||||
border-width: 1dp;
|
||||
border-color: var(--button-border);
|
||||
padding: 4dp;
|
||||
margin-top: 4dp;
|
||||
}
|
||||
.settings_panel .build_step > LinearLayout > LinearLayout {
|
||||
margin-bottom: 3dp;
|
||||
}
|
||||
.settings_panel .build_step TextInput {
|
||||
padding: 2dp 4dp 2dp 4dp;
|
||||
}
|
||||
.settings_panel .add_build_step {
|
||||
margin-top: 4dp;
|
||||
}
|
||||
.settings_panel .build_steps {
|
||||
margin-bottom: 4dp;
|
||||
}
|
||||
.settings_panel .build_step:first-child .move_up,
|
||||
.settings_panel .build_step:first-child .remove_item {
|
||||
enabled: false;
|
||||
}
|
||||
.settings_panel .build_step:last-child .move_down {
|
||||
enabled: false;
|
||||
}
|
||||
.settings_panel .build_step > .details {
|
||||
margin-top: 2dp;
|
||||
}
|
||||
.settings_panel .build_step > .header > PushButton {
|
||||
margin-left: 2dp;
|
||||
}
|
||||
.settings_panel .build_step > .header > .remove_item:disabled,
|
||||
.settings_panel .build_step > .header > .move_up:disabled,
|
||||
.settings_panel .build_step > .header > .move_down:disabled {
|
||||
tint: var(--icon);
|
||||
}
|
||||
.settings_panel .os_select > CheckBox {
|
||||
margin-right: 8dp;
|
||||
}
|
||||
.settings_panel .save_cont > PushButton {
|
||||
margin: 8dp 0dp 0dp 4dp;
|
||||
padding: 4dp 16dp 4dp 16dp;
|
||||
}
|
||||
.settings_panel .build_types > DropDownList,
|
||||
.settings_panel .output_parser > DropDownList,
|
||||
.settings_panel .span {
|
||||
margin-top: 4dp;
|
||||
}
|
||||
.settings_panel #build_type_list {
|
||||
margin-right: 4dp;
|
||||
}
|
||||
.settings_panel .build_types_cont {
|
||||
row-valign: center;
|
||||
}
|
||||
.settings_panel .inner_box {
|
||||
padding-top: 8dp;
|
||||
visible: false;
|
||||
}
|
||||
.settings_panel .inner_box .build_environment > .subtitle {
|
||||
margin-top: 0dp;
|
||||
}
|
||||
.settings_panel .advanced_options {
|
||||
margin-top: 12dp;
|
||||
border-radius: 4dp;
|
||||
padding: 4dp;
|
||||
background-color: rgba(0,0,0, 0.1);
|
||||
}
|
||||
.settings_panel .advanced_options .title {
|
||||
padding-bottom: 4dp;
|
||||
border-radius: 4dp;
|
||||
background-color: transparent;
|
||||
transition: background-color 100ms;
|
||||
}
|
||||
.settings_panel .advanced_options .title:hover {
|
||||
background-color: var(--primary);
|
||||
}
|
||||
.settings_panel .output_parser .output_parser_rules {
|
||||
background-color: var(--list-back);
|
||||
}
|
||||
.settings_panel .output_parser .output_parser_rules {
|
||||
margin-top: 4dp;
|
||||
}
|
||||
.settings_panel .output_parser .output_parser_rules > TextView {
|
||||
padding-left: 4dp;
|
||||
min-height: 24dp;
|
||||
layout-gravity: center;
|
||||
}
|
||||
.settings_panel .output_parser .output_parser_rules > TextView:first-child {
|
||||
border-width: 1dp;
|
||||
border-right-color: var(--button-border);
|
||||
}
|
||||
.settings_panel .output_parser .output_parser_rules > PushButton {
|
||||
layout-gravity: center;
|
||||
}
|
||||
.settings_panel .details_but {
|
||||
icon: icon(arrow-up-s, 10dp);
|
||||
inner-widget-orientation: widgettextboxicon;
|
||||
}
|
||||
.settings_panel .details_but.contracted {
|
||||
icon: icon(arrow-down-s, 10dp);
|
||||
}
|
||||
.settings_panel > .advanced_options > .title > Image {
|
||||
icon: icon(arrow-down-s, 24dp);
|
||||
}
|
||||
.settings_panel > .advanced_options > .title > Image.expanded {
|
||||
icon: icon(arrow-up-s, 24dp);
|
||||
}
|
||||
.settings_panel > .advanced_options > LinearLayout.inner_box.visible {
|
||||
visible: true;
|
||||
}
|
||||
</style>
|
||||
<MainLayout id="main_layout" layout_width="match_parent" layout_height="match_parent">
|
||||
<Splitter id="project_splitter" layout_width="match_parent" layout_height="match_parent">
|
||||
@@ -3440,6 +3576,7 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe
|
||||
{ "arrow-down", 0xea4c },
|
||||
{ "arrow-up", 0xea76 },
|
||||
{ "arrow-down-s", 0xea4e },
|
||||
{ "arrow-up-s", 0xea78 },
|
||||
{ "arrow-right-s", 0xea6e },
|
||||
{ "match-case", 0xed8d },
|
||||
{ "palette", 0xefc5 },
|
||||
|
||||
@@ -1276,7 +1276,7 @@ LSPClientServer::LSPRequestHandle LSPClientServer::write( const json& msg,
|
||||
std::string sjson = ob.dump();
|
||||
sjson = String::format( "Content-Length: %lu\r\n\r\n%s", sjson.length(), sjson.c_str() );
|
||||
|
||||
if ( mReady || msg[MEMBER_METHOD] == "initialize" ) {
|
||||
if ( mReady || ( msg.contains( MEMBER_METHOD ) && msg[MEMBER_METHOD] == "initialize" ) ) {
|
||||
std::string method;
|
||||
if ( msg.contains( MEMBER_METHOD ) )
|
||||
method = msg[MEMBER_METHOD].get<std::string>();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "ecode.hpp"
|
||||
#include "scopedop.hpp"
|
||||
#include "statusbuildoutputcontroller.hpp"
|
||||
#include "uibuildsettings.hpp"
|
||||
#include <eepp/core/string.hpp>
|
||||
#include <eepp/scene/scenemanager.hpp>
|
||||
#include <eepp/system/clock.hpp>
|
||||
@@ -81,7 +82,11 @@ bool ProjectBuild::isOSSupported( const std::string& os ) const {
|
||||
ProjectBuildManager::ProjectBuildManager( const std::string& projectRoot,
|
||||
std::shared_ptr<ThreadPool> pool, UITabWidget* sidePanel,
|
||||
App* app ) :
|
||||
mProjectRoot( projectRoot ), mThreadPool( pool ), mSidePanel( sidePanel ), mApp( app ) {
|
||||
mProjectRoot( projectRoot ),
|
||||
mThreadPool( pool ),
|
||||
mSidePanel( sidePanel ),
|
||||
mApp( app ),
|
||||
mNewBuild( mApp->i18n( "new_name", "new_name" ), mProjectRoot ) {
|
||||
FileSystem::dirAddSlashAtEnd( mProjectRoot );
|
||||
|
||||
if ( mThreadPool ) {
|
||||
@@ -583,17 +588,15 @@ void ProjectBuildManager::buildSidePanelTab() {
|
||||
<vbox lw="mp" lh="wc" padding="4dp">
|
||||
<TextView text="@string(build_settings, Build Settings)" font-size="15dp" />
|
||||
<TextView text="@string(build_configuration, Build Configuration)" />
|
||||
<DropDownList id="build_list" layout_width="mp" layout_height="wrap_content" margin-bottom="4dp" />
|
||||
<!--
|
||||
<hbox lw="mp" lh="wc">
|
||||
<PushButton lw="0" lw8="0.5" id="build_edit" text="@string(edit_build, Edit Build)" margin-right="2dp" />
|
||||
<PushButton lw="0" lw8="0.5" id="build_add" text="@string(add_build, Add Build)" margin-left="2dp" />
|
||||
<hbox lw="mp" lh="wc" margin-bottom="4dp">
|
||||
<DropDownList id="build_list" layout_width="0" lw8="1" layout_height="wrap_content" />
|
||||
<PushButton id="build_edit" id="build_edit" text="@string(edit_build, Edit Build)" tooltip="@string(edit_build, Edit Build)" text-as-fallback="true" icon="icon(file-edit, 12dp)" margin-left="2dp" />
|
||||
<PushButton id="build_add" id="build_add" text="@string(add_build, Add Build)" tooltip="@string(add_build, Add Build)" text-as-fallback="true" icon="icon(add, 12dp)" margin-left="2dp" />
|
||||
</hbox>
|
||||
-->
|
||||
<TextView text="@string(build_target, Build Target)" margin-top="8dp" />
|
||||
<hbox lw="mp" lh="wc">
|
||||
<DropDownList id="build_type_list" layout_width="0" layout_weight="1" layout_height="wrap_content" />
|
||||
<!-- <PushButton id="build_type_add" text="@string(add_build, Add Build)" text-as-fallback="true" icon="icon(add, 12dp)" margin-left="2dp"/> -->
|
||||
<PushButton id="build_type_add" text="@string(add_build_type, Add Build Type)" tooltip="@string(add_build_type, Add Build Type)" text-as-fallback="true" icon="icon(add, 12dp)" margin-left="2dp"/>
|
||||
</hbox>
|
||||
<PushButton id="build_button" lw="mp" lh="wc" text="@string(build, Build)" margin-top="8dp" icon="icon(hammer, 12dp)" />
|
||||
<PushButton id="clean_button" lw="mp" lh="wc" text="@string(clean, Clean)" margin-top="8dp" icon="icon(eraser, 12dp)" />
|
||||
@@ -612,6 +615,8 @@ void ProjectBuildManager::updateSidePanelTab() {
|
||||
UIDropDownList* buildList = buildTab->find<UIDropDownList>( "build_list" );
|
||||
UIPushButton* buildButton = buildTab->find<UIPushButton>( "build_button" );
|
||||
UIPushButton* cleanButton = buildTab->find<UIPushButton>( "clean_button" );
|
||||
UIPushButton* buildAdd = buildTab->find<UIPushButton>( "build_add" );
|
||||
UIPushButton* buildEdit = buildTab->find<UIPushButton>( "build_edit" );
|
||||
|
||||
buildList->getListBox()->clear();
|
||||
|
||||
@@ -634,13 +639,15 @@ void ProjectBuildManager::updateSidePanelTab() {
|
||||
}
|
||||
|
||||
buildList->setEnabled( !buildList->getListBox()->isEmpty() );
|
||||
buildEdit->setEnabled( !buildList->getListBox()->isEmpty() );
|
||||
|
||||
updateBuildType();
|
||||
|
||||
buildList->removeEventsOfType( Event::OnItemSelected );
|
||||
buildList->addEventListener( Event::OnItemSelected, [this, buildList]( const Event* ) {
|
||||
buildList->addEventListener( Event::OnItemSelected, [this, buildEdit, buildList]( const Event* ) {
|
||||
mConfig.buildName = buildList->getListBox()->getItemSelectedText();
|
||||
mConfig.buildType = "";
|
||||
buildEdit->setEnabled( true );
|
||||
updateBuildType();
|
||||
} );
|
||||
|
||||
@@ -669,12 +676,37 @@ void ProjectBuildManager::updateSidePanelTab() {
|
||||
}
|
||||
},
|
||||
MouseButton::EE_BUTTON_LEFT );
|
||||
|
||||
buildAdd->addMouseClickListener(
|
||||
[this]( const Event* ) {
|
||||
mNewBuild = ProjectBuild( mApp->i18n( "new_name", "new_name" ), mProjectRoot );
|
||||
auto ret = mApp->getSplitter()->createWidget(
|
||||
UIBuildSettings::New( mNewBuild ),
|
||||
mApp->i18n( "build_settings", "Build Settings" ) );
|
||||
ret.first->setIcon( mApp->findIcon( "hammer" ) );
|
||||
},
|
||||
MouseButton::EE_BUTTON_LEFT );
|
||||
|
||||
buildEdit->addMouseClickListener(
|
||||
[this]( const Event* ) {
|
||||
if ( !mConfig.buildName.empty() ) {
|
||||
auto build = mBuilds.find( mConfig.buildName );
|
||||
if ( build != mBuilds.end() ) {
|
||||
auto ret = mApp->getSplitter()->createWidget(
|
||||
UIBuildSettings::New( build->second ),
|
||||
mApp->i18n( "build_settings", "Build Settings" ) );
|
||||
ret.first->setIcon( mApp->findIcon( "hammer" ) );
|
||||
}
|
||||
}
|
||||
},
|
||||
MouseButton::EE_BUTTON_LEFT );
|
||||
}
|
||||
|
||||
void ProjectBuildManager::updateBuildType() {
|
||||
UIWidget* buildTab = mTab->getOwnedWidget()->find<UIWidget>( "build_tab" );
|
||||
UIDropDownList* buildList = buildTab->find<UIDropDownList>( "build_list" );
|
||||
UIDropDownList* buildTypeList = buildTab->find<UIDropDownList>( "build_type_list" );
|
||||
UIPushButton* buildTypeAdd = buildTab->find<UIPushButton>( "build_type_add" );
|
||||
|
||||
buildTypeList->getListBox()->clear();
|
||||
|
||||
@@ -697,6 +729,7 @@ void ProjectBuildManager::updateBuildType() {
|
||||
}
|
||||
}
|
||||
buildTypeList->setEnabled( !buildTypeList->getListBox()->isEmpty() );
|
||||
buildTypeAdd->setEnabled( !mConfig.buildName.empty() );
|
||||
|
||||
buildTypeList->removeEventsOfType( Event::OnItemSelected );
|
||||
buildTypeList->addEventListener( Event::OnItemSelected, [this, buildTypeList]( const Event* ) {
|
||||
|
||||
@@ -48,8 +48,7 @@ class StatusBuildOutputController;
|
||||
}
|
||||
],
|
||||
"config": {
|
||||
"clear_sys_env": false,
|
||||
"enabled": true
|
||||
"clear_sys_env": false
|
||||
},
|
||||
"env": {
|
||||
"SHELL": "fish"
|
||||
@@ -91,7 +90,6 @@ using ProjectBuildSteps = std::vector<ProjectBuildStep>;
|
||||
using ProjectBuildKeyVal = std::unordered_map<std::string, std::string>;
|
||||
|
||||
struct ProjectBuildConfig {
|
||||
bool enabled{ true };
|
||||
bool clearSysEnv{ false };
|
||||
};
|
||||
|
||||
@@ -146,6 +144,7 @@ class ProjectBuild {
|
||||
|
||||
protected:
|
||||
friend class ProjectBuildManager;
|
||||
friend class UIBuildSettings;
|
||||
|
||||
std::string mName;
|
||||
std::string mProjectRoot;
|
||||
@@ -257,6 +256,7 @@ class ProjectBuildManager {
|
||||
UITab* mTab{ nullptr };
|
||||
App* mApp{ nullptr };
|
||||
std::unique_ptr<Process> mProcess;
|
||||
ProjectBuild mNewBuild;
|
||||
bool mLoaded{ false };
|
||||
bool mLoading{ false };
|
||||
bool mBuilding{ false };
|
||||
|
||||
226
src/tools/ecode/uibuildsettings.cpp
Normal file
226
src/tools/ecode/uibuildsettings.cpp
Normal file
@@ -0,0 +1,226 @@
|
||||
#include "uibuildsettings.hpp"
|
||||
#include <eepp/ui/uicheckbox.hpp>
|
||||
#include <eepp/ui/uidropdownlist.hpp>
|
||||
#include <eepp/ui/uilinearlayout.hpp>
|
||||
|
||||
namespace ecode {
|
||||
|
||||
class UIBuildStep : public UILinearLayout {
|
||||
public:
|
||||
static UIBuildStep* New( bool isBuildStep, UIBuildSettings* buildSettings, size_t stepNum,
|
||||
ProjectBuildStep& buildStep ) {
|
||||
return eeNew( UIBuildStep, ( isBuildStep, buildSettings, stepNum, buildStep ) );
|
||||
}
|
||||
|
||||
protected:
|
||||
UIBuildStep( bool isBuildStep, UIBuildSettings* buildSettings, size_t stepNum,
|
||||
ProjectBuildStep& buildStep ) :
|
||||
UILinearLayout( "buildstep", UIOrientation::Vertical ),
|
||||
mIsBuildStep( isBuildStep ),
|
||||
mBuildSettings( buildSettings ),
|
||||
mStepNum( stepNum ),
|
||||
mStep( buildStep ) {
|
||||
setLayoutSizePolicy( SizePolicy::MatchParent, SizePolicy::WrapContent );
|
||||
addClass( "build_step" );
|
||||
|
||||
static const auto BUILD_STEP_XML = R"xml(
|
||||
<!-- <vbox lw="mp" lh="wc" class="build_step"> -->
|
||||
<hbox class="header" lw="mp" lh="wc">
|
||||
<TextView lw="0" lw8="1" class="step_name" />
|
||||
<CheckBox class="enabled_checkbox" checked="true" layout_gravity="center_vertical" tooltip="@string(enabled_question, Enabled?)" />
|
||||
<PushButton class="move_up" text="@string(move_up, Move Up)" text-as-fallback="true" icon="icon(arrow-up-s, 12dp)" tooltip="@string(move_up, Move Up)" />
|
||||
<PushButton class="move_down" text="@string(move_down, Move Down)" text-as-fallback="true" icon="icon(arrow-down-s, 12dp)" tooltip="@string(move_down, Move Down)" />
|
||||
<PushButton class="remove_item" text="@string(remove item, Remove Item)" text-as-fallback="true" icon="icon(delete-bin, 12dp)" tooltip="@string(remove_item, Remove Item)" />
|
||||
<PushButton class="details_but" text='@string(details_nbsp, "Details ")' />
|
||||
</hbox>
|
||||
<vbox class="details" lw="mp" lh="wc">
|
||||
<hbox lw="mp">
|
||||
<TextView lh="mp" min-width="100dp" text="@string(command, Command)" />
|
||||
<Input class="input_cmd" lw="0" lw8="1" />
|
||||
</hbox>
|
||||
<hbox lw="mp">
|
||||
<TextView lh="mp" min-width="100dp" text="@string(arguments, Arguments)" />
|
||||
<Input class="input_args" lw="0" lw8="1" />
|
||||
</hbox>
|
||||
<hbox lw="mp">
|
||||
<TextView lh="mp" min-width="100dp" text="@string(working_dir, Working Directory)" />
|
||||
<Input class="input_working_dir" lw="0" lw8="1" />
|
||||
</hbox>
|
||||
</vbox>
|
||||
<!-- </vbox> -->
|
||||
)xml";
|
||||
|
||||
getUISceneNode()->loadLayoutFromString( BUILD_STEP_XML, this );
|
||||
findByClass<UITextView>( "step_name" )
|
||||
->setText( String::format( mBuildSettings->getUISceneNode()
|
||||
->i18n( "build_step_num", "Step %u" )
|
||||
.toUtf8()
|
||||
.c_str(),
|
||||
stepNum + 1 ) );
|
||||
mDataBindHolder += UIDataBindBool::New( &mStep.enabled, findByClass( "enabled_checkbox" ) );
|
||||
mDataBindHolder += UIDataBindString::New( &mStep.cmd, findByClass( "input_cmd" ) );
|
||||
mDataBindHolder += UIDataBindString::New( &mStep.args, findByClass( "input_args" ) );
|
||||
mDataBindHolder +=
|
||||
UIDataBindString::New( &mStep.workingDir, findByClass( "input_working_dir" ) );
|
||||
findByClass( "details_but" )
|
||||
->addMouseClickListener(
|
||||
[this]( const MouseEvent* event ) {
|
||||
auto me = event->getNode()->asType<UIPushButton>();
|
||||
findByClass( "details" )->setVisible( me->hasClass( "contracted" ) );
|
||||
me->toggleClass( "contracted" );
|
||||
},
|
||||
MouseButton::EE_BUTTON_LEFT );
|
||||
}
|
||||
|
||||
bool mIsBuildStep{ true };
|
||||
UIBuildSettings* mBuildSettings{ nullptr };
|
||||
size_t mStepNum{ 0 };
|
||||
ProjectBuildStep& mStep;
|
||||
UIDataBindHolder mDataBindHolder;
|
||||
};
|
||||
|
||||
static const auto SETTINGS_PANEL_XML = R"xml(
|
||||
<ScrollView lw="mp" lh="mp">
|
||||
<vbox lw="mp" lh="wc" class="settings_panel" id="build_settings_panel">
|
||||
<TextView class="title" text="@string(build_settings, Build Settings)" />
|
||||
<Widget class="separator" lw="mp" lh="1dp" />
|
||||
<TextView class="subtitle" text="@string(build_name, Build Name)" />
|
||||
<Input id="build_name" lw="mp" lh="wc" text="new_name" />
|
||||
<TextView class="subtitle" text="@string(supported_platforms, Supported Platforms)" />
|
||||
<TextView lw="mp" lh="wc" word-wrap="true" text="@string(supported_platforms_desc, Selecting none means that the build settings will work and be available on any Operating System)" />
|
||||
<StackLayout id="os_select" class="os_select" lw="wc" lh="wc">
|
||||
<CheckBox id="linux" text="Linux" />
|
||||
<CheckBox id="macos" text="macOS" />
|
||||
<CheckBox id="windows" text="Windows" />
|
||||
<CheckBox id="android" text="Android" />
|
||||
<CheckBox id="ios" text="iOS" />
|
||||
<CheckBox id="haiku" text="Haiku" />
|
||||
<CheckBox id="freebsd" text="FreeBSD" />
|
||||
</StackLayout>
|
||||
|
||||
<vbox lw="mp" lh="wc" class="build_steps">
|
||||
<TextView class="subtitle" text="@string(build_steps, Build Steps)" />
|
||||
<vbox id="build_steps_cont" lw="mp" lh="wc"></vbox>
|
||||
<PushButton class="add_build_step" text="@string(add_build_step, Add Build Step)" />
|
||||
</vbox>
|
||||
|
||||
<vbox lw="mp" lh="wc" class="clean_steps">
|
||||
<TextView class="subtitle" text="@string(clean_steps, Clean Steps)" />
|
||||
<vbox id="build_clean_steps_cont" lw="mp" lh="wc"></vbox>
|
||||
<PushButton class="add_build_step" text="@string(add_clean_step, Add Clean Step)" />
|
||||
</vbox>
|
||||
|
||||
<vbox lw="mp" lh="wc" class="build_types">
|
||||
<TextView class="subtitle" text="@string(build_types, Build Types)" />
|
||||
<TextView lw="mp" lh="wc" word-wrap="true" text="@string(build_types_desc, Build types can be used as a dynamic build option represented by the special key ${build_type}. The build type can be switch easily from the editor.)" />
|
||||
<StackLayout class="build_types_cont span" lw="mp" lh="wc">
|
||||
<DropDownList id="build_type_list" layout_width="200dp" layout_height="wc" />
|
||||
<PushButton lh="mp" id="build_type_del" text="@string(delete_selected, Delete Selected)" text-as-fallback="true" icon="icon(delete-bin, 12dp)" tooltip="@string(delete_selected, Delete Selected)" />
|
||||
</StackLayout>
|
||||
<PushButton id="build_type_add" class="span" text="@string(add_build_type, Add Build Type)" />
|
||||
</vbox>
|
||||
|
||||
<vbox class="advanced_options" lw="mp" lh="wc">
|
||||
<hbox class="title advanced_options_title" lw="mp" lh="wc">
|
||||
<TextView enabled="false" lw="0" lw8="1" lh="wc" class="advance_opt" text="@string(advanced_options, Advanced Options)" />
|
||||
<Image enabled="false" lg="center" />
|
||||
</hbox>
|
||||
<vbox class="inner_box" lw="mp" lh="wc">
|
||||
<vbox lw="mp" lh="wc" class="build_environment">
|
||||
<TextView class="subtitle" text="@string(build_environment, Build Environment)" />
|
||||
<CheckBox text="@string(clear_system_enviroment, Clear System Environment)" />
|
||||
</vbox>
|
||||
|
||||
<vbox lw="mp" lh="wc" class="output_parser">
|
||||
<TextView class="subtitle" text="@string(output_parser, Output Parser)" />
|
||||
<TextView lw="mp" lh="wc" word-wrap="true" text="@string(output_parser_desc, Custom output parsers scan command line output for user-provided error patterns to create entries in Issues and highlight those errors on the Build Output)" />
|
||||
<TextView lw="mp" lh="wc" word-wrap="true" text='@string(output_parser_preset, "Presets are provided as generic output parsers, you can select one below, by default a \"generic\" preset will be selected:")' />
|
||||
<DropDownList id="output_parsers_presets_list" layout_width="200dp" layout_height="wc" selected-text="generic">
|
||||
<item></item>
|
||||
<item>generic</item>
|
||||
</DropDownList>
|
||||
<PushButton class="output_parser_custom_rule span" text="@string(output_parser_custom_rule, Add Custom Rule)" />
|
||||
<hbox class="output_parser_rules" lw="mp" lh="wc">
|
||||
<TextView lw="0" lw8="0.2" lh="wc" class="type" text="@string(type, Type)" />
|
||||
<TextView lw="0" lw8="0.8" lh="wc" class="pattern" class="rule" text="@string(pattern, Pattern)" />
|
||||
<PushButton class="remove_item" text="@string(remove item, Remove Item)" text-as-fallback="true" icon="icon(delete-bin, 12dp)" tooltip="@string(remove_item, Remove Item)" />
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
||||
<vbox lw="mp" lh="wc" class="custom_vars">
|
||||
<TextView class="subtitle" text="@string(custom_variables, Custom Variables)" />
|
||||
<TextView lw="mp" lh="wc" word-wrap="true" text='@string(custom_variables_desc, "Custom Variables allow to simplify the build commands steps adding custom variables that can be used over the build settings in commands, arguments, and working directories.")' />
|
||||
<TextView lw="mp" lh="wc" word-wrap="true" text='@string(custom_variables_desc_2, "Custom Variables can be invoked using ${variable_name} in any of the commands.)' />
|
||||
<TableView lw="mp" lh="150dp" />
|
||||
<TextView class="span" lw="mp" lh="wc" word-wrap="true" text='@string(custom_variables_desc_3, There are predefined custom variables available to use: ${project_root}: The folder / project root directory. ${build_type}: The build type selected to build the project. ${os}: The current operating system name. ${nproc}: The number of logical processing units.)' />
|
||||
</vbox>
|
||||
</vbox>
|
||||
|
||||
</vbox>
|
||||
|
||||
<TextView class="build_settings_clarification span" word-wrap="true" lw="mp" lh="wc" text='@string(build_settings_save_clarification, * All changes are automatically saved)' />
|
||||
</vbox>
|
||||
</ScrollView>
|
||||
)xml";
|
||||
|
||||
UIBuildSettings* UIBuildSettings::New( ProjectBuild& build ) {
|
||||
return eeNew( UIBuildSettings, ( build ) );
|
||||
}
|
||||
|
||||
UIBuildSettings::UIBuildSettings( ProjectBuild& build ) : mBuild( build ) {
|
||||
mUISceneNode->loadLayoutFromString( SETTINGS_PANEL_XML, this,
|
||||
String::hash( "build_settings" ) );
|
||||
mDataBindHolder += UIDataBindString::New( &mBuild.mName, find<UITextInput>( "build_name" ) );
|
||||
|
||||
auto oses = find<UIWidget>( "os_select" )->querySelectorAll( "CheckBox" );
|
||||
for ( const auto os : oses ) {
|
||||
if ( mBuild.mOS.find( os->getId() ) != mBuild.mOS.end() )
|
||||
os->asType<UICheckBox>()->setChecked( true );
|
||||
os->on( Event::OnValueChange, [this]( const Event* ) { updateOS(); } );
|
||||
}
|
||||
|
||||
if ( mBuild.mBuild.empty() )
|
||||
mBuild.mBuild.push_back( {} );
|
||||
|
||||
if ( mBuild.mClean.empty() )
|
||||
mBuild.mClean.push_back( {} );
|
||||
|
||||
auto buildStepsParent = find( "build_steps_cont" );
|
||||
for ( size_t step = 0; step < mBuild.mBuild.size(); ++step ) {
|
||||
auto bs = UIBuildStep::New( true, this, step, mBuild.mBuild[step] );
|
||||
bs->setParent( buildStepsParent );
|
||||
}
|
||||
|
||||
auto buildCleanStepsParent = find( "build_clean_steps_cont" );
|
||||
for ( size_t step = 0; step < mBuild.mClean.size(); ++step ) {
|
||||
auto bs = UIBuildStep::New( false, this, step, mBuild.mClean[step] );
|
||||
bs->setParent( buildCleanStepsParent );
|
||||
}
|
||||
|
||||
auto buildTypeDropDown = find<UIDropDownList>( "build_type_list" );
|
||||
std::vector<String> buildTypes;
|
||||
for ( const auto& type : mBuild.mBuildTypes )
|
||||
buildTypes.push_back( type );
|
||||
buildTypeDropDown->getListBox()->addListBoxItems( buildTypes );
|
||||
buildTypeDropDown->getListBox()->setSelected( 0 );
|
||||
|
||||
auto advTitle = querySelector( ".settings_panel > .advanced_options > .title" );
|
||||
advTitle->addMouseClickListener(
|
||||
[this]( const MouseEvent* event ) {
|
||||
auto img = event->getNode()->findByType( UI_TYPE_IMAGE )->asType<UIWidget>();
|
||||
findByClass( "inner_box" )->toggleClass( "visible" );
|
||||
img->toggleClass( "expanded" );
|
||||
},
|
||||
MouseButton::EE_BUTTON_LEFT );
|
||||
}
|
||||
|
||||
void UIBuildSettings::updateOS() {
|
||||
mBuild.mOS.clear();
|
||||
auto oses = find<UIWidget>( "os_select" )->querySelectorAll( "CheckBox" );
|
||||
for ( const auto os : oses ) {
|
||||
if ( os->asType<UICheckBox>()->isChecked() )
|
||||
mBuild.mOS.insert( os->getId() );
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ecode
|
||||
27
src/tools/ecode/uibuildsettings.hpp
Normal file
27
src/tools/ecode/uibuildsettings.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef EE_UI_UIBUILDSETTINGS_HPP
|
||||
#define EE_UI_UIBUILDSETTINGS_HPP
|
||||
|
||||
#include "projectbuild.hpp"
|
||||
#include <eepp/ui/uirelativelayout.hpp>
|
||||
#include <eepp/ui/uidatabind.hpp>
|
||||
|
||||
using namespace EE::UI;
|
||||
|
||||
namespace ecode {
|
||||
|
||||
class UIBuildSettings : public UIRelativeLayout {
|
||||
public:
|
||||
static UIBuildSettings* New( ProjectBuild& build );
|
||||
|
||||
protected:
|
||||
ProjectBuild& mBuild;
|
||||
UIDataBindHolder mDataBindHolder;
|
||||
|
||||
explicit UIBuildSettings( ProjectBuild& build );
|
||||
|
||||
void updateOS();
|
||||
};
|
||||
|
||||
} // namespace ecode
|
||||
|
||||
#endif // EE_UI_UIBUILDSETTINGS_HPP
|
||||
Reference in New Issue
Block a user