From a00513a3977d4eaebc8b26c0610cb28ef76c53b6 Mon Sep 17 00:00:00 2001 From: stefan <stefan@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Thu, 29 Jul 2010 12:53:03 +0000 Subject: [PATCH] Renamed "info widget" to "message widget" git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2611 5a81b35b-ba03-0410-adc8-b2c5c5119f08 --- modules/gui/pymod/CMakeLists.txt | 2 +- modules/gui/pymod/export_gosty.cc | 4 +-- ...nfo_widget.cc => export_message_widget.cc} | 28 +++++++-------- modules/gui/pymod/wrap_gui.cc | 4 +-- modules/gui/src/CMakeLists.txt | 14 ++++---- modules/gui/src/admin.cc | 2 +- modules/gui/src/gosty_app.cc | 10 +++--- modules/gui/src/gosty_app.hh | 12 +++---- .../{info_widget => messages}/log_reader.cc | 8 ++--- .../{info_widget => messages}/log_reader.hh | 4 +-- .../message_widget.cc} | 34 +++++++++---------- .../message_widget.hh} | 12 +++---- scripts/init.py | 2 +- 13 files changed, 68 insertions(+), 68 deletions(-) rename modules/gui/pymod/{export_info_widget.cc => export_message_widget.cc} (70%) rename modules/gui/src/{info_widget => messages}/log_reader.cc (88%) rename modules/gui/src/{info_widget => messages}/log_reader.hh (94%) rename modules/gui/src/{info_widget/info_widget.cc => messages/message_widget.cc} (84%) rename modules/gui/src/{info_widget/info_widget.hh => messages/message_widget.hh} (89%) diff --git a/modules/gui/pymod/CMakeLists.txt b/modules/gui/pymod/CMakeLists.txt index 54981e740..61a4faa0b 100644 --- a/modules/gui/pymod/CMakeLists.txt +++ b/modules/gui/pymod/CMakeLists.txt @@ -1,7 +1,7 @@ set(OST_GUI_PYMOD_SOURCES wrap_gui.cc export_alignment_view.cc - export_info_widget.cc + export_message_widget.cc export_gl_win.cc export_plot.cc export_tool.cc diff --git a/modules/gui/pymod/export_gosty.cc b/modules/gui/pymod/export_gosty.cc index 95b68830b..239174a42 100644 --- a/modules/gui/pymod/export_gosty.cc +++ b/modules/gui/pymod/export_gosty.cc @@ -99,9 +99,9 @@ void export_Gosty() return_value_policy<reference_existing_object>()) .add_property("tool_options_win", make_function(&GostyApp::GetToolOptionsWin, return_value_policy<reference_existing_object>())) - .def("GetInfoWidget", &GostyApp::GetInfoWidget, + .def("GetMessageWidget", &GostyApp::GetMessageWidget, return_value_policy<reference_existing_object>()) - .add_property("info_widget", make_function(&GostyApp::GetInfoWidget, + .add_property("message_widget", make_function(&GostyApp::GetMessageWidget, return_value_policy<reference_existing_object>())) #if OST_IMG_ENABLED .def("CreateDataViewer", &app_create_data_viewer1,return_value_policy<reference_existing_object>()) diff --git a/modules/gui/pymod/export_info_widget.cc b/modules/gui/pymod/export_message_widget.cc similarity index 70% rename from modules/gui/pymod/export_info_widget.cc rename to modules/gui/pymod/export_message_widget.cc index 8847116bc..0cbdcdfc7 100644 --- a/modules/gui/pymod/export_info_widget.cc +++ b/modules/gui/pymod/export_message_widget.cc @@ -21,7 +21,7 @@ #include <boost/python.hpp> #include <boost/python/suite/indexing/vector_indexing_suite.hpp> -#include <ost/gui/info_widget/info_widget.hh> +#include <ost/gui/messages/message_widget.hh> #include "sip_handler.hh" @@ -31,27 +31,27 @@ using namespace ost::gui; namespace { -void log_message_a(InfoWidget* info_widget, const QString& message, QMessageBox::Icon icon = QMessageBox::Information) +void log_message_a(MessageWidget* message_widget, const QString& message, QMessageBox::Icon icon = QMessageBox::Information) { - info_widget->LogMessage(message,icon); + message_widget->LogMessage(message,icon); } -void log_message_b(InfoWidget * info_widget, object py_object) +void log_message_b(MessageWidget * message_widget, object py_object) { if(py_object.ptr() != Py_None){ if(PyObject_IsInstance(py_object.ptr(), (PyObject*)&PyString_Type)){ String message = extract < std::string > (py_object); - info_widget->LogMessage(QString(message.c_str())); + message_widget->LogMessage(QString(message.c_str())); } else if(QStandardItem* item = get_cpp_qobject<QStandardItem>(py_object)){ - info_widget->LogMessage(item); + message_widget->LogMessage(item); } } } } -void export_InfoWidget() +void export_MessageWidget() { enum_<QMessageBox::Icon>("MessageIcon") .value("QUESTION", QMessageBox::Question) @@ -61,15 +61,15 @@ void export_InfoWidget() .export_values() ; - class_<InfoWidget, boost::noncopyable>("InfoWidget", no_init) - .def("Show", &InfoWidget::show) - .def("Hide", &InfoWidget::hide) - .def("Clear", &InfoWidget::Clear) - .def("RemoveSelected", &InfoWidget::RemoveSelected) + class_<MessageWidget, boost::noncopyable>("MessageWidget", no_init) + .def("Show", &MessageWidget::show) + .def("Hide", &MessageWidget::hide) + .def("Clear", &MessageWidget::Clear) + .def("RemoveSelected", &MessageWidget::RemoveSelected) .def("LogMessage", &log_message_a) .def("LogMessage", &log_message_b) - .def("GetQObject",&get_py_qobject<InfoWidget>) - .add_property("qobject", &get_py_qobject<InfoWidget>) + .def("GetQObject",&get_py_qobject<MessageWidget>) + .add_property("qobject", &get_py_qobject<MessageWidget>) ; } diff --git a/modules/gui/pymod/wrap_gui.cc b/modules/gui/pymod/wrap_gui.cc index 65d505855..d0cd95bd2 100644 --- a/modules/gui/pymod/wrap_gui.cc +++ b/modules/gui/pymod/wrap_gui.cc @@ -28,7 +28,7 @@ void export_AlignmentView(); void export_Tool(); void export_Plot(); void export_GLWin(); -void export_InfoWidget(); +void export_MessageWidget(); void export_Gosty(); void export_PyShell(); void export_SceneWin(); @@ -110,7 +110,7 @@ BOOST_PYTHON_MODULE(_gui) export_AlignmentView(); export_Tool(); export_Plot(); - export_InfoWidget(); + export_MessageWidget(); export_GLWin(); export_MainArea(); export_PyShell(); diff --git a/modules/gui/src/CMakeLists.txt b/modules/gui/src/CMakeLists.txt index 9d2cae37e..0c5806c2c 100644 --- a/modules/gui/src/CMakeLists.txt +++ b/modules/gui/src/CMakeLists.txt @@ -91,8 +91,8 @@ scene_win.hh scene_win_model.hh ) -set(OST_GUI_INFO_WIDGET_HEADERS -info_widget.hh +set(OST_GUI_MESSAGES_HEADERS +message_widget.hh log_reader.hh ) @@ -212,8 +212,8 @@ widget.cc admin.cc widget_pool.cc remote_site_loader.cc -info_widget/info_widget.cc -info_widget/log_reader.cc +messages/message_widget.cc +messages/log_reader.cc sequence_viewer/align_properties_painter.cc sequence_viewer/base_row.cc sequence_viewer/background_painter.cc @@ -347,8 +347,8 @@ scene_selection.hh widget.hh widget_geom_handler.hh widget_pool.hh -info_widget/info_widget.hh -info_widget/log_reader.hh +messages/message_widget.hh +messages/log_reader.hh sequence_viewer/align_properties_painter.hh sequence_viewer/background_painter.hh sequence_viewer/base_row.hh @@ -482,7 +482,7 @@ module(NAME gui SOURCES ${OST_GUI_MOCS} ${OST_GUI_SOURCES} ${OST_GUI_PYTHON_SHELL_HEADERS} IN_DIR python_shell ${OST_GUI_PANEL_BAR_HEADERS} IN_DIR panels ${OST_GUI_SCENE_WIN_HEADERS} IN_DIR scene_win - ${OST_GUI_INFO_WIDGET_HEADERS} IN_DIR info_widget + ${OST_GUI_MESSAGES_HEADERS} IN_DIR messages ${OST_GUI_INPUT_HEADERS} ${OST_GUI_DATA_VIEWER_HEADERS} ${OST_GUI_HEADERS} diff --git a/modules/gui/src/admin.cc b/modules/gui/src/admin.cc index 14a85eaf8..4163750a4 100644 --- a/modules/gui/src/admin.cc +++ b/modules/gui/src/admin.cc @@ -85,7 +85,7 @@ AdminRights::~AdminRights() { } bool AdminRights::Acquire() -{ } +{ return false; } void AdminRights::Release() { } diff --git a/modules/gui/src/gosty_app.cc b/modules/gui/src/gosty_app.cc index 6236bcbc3..2214516b0 100644 --- a/modules/gui/src/gosty_app.cc +++ b/modules/gui/src/gosty_app.cc @@ -43,7 +43,7 @@ GostyApp* GostyApp::app_=NULL; GostyApp::GostyApp(): - py_shell_(NULL), gl_win_(NULL), scene_win_(NULL), info_widget_(NULL), seq_viewer_(NULL), + py_shell_(NULL), gl_win_(NULL), scene_win_(NULL), message_widget_(NULL), seq_viewer_(NULL), tool_options_win_(NULL), main_(new GostyMainWindow), perspective_(NULL), external_widgets_(QMap<QString,WidgetGeomHandler *>()) { @@ -139,12 +139,12 @@ Perspective* GostyApp::GetPerspective() return perspective_; } -InfoWidget* GostyApp::GetInfoWidget() +MessageWidget* GostyApp::GetMessageWidget() { - if (info_widget_==NULL) { - info_widget_=new InfoWidget(main_); + if (message_widget_==NULL) { + message_widget_=new MessageWidget(main_); } - return info_widget_; + return message_widget_; } void GostyApp::AddWidgetToApp(const QString& ident, QWidget* widget) diff --git a/modules/gui/src/gosty_app.hh b/modules/gui/src/gosty_app.hh index 178c41bdb..d3acd17af 100644 --- a/modules/gui/src/gosty_app.hh +++ b/modules/gui/src/gosty_app.hh @@ -33,7 +33,7 @@ #include <ost/gui/widget_geom_handler.hh> #include <ost/gui/scene_win/scene_win.hh> #include <ost/gui/sequence_viewer/sequence_viewer.hh> -#include <ost/gui/info_widget/info_widget.hh> +#include <ost/gui/messages/message_widget.hh> #if OST_IMG_ENABLED #include <ost/gui/data_viewer/data_viewer.hh> @@ -101,11 +101,11 @@ public: /// All subsequent calls will return the same SceneWin instance. ToolOptionsWin* GetToolOptionsWin(); - /// \brief get info widget + /// \brief get message widget /// - /// The InfoWidget is initialized when this method is first called. - /// All subsequent calls will return the same InfoWidget instance. - InfoWidget* GetInfoWidget(); + /// The MessageWidget is initialized when this method is first called. + /// All subsequent calls will return the same MessageWidget instance. + MessageWidget* GetMessageWidget(); #if OST_IMG_ENABLED /// \brief create new DataViewer @@ -157,7 +157,7 @@ private: SceneWin* scene_win_; - InfoWidget* info_widget_; + MessageWidget* message_widget_; SequenceViewer* seq_viewer_; diff --git a/modules/gui/src/info_widget/log_reader.cc b/modules/gui/src/messages/log_reader.cc similarity index 88% rename from modules/gui/src/info_widget/log_reader.cc rename to modules/gui/src/messages/log_reader.cc index 3b6e28e99..f4089ee55 100644 --- a/modules/gui/src/info_widget/log_reader.cc +++ b/modules/gui/src/messages/log_reader.cc @@ -21,7 +21,7 @@ */ #include <ost/log.hh> -#include "info_widget.hh" +#include "message_widget.hh" #include "log_reader.hh" namespace ost { namespace gui { @@ -35,15 +35,15 @@ LogReader::LogReader(QObject* parent) : void LogReader::LogMessage(const String& message, int severity){ if(this->parent()){ - if(InfoWidget* info_widget = qobject_cast<InfoWidget*>(this->parent())){ + if(MessageWidget* message_widget = qobject_cast<MessageWidget*>(this->parent())){ QString q_message(message.c_str()); if(q_message.endsWith("\n")){ q_message.remove(q_message.size()-1,q_message.size()-1); if(!log_cache_.contains(severity)){ - info_widget->LogMessage(q_message,GetIconForSeverity(severity)); + message_widget->LogMessage(q_message,GetIconForSeverity(severity)); } else{ - info_widget->LogMessage(log_cache_[severity]+q_message,GetIconForSeverity(severity)); + message_widget->LogMessage(log_cache_[severity]+q_message,GetIconForSeverity(severity)); log_cache_.remove(severity); } } diff --git a/modules/gui/src/info_widget/log_reader.hh b/modules/gui/src/messages/log_reader.hh similarity index 94% rename from modules/gui/src/info_widget/log_reader.hh rename to modules/gui/src/messages/log_reader.hh index 82e75b6b5..cd16ca3b4 100644 --- a/modules/gui/src/info_widget/log_reader.hh +++ b/modules/gui/src/messages/log_reader.hh @@ -16,8 +16,8 @@ // along with this library; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //------------------------------------------------------------------------------ -#ifndef OST_GUI_INFO_WIDGET_LOG_READER_HH -#define OST_GUI_INFO_WIDGET_LOG_READER_HH +#ifndef OST_GUI_MESSAGES_LOG_READER_HH +#define OST_GUI_MESSAGES_LOG_READER_HH #include <QObject> #include <QMap> diff --git a/modules/gui/src/info_widget/info_widget.cc b/modules/gui/src/messages/message_widget.cc similarity index 84% rename from modules/gui/src/info_widget/info_widget.cc rename to modules/gui/src/messages/message_widget.cc index 4451cc977..ca75845e5 100644 --- a/modules/gui/src/info_widget/info_widget.cc +++ b/modules/gui/src/messages/message_widget.cc @@ -30,24 +30,24 @@ #include <ost/gui/gosty_app.hh> #include "log_reader.hh" -#include "info_widget.hh" +#include "message_widget.hh" namespace ost {namespace gui { -class InfoWidgetFactory: public WidgetFactory { +class MessageWidgetFactory: public WidgetFactory { public: - InfoWidgetFactory() : - WidgetFactory("ost::gui::InfoWidget", "Info Widget") { + MessageWidgetFactory() : + WidgetFactory("ost::gui::MessageWidget", "Messages") { } virtual Widget* Create(QWidget* parent) { - return GostyApp::Instance()->GetInfoWidget(); + return GostyApp::Instance()->GetMessageWidget(); } }; -OST_REGISTER_WIDGET(InfoWidget, InfoWidgetFactory); +OST_REGISTER_WIDGET(MessageWidget, MessageWidgetFactory); -InfoWidget::InfoWidget(QWidget* parent) : +MessageWidget::MessageWidget(QWidget* parent) : Widget(NULL, parent), model_(new QStandardItemModel(this)), view_( new QListView(this)) { QVBoxLayout* layout = new QVBoxLayout(this); @@ -79,11 +79,11 @@ InfoWidget::InfoWidget(QWidget* parent) : new LogReader(this); } -void InfoWidget::Update() { +void MessageWidget::Update() { view_->viewport()->update(); } -void InfoWidget::LogMessage(const QString& message, QMessageBox::Icon icon) { +void MessageWidget::LogMessage(const QString& message, QMessageBox::Icon icon) { QPixmap pix_icon = this->GetIcon(icon, this); QStandardItem* item = new QStandardItem(); item->setText(message); @@ -92,11 +92,11 @@ void InfoWidget::LogMessage(const QString& message, QMessageBox::Icon icon) { this->model_->appendRow(item); } -void InfoWidget::LogMessage(QStandardItem* item) { +void MessageWidget::LogMessage(QStandardItem* item) { this->model_->appendRow(item); } -void InfoWidget::LogMessage(const QString& message, QIcon icon) { +void MessageWidget::LogMessage(const QString& message, QIcon icon) { QStandardItem* item = new QStandardItem(); item->setText(message); item->setIcon(icon); @@ -104,7 +104,7 @@ void InfoWidget::LogMessage(const QString& message, QIcon icon) { this->model_->appendRow(item); } -QPixmap InfoWidget::GetIcon(QMessageBox::Icon icon, QWidget* widget) { +QPixmap MessageWidget::GetIcon(QMessageBox::Icon icon, QWidget* widget) { QStyle *style = widget ? widget->style() : QApplication::style(); int icon_size = style->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, widget); QIcon tmp_icon; @@ -128,11 +128,11 @@ QPixmap InfoWidget::GetIcon(QMessageBox::Icon icon, QWidget* widget) { return QPixmap(); } -void InfoWidget::Clear() { +void MessageWidget::Clear() { this->model_->clear(); } -void InfoWidget::RemoveSelected() { +void MessageWidget::RemoveSelected() { QItemSelectionModel* selection_model = this->view_->selectionModel(); const QItemSelection& item_selection = selection_model->selection(); const QModelIndexList& model_indexes = item_selection.indexes(); @@ -141,11 +141,11 @@ void InfoWidget::RemoveSelected() { } } -ActionList InfoWidget::GetActions() { +ActionList MessageWidget::GetActions() { return this->actions_; } -void InfoWidget::ContextMenuRequested(const QPoint& pos) { +void MessageWidget::ContextMenuRequested(const QPoint& pos) { QAction* remove_selected_action = new QAction("Remove", this); remove_selected_action->setToolTip("Remove this item"); @@ -159,7 +159,7 @@ void InfoWidget::ContextMenuRequested(const QPoint& pos) { } } -InfoWidget::~InfoWidget() { +MessageWidget::~MessageWidget() { } } diff --git a/modules/gui/src/info_widget/info_widget.hh b/modules/gui/src/messages/message_widget.hh similarity index 89% rename from modules/gui/src/info_widget/info_widget.hh rename to modules/gui/src/messages/message_widget.hh index 65857d37d..e430e77b6 100644 --- a/modules/gui/src/info_widget/info_widget.hh +++ b/modules/gui/src/messages/message_widget.hh @@ -16,8 +16,8 @@ // along with this library; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //------------------------------------------------------------------------------ -#ifndef OST_GUI_INFO_WIDGET_INFO_WIDGET_HH -#define OST_GUI_INFO_WIDGET_INFO_WIDGET_HH +#ifndef OST_GUI_MESSAGES_MESSAGE_WIDGET_HH +#define OST_GUI_MESSAGES_MESSAGE_WIDGET_HH #include <QListView> #include <QMessageBox> @@ -32,13 +32,13 @@ namespace ost { namespace gui { -// the display window for all graphical objects -class DLLEXPORT_OST_GUI InfoWidget: public Widget +// the display window for Log Messages +class DLLEXPORT_OST_GUI MessageWidget: public Widget { Q_OBJECT; public: - InfoWidget(QWidget* parent=NULL); - ~InfoWidget(); + MessageWidget(QWidget* parent=NULL); + ~MessageWidget(); public: virtual void LogMessage(const QString& message, QMessageBox::Icon icon=QMessageBox::Information); diff --git a/scripts/init.py b/scripts/init.py index 8c81434cc..263421915 100644 --- a/scripts/init.py +++ b/scripts/init.py @@ -45,7 +45,7 @@ def _InitPanels(app): panels.AddWidgetToPool('ost.gui.RemoteLoader', -1) panels.AddWidgetToPool('ost.gui.SceneWin', 1) panels.AddWidgetToPool('ost.gui.SequenceViewer', 1) - panels.AddWidgetToPool('ost.gui.InfoWidget', 1) + panels.AddWidgetToPool('ost.gui.MessageWidget', 1) if not panels.Restore("ui/perspective/panels"): panels.AddWidget(gui.PanelPosition.LEFT_PANEL, app.scene_win) panels.AddWidgetByName(gui.PanelPosition.LEFT_PANEL, -- GitLab