diff --git a/plugins/CriticalPath/CMakeLists.txt b/plugins/CriticalPath/CMakeLists.txt index 1575f094d8169dd4509d9ec3d2433922dcd12a41..02fa4b071e4cf652e6ba09c23556339fce5b1c4f 100644 --- a/plugins/CriticalPath/CMakeLists.txt +++ b/plugins/CriticalPath/CMakeLists.txt @@ -38,6 +38,7 @@ set(CRITICALPATH_FORMS_TMP ${CMAKE_SOURCE_DIR}/src/interface/ui/interval_select.ui ${CMAKE_SOURCE_DIR}/src/interface/ui/main_window.ui ${CMAKE_SOURCE_DIR}/src/interface/ui/node_select.ui + ${CMAKE_SOURCE_DIR}/src/interface/ui/select_info_window.ui ${CMAKE_SOURCE_DIR}/src/interface/ui/settings.ui ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4c552f373a0742c1b2f5fe021c32c9a0d7fe833a..57dc7831954b8048240735c0fa8a536cb27f00d8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -108,6 +108,7 @@ set(VITE_HDRS render/Render_abstract.hpp # Interface headers interface/resource.hpp + interface/SelectInfo.hpp interface/Settings_window.hpp interface/Interface_graphic.hpp interface/Node_select.hpp @@ -208,6 +209,7 @@ set(VITE_SRCS interface/IntervalSelect.cpp interface/IntervalSelectLayout.cpp interface/Node_select.cpp + interface/SelectInfo.cpp interface/Settings_window.cpp interface/RangeSliderWidget.cpp interface/viteqtreewidget.cpp diff --git a/src/interface/Interface_graphic.cpp b/src/interface/Interface_graphic.cpp index 64cbfb40bbc24f40e1017467ad60d616c492533a..fdc90c957228547e05d5f7937a1f077171bbbd3f 100644 --- a/src/interface/Interface_graphic.cpp +++ b/src/interface/Interface_graphic.cpp @@ -111,6 +111,7 @@ Interface_graphic::Interface_graphic(Core *core, QWidget *parent) : _plugin_window = nullptr; _ui_settings = nullptr; _ui_node_selection = nullptr; + _ui_select_info_window = new SelectInfo(this); _ui_interval_selection = nullptr; // For drag and drop operations @@ -157,20 +158,8 @@ void Interface_graphic::load_windows() { exit(EXIT_FAILURE); } - /* Load the window about information on a selection from a .ui file */ - if (file_select_info.exists()) { - file_select_info.open(QFile::ReadOnly); - CKFP(_ui_select_info_window = loader->load(&file_select_info, this), "Cannot open the .ui file: :/window/select_info_window.ui"); - file_select_info.close(); - } - else { - cerr << __FILE__ << ":" << __LINE__ << ": The following .ui file doesn't exist: :/window/select_info_window.ui" << endl; - exit(EXIT_FAILURE); - } - /* Set some windows properties */ _ui_info_window->setWindowFlags(_ui_info_window->windowFlags() | Qt::WindowStaysOnTopHint); /* Always display info_window on top */ - _ui_select_info_window->setWindowFlags(_ui_select_info_window->windowFlags() | Qt::WindowStaysOnTopHint); /* Always display select_info_window on top */ /* Load widget from the .ui file */ CKFP(_ui_render_area_container_layout = this->findChild<QVBoxLayout *>(QStringLiteral("render_container_layout")), "Cannot find the render_area_container_layout in the .ui file"); @@ -178,7 +167,6 @@ void Interface_graphic::load_windows() { CKFP(_ui_fullscreen_menu = this->findChild<QAction *>(QStringLiteral("fullscreen")), "Cannot find the fullscreen menu in the .ui file"); CKFP(_ui_info_trace_text = _ui_info_window->findChild<QTextEdit *>(QStringLiteral("info_trace_text")), "Cannot find the info_trace_text QTextEdit widget in the .ui file"); - CKFP(_ui_info_selection_tabs = _ui_select_info_window->findChild<QTabWidget *>(QStringLiteral("info_selection_tab")), "Cannot find the info_selection_tab QTabWidget widget in the .ui file"); CKFP(_ui_toolbar = this->findChild<QToolBar *>(QStringLiteral("toolBar")), "Cannot find the tool bar in the .ui file"); CKFP(_ui_recent_files_menu = this->findChild<QMenu *>(QStringLiteral("menuRecent_Files")), "Cannot find the button \"menuRecent_Files\" in the .ui file"); @@ -247,7 +235,7 @@ void Interface_graphic::information(const string &s) const { **********************************/ void Interface_graphic::selection_information_clear() const { - _ui_info_selection_tabs->clear(); /* Remove all tabs in the QTabWidget*/ + _ui_select_info_window->get_tabs()->clear(); /* Remove all tabs in the QTabWidget*/ } void Interface_graphic::selection_information_show() const { @@ -256,14 +244,14 @@ void Interface_graphic::selection_information_show() const { void Interface_graphic::selection_information(const std::string &tab_name, const string &content) const { // Create and setup the tab - QTextEdit *text_widget = new QTextEdit(_ui_info_selection_tabs); + QTextEdit *text_widget = new QTextEdit(_ui_select_info_window->get_tabs()); text_widget->setReadOnly(true); text_widget->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard); // Fill the text content and add the tab to the window text_widget->insertHtml(QStringLiteral("<font color='blue'>") + QString::fromStdString(content) + QStringLiteral("</font>")); text_widget->moveCursor(QTextCursor::Start); // Make the text edit scroll to the top - _ui_info_selection_tabs->addTab(text_widget, QString::fromStdString(tab_name)); + _ui_select_info_window->get_tabs()->addTab(text_widget, QString::fromStdString(tab_name)); } /*********************************** @@ -362,7 +350,7 @@ void Interface_graphic::remove_render_area(RenderLayout *render_layout) { * Clear the informative window texts and hide it. */ _ui_info_trace_text->clear(); /* Clear the current text (if exists) */ - _ui_info_selection_tabs->clear(); /* Clear the current text (if exists) */ + _ui_select_info_window->get_tabs()->clear(); /* Clear the current text (if exists) */ _ui_info_window->hide(); /* Hide the informative window */ _ui_select_info_window->hide(); /* Hide the selection information window */ diff --git a/src/interface/Interface_graphic.hpp b/src/interface/Interface_graphic.hpp index ed4732b700f0caf64687c465d610d14a58ae7c74..998f5b4175436592d0ddfedae56bb5e832d83b0c 100644 --- a/src/interface/Interface_graphic.hpp +++ b/src/interface/Interface_graphic.hpp @@ -47,6 +47,7 @@ class QProgressDialog; #include "ui_main_window.h" /* the main window graphical interface */ /* Global information */ +#include "interface/SelectInfo.hpp" #include "interface/Settings_window.hpp" #include "interface/Node_select.hpp" /* -- */ @@ -138,7 +139,7 @@ protected: /*! * \brief This variable contains the floatting box window for information on user selection in the application. */ - QWidget *_ui_select_info_window; + SelectInfo *_ui_select_info_window; /*! * \brief Dialog box to allow user to set its ViTE environment. (change color, text size, etc.) @@ -160,11 +161,6 @@ protected: */ QTextEdit *_ui_info_trace_text; - /*! - * \brief Text area which informs the user about the selected entity information. - */ - QTabWidget *_ui_info_selection_tabs; - /*! * \brief The menu where recent files are printed */ diff --git a/src/interface/SelectInfo.cpp b/src/interface/SelectInfo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d8ff1142767c453a80ff80b095e56e5877e5a74e --- /dev/null +++ b/src/interface/SelectInfo.cpp @@ -0,0 +1,31 @@ +/** + * + * @file src/interface/SelectInfo.cpp + * + * @copyright 2008-2024 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + * Univ. Bordeaux. All rights reserved. + * + * @author Camille Ordronneau + * + * @date 2024-08-06 + */ +/*! + *\file SelectInfo.cpp + *\brief This file defines a class for the window popping up when the user double click on an entity + * This window displays information on the Entity clicked + * When several Entities are clicked on at the same time, information for each are displayed in tabs + */ + +#include "interface/Interface_graphic.hpp" +#include "interface/SelectInfo.hpp" + +SelectInfo::SelectInfo(Interface_graphic *interface_graphic) : + QDialog(interface_graphic), _interface_graphic(interface_graphic) { + setupUi(this); +} + +SelectInfo::~SelectInfo() = default; + +QTabWidget *SelectInfo::get_tabs() const { + return info_selection_tab; +} \ No newline at end of file diff --git a/src/interface/SelectInfo.hpp b/src/interface/SelectInfo.hpp new file mode 100644 index 0000000000000000000000000000000000000000..746b7c550e00148e991506cd5aff40803342a449 --- /dev/null +++ b/src/interface/SelectInfo.hpp @@ -0,0 +1,59 @@ +/** + * + * @file src/interface/SelectInfo.hpp + * + * @copyright 2008-2024 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + * Univ. Bordeaux. All rights reserved. + * + * @author Camille Ordronneau + * + * @date 2024-08-06 + */ +/*! + *\file SelectInfo.hpp + */ + +#ifndef SELECT_INFO_HPP +#define SELECT_INFO_HPP + +#include <QDialog> +#include <QTabWidget> +/* -- */ +#include "ui_select_info_window.h" +/* -- */ + +class Interface_graphic; + +/*! + * \class SelectInfo + * \brief Class used to view information on a selected Entity + * + */ + +class SelectInfo : public QDialog, protected Ui::select_info_window +{ + + Q_OBJECT + +private: + Interface_graphic *_interface_graphic; + +public: + /*! + * Default constructor + * \param parent The parent widget of the window. + */ + SelectInfo(Interface_graphic *interface_graphic); + + ~SelectInfo(); + + /** + * \brief Getter for the tab container of the window + */ + QTabWidget *get_tabs() const; + +private: +private Q_SLOTS: +}; + +#endif // NODE_SELECT_HPP diff --git a/src/interface/ui/select_info_window.ui b/src/interface/ui/select_info_window.ui index 66d9c27cac569ddcce201e630998c27b6c92b578..70d523a30eb96dc86d7dbe7f7ecf45c5c3fd91f8 100644 --- a/src/interface/ui/select_info_window.ui +++ b/src/interface/ui/select_info_window.ui @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>select_info_window</class> - <widget class="QMainWindow" name="select_info_window"> + <widget class="QDialog" name="select_info_window"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>565</width> - <height>400</height> + <height>450</height> </rect> </property> <property name="windowTitle"> @@ -17,49 +17,64 @@ <iconset resource="vite.qrc"> <normaloff>:/icon/icon/vite.png</normaloff>:/icon/icon/vite.png</iconset> </property> - <widget class="QWidget" name="centralwidget"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QGroupBox" name="verticalGroupBox"> + <property name="title"> + <string>Selection Information</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> <item> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <property name="rightMargin"> - <number>0</number> + <widget class="QTabWidget" name="info_selection_tab"> + <property name="currentIndex"> + <number>-1</number> </property> - <property name="bottomMargin"> - <number>0</number> + <property name="movable"> + <bool>true</bool> </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="button_layout"> + <item> + <widget class="QPushButton" name="center_begin"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> + <property name="text"> + <string>Center on Begin</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> <item> - <widget class="QGroupBox" name="info_selection"> - <property name="title"> - <string>Selection Information </string> + <widget class="QPushButton" name="center_end"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> + <property name="text"> + <string>Center on End</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QTabWidget" name="info_selection_tab"> - <property name="currentIndex"> - <number>-1</number> - </property> - <property name="movable"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> </widget> </item> </layout> </item> </layout> - </item> - </layout> - </widget> + </widget> + </item> + </layout> </widget> <resources> <include location="vite.qrc"/>