Commit 4bb0d7a3 authored by Tobias WEBER's avatar Tobias WEBER
Browse files

a) prevented plugin double-loading, b) colours

parent b4640a61
......@@ -864,6 +864,12 @@ void GlPlot_impl::paintGL()
// qt painting
{
QFont fontOrig = painter.font();
QPen penOrig = painter.pen();
QPen penLabel(Qt::black);
painter.setPen(penLabel);
// coordinate labels
painter.drawText(GlToScreenCoords(m::create<t_vec_gl>({0.,0.,0.,1.})), "0");
for(t_real_gl f=-2.; f<=2.; f+=0.5)
......@@ -893,8 +899,6 @@ void GlPlot_impl::paintGL()
t_vec3_gl posLabel3d = obj.m_mat * obj.m_labelPos;
auto posLabel2d = GlToScreenCoords(m::create<t_vec_gl>({posLabel3d[0], posLabel3d[1], posLabel3d[2], 1.}));
QFont fontOrig = painter.font();
QPen penOrig = painter.pen();
QFont fontLabel = fontOrig;
QPen penLabel = penOrig;
......@@ -911,12 +915,12 @@ void GlPlot_impl::paintGL()
painter.setFont(fontLabel);
painter.setPen(penLabel);
painter.drawText(posLabel2d, obj.m_label.c_str());
// restore original styles
painter.setFont(fontOrig);
painter.setPen(penOrig);
}
}
// restore original styles
painter.setFont(fontOrig);
painter.setPen(penOrig);
}
}
else
......
......@@ -146,9 +146,12 @@ void CommandLineWidget::CommandEntered()
m_pEditCLI->clearEditText();
if(!cmd.length()) return;
bool bLightTheme = palette().color(QPalette::WindowText).lightnessF() < 0.5;
QString colInput = bLightTheme ? "#0000ff" : "#ffff00";
std::string timestamp = tl2::epoch_to_str(tl2::epoch());
m_pEditHistory->insertHtml("<b><font color=\"#008800\">" + QString(timestamp.c_str()) + "&gt;</font> " +
"<font color=\"#0000ff\">" + cmd + "</font></b><br>");
"<font color=\"" + colInput + "\">" + cmd + "</font></b><br>");
// parse command
......@@ -226,10 +229,12 @@ void CommandLineWidget::ScrollToEnd()
void CommandLineWidget::PrintOutputString(bool is_err, const QString &str)
{
QString colText = palette().color(QPalette::WindowText).name();
if(is_err)
m_pEditHistory->insertHtml("<b><font color=\"#ff0000\">" + str + "</font></b><br>");
else
m_pEditHistory->insertHtml("<font color=\"#000000\">" + str + "</font><br>");
m_pEditHistory->insertHtml("<font color=\"" + colText + "\">" + str + "</font><br>");
ScrollToEnd();
}
......
......@@ -406,7 +406,8 @@ void MainWnd::LoadPlugins()
{
m_pmenuPluginTools = new QMenu("Tools", m_pMenu);
std::vector<QString> plugindirs{{ "plugins", "../plugins", qApp->applicationDirPath()+"/plugins" }};
std::vector<QString> plugindirs{{ "plugins", "../plugins",
qApp->applicationDirPath()+"/plugins", qApp->applicationDirPath()+"/../plugins" }};
for(const auto& plugindir : plugindirs)
{
print_out("Looking for plugins in \"", plugindir.toStdString(), "\"...");
......@@ -453,6 +454,14 @@ void MainWnd::LoadPlugins()
plugin.name = vecdescr[1];
plugin.descr = vecdescr[2];
// skip plugin if another one with the same name is already registered
if(std::find_if(m_plugin_dlgs.begin(), m_plugin_dlgs.end(),
[&plugin](const PluginDlg& otherplugin) -> bool
{
return otherplugin.name == plugin.name;
}) != m_plugin_dlgs.end())
continue;
// add menu item
auto *acTool = new QAction(plugin.name.c_str(), m_pMenu);
acTool->setToolTip(plugin.descr.c_str());
......@@ -518,4 +527,4 @@ void MainWnd::UnloadPlugins()
}
m_plugin_dlgs.clear();
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment