diff --git a/lib/io/include/io/internal/filesystem.hpp b/lib/io/include/io/internal/filesystem.hpp index dd05ab70f..ebd8a3e2f 100644 --- a/lib/io/include/io/internal/filesystem.hpp +++ b/lib/io/include/io/internal/filesystem.hpp @@ -40,6 +40,7 @@ namespace VTX::IO::Internal::Filesystem inline const FilePath getLibrariesDir() { return getExecutableDir() / "libraries"; } inline const FilePath getRepresentationsLibraryDir() { return getLibrariesDir() / "representations"; } inline const FilePath getRenderEffectPresetsLibraryDir() { return getLibrariesDir() / "render_effects"; } + inline const FilePath getThemesLibraryDir() { return getLibrariesDir() / "themes"; } inline const FilePath getInternalDataDir() { return getExecutableDir() / "data"; } inline const FilePath getResidueDataDir() { return getInternalDataDir() / "residue_data"; } diff --git a/lib/ui/asset/qt/resources/resources_ui.qrc b/lib/ui/asset/qt/resources/resources_ui.qrc index f56b0efba..0dc4c7d75 100644 --- a/lib/ui/asset/qt/resources/resources_ui.qrc +++ b/lib/ui/asset/qt/resources/resources_ui.qrc @@ -136,6 +136,7 @@ sprite/windows_icon.png stylesheet_ui.css stylesheet_ui_linux.css + stylesheet_ui_mac.css stylesheet_ui_windows.css video/video_intro.gif diff --git a/lib/ui/asset/qt/resources/stylesheet_ui_mac.css b/lib/ui/asset/qt/resources/stylesheet_ui_mac.css new file mode 100644 index 000000000..e69de29bb diff --git a/lib/ui/include/ui/qt/main_window.hpp b/lib/ui/include/ui/qt/main_window.hpp index a22a720bb..745e19229 100644 --- a/lib/ui/include/ui/qt/main_window.hpp +++ b/lib/ui/include/ui/qt/main_window.hpp @@ -67,7 +67,7 @@ namespace VTX::UI::QT void addFloatingWindow( QDialog * const p_window, const QSize & p_size, const bool p_visible ); - void appendStylesheet( const char * p_stylesheetPath ); + // void appendStylesheet( const char * p_stylesheetPath ); protected: void _setupUi( const QString & p_name ) override; @@ -85,8 +85,8 @@ namespace VTX::UI::QT void closeEvent( QCloseEvent * const p_event ) override; private: - QT::Widget::MainMenu::MainMenuBar * _mainMenuBar; - QT::Widget::Status::StatusBar* _statusBar; + QT::Widget::MainMenu::MainMenuBar * _mainMenuBar; + QT::Widget::Status::StatusBar * _statusBar; // Actions. void _onDockWindowVisibilityChange( bool p_visible ); @@ -94,7 +94,7 @@ namespace VTX::UI::QT void _updatePicker() const; // Functions. - void _loadStyleSheet( const char * p_stylesheetPath ); + void _loadTheme(); Core::WindowMode _getWindowModeFromWindowState( const Qt::WindowStates & p_state ); std::string _getWindowTitle() const; diff --git a/lib/ui/include/ui/theme/theme.hpp b/lib/ui/include/ui/theme/theme.hpp new file mode 100644 index 000000000..ad8d9a78b --- /dev/null +++ b/lib/ui/include/ui/theme/theme.hpp @@ -0,0 +1,9 @@ +#include + +namespace VTX::UI::Theme +{ + struct Theme + { + std::string color; + }; +} // namespace VTX::UI::Theme diff --git a/lib/ui/src/ui/qt/main_window.cpp b/lib/ui/src/ui/qt/main_window.cpp index 269b597f7..24e470c75 100644 --- a/lib/ui/src/ui/qt/main_window.cpp +++ b/lib/ui/src/ui/qt/main_window.cpp @@ -31,7 +31,7 @@ namespace VTX::UI::QT setDockOptions( DockOption::VerticalTabs | DockOption::AllowNestedDocks | DockOption::AllowTabbedDocks ); - _loadStyleSheet( ":/stylesheet_ui.css" ); + _loadTheme(); } void MainWindow::initWindowLayout() {} @@ -49,15 +49,37 @@ namespace VTX::UI::QT ); } - void MainWindow::_loadStyleSheet( const char * p_stylesheetPath ) + void MainWindow::_loadTheme() { - QFile stylesheetFile( p_stylesheetPath ); + // TODO: move to style constants. + // Load main stylesheet. + QFile stylesheetFile( ":/stylesheet_ui.css" ); stylesheetFile.open( QFile::ReadOnly ); - const QString stylesheet = stylesheetFile.readAll(); + QString stylesheet = stylesheetFile.readAll(); + + // Load os-specific stylesheet. +#if _WIN32 + QFile stylesheetOSFile( ":/stylesheet_ui_windows.css" ); +#elif __linux__ + QFile stylesheetOSFile( ":/stylesheet_ui_linux.css" ); +#elif __APPLE__ + QFile stylesheetOSFile( ":/stylesheet_ui_mac.css" ); +#else + QFile stylesheetOSFile(); + assert( true ); +#endif + + stylesheetOSFile.open( QFile::ReadOnly ); + stylesheet += '\n' + stylesheetOSFile.readAll(); + + // Load theme and apply to stylesheet. + + // Set stylesheet to app. setStyleSheet( stylesheet ); } + /* void MainWindow::appendStylesheet( const char * p_stylesheetPath ) { QFile stylesheetFile( p_stylesheetPath ); @@ -68,6 +90,7 @@ namespace VTX::UI::QT setStyleSheet( newStylesheet ); } + */ void MainWindow::_setupSlots() {} void MainWindow::localize() { setWindowTitle( "VTX" ); } diff --git a/lib/ui/src/ui/qt/tool/scene/widget/scene_tree_widget.cpp b/lib/ui/src/ui/qt/tool/scene/widget/scene_tree_widget.cpp index 849ca9617..5ef3222d7 100644 --- a/lib/ui/src/ui/qt/tool/scene/widget/scene_tree_widget.cpp +++ b/lib/ui/src/ui/qt/tool/scene/widget/scene_tree_widget.cpp @@ -15,6 +15,12 @@ namespace VTX::UI::QT::Tool::Scene::Widget static_cast( nullptr ), QStringList( QString( "item: %1" ).arg( i ) ) ) ); insertTopLevelItems( 0, items ); + + /* + MAIN_REGISTRY().connectSignal( + Core::ECS::SIGNAL::DESTROY, this + ); + */ } void SceneTreeWidget::_setupSlots() {} diff --git a/libraries/themes/Dark b/libraries/themes/Dark new file mode 100644 index 000000000..1d127492e --- /dev/null +++ b/libraries/themes/Dark @@ -0,0 +1,10 @@ +{ + "DATA": { + "COLOR": #ffffff + }, + "_VERSION": { + "MAJOR": 0, + "MINOR": 1, + "REVISION": 0 + } +}