Skip to content

Commit 2049032

Browse files
committed
Merge branch 'master' into modules_W
2 parents 2a4f1c9 + 32af9d6 commit 2049032

24 files changed

+777
-660
lines changed

src/Core/Application/Preferences/Preferences.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Preferences::Preferences() :
4646
useNewViewSceneMouseControls("useNewViewSceneMouseControls", false),
4747
modulesSnapToGrid("modulesSnapToGrid", true),
4848
highlightPorts("highlightPorts", false),
49+
autoNotes("autoNotes", false),
4950
modulesAreDockable("modulesAreDockable", true),
5051
networkBackgroundColor("backgroundColor", "#808080")
5152
{

src/Core/Application/Preferences/Preferences.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ namespace SCIRun
8080
BooleanVariable useNewViewSceneMouseControls;
8181
BooleanVariable modulesSnapToGrid;
8282
BooleanVariable highlightPorts;
83+
BooleanVariable autoNotes;
8384
TrackedVariable<BooleanVariable> modulesAreDockable;
8485
StringVariable networkBackgroundColor;
8586

src/Interface/Application/Connection.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ ConnectionLine::ConnectionLine(PortWidget* fromPort, PortWidget* toPort, const S
266266
setPositionObject(boost::make_shared<MidpointPositioner>(fromPort_->getPositionObject(), toPort_->getPositionObject()));
267267

268268
trackNodes();
269-
GuiLogger::Instance().logStd("Connection made: " + id_.id_);
269+
GuiLogger::Instance().logInfoStd("Connection made: " + id_.id_);
270270
}
271271

272272
ConnectionLine::~ConnectionLine()
@@ -443,7 +443,7 @@ void DataInfoDialog::show(PortDataDescriber portDataDescriber, const QString& la
443443
msgBox->setStandardButtons(QMessageBox::Ok);
444444
msgBox->setWindowTitle(label + " Data info: " + QString::fromStdString(id));
445445
msgBox->setText(info);
446-
msgBox->setModal(false);
446+
msgBox->setModal(false);
447447
msgBox->show();
448448
}
449449

@@ -500,8 +500,8 @@ QPointF MidpointPositioner::currentPosition() const
500500
return (p1_->currentPosition() + p2_->currentPosition()) / 2;
501501
}
502502

503-
ConnectionFactory::ConnectionFactory(QGraphicsScene* scene) :
504-
currentType_(EUCLIDEAN),
503+
ConnectionFactory::ConnectionFactory(QGraphicsScene* scene) :
504+
currentType_(EUCLIDEAN),
505505
visible_(true),
506506
scene_(scene),
507507
euclidean_(new EuclideanDrawStrategy),

src/Interface/Application/GuiCommands.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ std::ostream& operator<<(std::ostream& o, const std::pair<T1,T2>& p)
144144
bool FileOpenCommand::execute()
145145
{
146146
if (!filename_.empty())
147-
GuiLogger::Instance().log("Attempting load of " + QString::fromStdString(filename_));
147+
GuiLogger::Instance().logInfo("Attempting load of " + QString::fromStdString(filename_));
148148

149149
try
150150
{
@@ -179,31 +179,31 @@ bool FileOpenCommand::execute()
179179
QPointF center = findCenterOfNetworkFile(*openedFile_);
180180
networkEditor_->centerOn(center);
181181

182-
GuiLogger::Instance().log("File load done.");
182+
GuiLogger::Instance().logInfo("File load done.");
183183
return true;
184184
}
185185
else
186186
{
187187
if (!filename_.empty())
188188
{
189-
GuiLogger::Instance().log("File load failed: null xml returned.");
189+
GuiLogger::Instance().logErrorStd("File load failed (" + filename_ + "): null xml returned.");
190190
}
191191
}
192192
}
193193
catch (ExceptionBase& e)
194194
{
195195
if (!filename_.empty())
196-
GuiLogger::Instance().log("File load failed: exception in load_xml, " + QString(e.what()));
196+
GuiLogger::Instance().logError("File load failed: exception in load_xml, " + QString(e.what()));
197197
}
198198
catch (std::exception& ex)
199199
{
200200
if (!filename_.empty())
201-
GuiLogger::Instance().log("File load failed: exception in load_xml, " + QString(ex.what()));
201+
GuiLogger::Instance().logError("File load failed: exception in load_xml, " + QString(ex.what()));
202202
}
203203
catch (...)
204204
{
205205
if (!filename_.empty())
206-
GuiLogger::Instance().log("File load failed: Unknown exception in load_xml.");
206+
GuiLogger::Instance().logError("File load failed: Unknown exception in load_xml.");
207207
}
208208
return false;
209209
}

src/Interface/Application/GuiLogger.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,14 @@ void SCIRun::Gui::GuiLogger::setInstance(LoggerHandle logger)
4444
loggerImpl_ = logger;
4545
}
4646

47-
void GuiLogger::log(const QString& message) const
47+
void GuiLogger::logInfo(const QString& message) const
4848
{
4949
if (loggerImpl_)
5050
loggerImpl_->status(message.toStdString());
51-
}
51+
}
52+
53+
void GuiLogger::logError(const QString& message) const
54+
{
55+
if (loggerImpl_)
56+
loggerImpl_->error(message.toStdString());
57+
}

src/Interface/Application/GuiLogger.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ namespace Gui {
4141
{
4242
CORE_SINGLETON(GuiLogger)
4343
public:
44-
void log(const QString& message) const;
45-
void logStd(const std::string& message) const { log(QString::fromStdString(message)); }
44+
void logInfo(const QString& message) const;
45+
void logError(const QString& message) const;
46+
void logInfoStd(const std::string& message) const { logInfo(QString::fromStdString(message)); }
47+
void logErrorStd(const std::string& message) const { logError(QString::fromStdString(message)); }
4648
static void setInstance(Core::Logging::LoggerHandle logger);
4749
private:
4850
GuiLogger();
@@ -51,4 +53,4 @@ namespace Gui {
5153

5254
}}
5355

54-
#endif
56+
#endif

src/Interface/Application/MainWindowCollaborators.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,23 @@ void TextEditAppender::log(const QString& message) const
4343

4444
void TextEditAppender::error(const std::string& msg) const
4545
{
46-
//log("Error: " + QString::fromStdString(msg));
4746
Log::get() << ERROR_LOG << msg << std::endl;
4847
}
4948

5049
void TextEditAppender::warning(const std::string& msg) const
5150
{
52-
//log("Warning: " + QString::fromStdString(msg));
5351
Log::get() << WARN << msg << std::endl;
5452
}
5553

5654
void TextEditAppender::remark(const std::string& msg) const
5755
{
58-
//log("Remark: " + QString::fromStdString(msg));
5956
Log::get() << NOTICE << msg << std::endl;
6057
}
6158

6259
void TextEditAppender::status(const std::string& msg) const
6360
{
64-
//log(QString::fromStdString(msg));
65-
Log::get() << INFO << msg << std::endl;
61+
auto level = regressionMode_ ? INFO : DEBUG_LOG;
62+
Log::get() << level << msg << std::endl;
6663
}
6764

6865
void TextEditAppender::log4(const std::string& message) const

src/Interface/Application/MainWindowCollaborators.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ namespace Gui {
5252
class TextEditAppender : public Core::Logging::LegacyLoggerInterface, public Core::Logging::LogAppenderStrategy
5353
{
5454
public:
55-
explicit TextEditAppender(QTextEdit* text) : text_(text) {}
55+
explicit TextEditAppender(QTextEdit* text, bool regressionMode = false) :
56+
text_(text), regressionMode_(regressionMode) {}
5657

5758
void log(const QString& message) const;
5859

@@ -65,6 +66,7 @@ namespace Gui {
6566
private:
6667
QTextEdit* text_;
6768
mutable QMutex mutex_;
69+
bool regressionMode_;
6870
};
6971

7072
class TreeViewModuleGetter : public CurrentModuleSelection
@@ -156,7 +158,7 @@ namespace Gui {
156158
private Q_SLOTS:
157159
void showMessageBox();
158160
void saveToolkit();
159-
161+
160162
private:
161163
void downloadIcon(); //TODO: cache somehow
162164
FileDownloader* iconDownloader_;

src/Interface/Application/ModuleWidget.cc

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,12 +1093,22 @@ void ModuleWidget::makeOptionsDialog()
10931093
dockable_->setFloating(!Core::Preferences::Instance().modulesAreDockable);
10941094
dockable_->hide();
10951095
connect(dockable_, SIGNAL(visibilityChanged(bool)), this, SLOT(colorOptionsButton(bool)));
1096+
connect(dockable_, SIGNAL(topLevelChanged(bool)), this, SLOT(updateDockWidgetProperties(bool)));
10961097

10971098
dialog_->pull();
10981099
}
10991100
}
11001101
}
11011102

1103+
void ModuleWidget::updateDockWidgetProperties(bool isFloating)
1104+
{
1105+
if (isFloating)
1106+
{
1107+
dockable_->setWindowFlags(Qt::Window);
1108+
dockable_->show();
1109+
}
1110+
}
1111+
11021112
void ModuleWidget::updateDialogWithPortCount(const std::string& portName)
11031113
{
11041114
if (dialog_)
@@ -1186,15 +1196,18 @@ void ModuleWidget::launchDocumentation()
11861196
QUrl qurl(QString::fromStdString(url), QUrl::TolerantMode);
11871197

11881198
if (!QDesktopServices::openUrl(qurl))
1189-
GuiLogger::Instance().log("Failed to open help page: " + qurl.toString());
1199+
GuiLogger::Instance().logError("Failed to open help page: " + qurl.toString());
11901200
}
11911201

11921202
void ModuleWidget::setStartupNote(const QString& text)
11931203
{
1194-
auto note = getCurrentNote();
1195-
note.plainText_ = text;
1196-
note.html_ = "<p style=\"color:white\">" + text;
1197-
updateNoteFromFile(note);
1204+
if (isViewScene_ || Core::Preferences::Instance().autoNotes)
1205+
{
1206+
auto note = getCurrentNote();
1207+
note.plainText_ = text;
1208+
note.html_ = "<p style=\"color:white\">" + text;
1209+
updateNoteFromFile(note);
1210+
}
11981211
}
11991212

12001213
void ModuleWidget::createStartupNote()

src/Interface/Application/ModuleWidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ private Q_SLOTS:
193193
void handleDialogFatalError(const QString& message);
194194
void changeExecuteButtonToPlay();
195195
void changeExecuteButtonToStop();
196+
void updateDockWidgetProperties(bool isFloating);
196197
private:
197198
ModuleWidgetDisplayBase* currentDisplay_;
198199
ModuleWidgetDisplayPtr fullWidgetDisplay_;

0 commit comments

Comments
 (0)