Skip to content

Commit

Permalink
Use the GDB path defined in settings unless user specify something.
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Dec 1, 2016
1 parent 9fb1bc8 commit b947d01
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 31 deletions.
21 changes: 16 additions & 5 deletions OMEdit/OMEditGUI/Debugger/DebuggerConfigurationsDialog.cpp
Expand Up @@ -36,6 +36,7 @@
#include "Debugger/GDB/GDBAdapter.h"
#include "Util/Helper.h"
#include "Util/StringHandler.h"
#include "Options/OptionsDialog.h"

#include <QGridLayout>
#include <QMessageBox>
Expand Down Expand Up @@ -75,6 +76,7 @@ DebuggerConfigurationPage::DebuggerConfigurationPage(DebuggerConfiguration debug
// GDB Path
mpGDBPathLabel = new Label(tr("GDB Path:"));
mpGDBPathTextBox = new QLineEdit(mDebuggerConfiguration.GDBPath);
mpGDBPathTextBox->setPlaceholderText(OptionsDialog::instance()->getDebuggerPage()->getGDBPath());
mpGDBPathBrowseButton = new QPushButton(Helper::browse);
connect(mpGDBPathBrowseButton, SIGNAL(clicked()), SLOT(browseGDBPath()));
// Arguments
Expand Down Expand Up @@ -105,9 +107,12 @@ DebuggerConfigurationPage::DebuggerConfigurationPage(DebuggerConfiguration debug
pContainerFrameGridLayout->addWidget(mpGDBPathLabel, 4, 0);
pContainerFrameGridLayout->addWidget(mpGDBPathTextBox, 4, 1);
pContainerFrameGridLayout->addWidget(mpGDBPathBrowseButton, 4, 2);
pContainerFrameGridLayout->addWidget(mpArgumentsLabel, 5, 0, 1, 3);
pContainerFrameGridLayout->addWidget(mpArgumentsTextBox, 6, 0, 1, 3);
pContainerFrameGridLayout->addWidget(mpButtonBox, 7, 0, 1, 3, Qt::AlignRight);
pContainerFrameGridLayout->addItem(new QSpacerItem(1, 1), 5, 0);
pContainerFrameGridLayout->addWidget(new Label(tr("GDB path defined in %1->Debugger is used if above field is empty.")
.arg(Helper::toolsOptionsPath)), 5, 1, 1, 2);
pContainerFrameGridLayout->addWidget(mpArgumentsLabel, 6, 0, 1, 3);
pContainerFrameGridLayout->addWidget(mpArgumentsTextBox, 7, 0, 1, 3);
pContainerFrameGridLayout->addWidget(mpButtonBox, 8, 0, 1, 3, Qt::AlignRight);
pContainerFrame->setLayout(pContainerFrameGridLayout);
// main layout
QGridLayout *pMainLayout = new QGridLayout;
Expand Down Expand Up @@ -393,7 +398,7 @@ void DebuggerConfigurationsDialog::newConfiguration()
// create a new DebuggerConfigurationPage
DebuggerConfiguration debuggerConfiguration;
debuggerConfiguration.name = getUniqueName();
debuggerConfiguration.GDBPath = pSettings->value("algorithmicDebugger/GDBPath").toString();
debuggerConfiguration.GDBPath = OptionsDialog::instance()->getDebuggerPage()->getGDBPathForSettings();
// create a new list item
QListWidgetItem *pListWidgetItem = new QListWidgetItem(mpConfigurationsListWidget);
pListWidgetItem->setIcon(QIcon(":/Resources/icons/debugger.svg"));
Expand Down Expand Up @@ -506,8 +511,14 @@ void DebuggerConfigurationsDialog::saveAllConfigurationsAndDebugConfiguration()
} else {
DebuggerConfigurationPage *pDebuggerConfigurationPage = qobject_cast<DebuggerConfigurationPage*>(mpConfigurationPagesWidget->currentWidget());
DebuggerConfiguration debuggerConfiguration = pDebuggerConfigurationPage->getDebuggerConfiguration();
QString gdbPath = "";
if (debuggerConfiguration.GDBPath.isEmpty()) {
gdbPath = OptionsDialog::instance()->getDebuggerPage()->getGDBPath();
} else {
gdbPath = debuggerConfiguration.GDBPath;
}
GDBAdapter::instance()->launch(debuggerConfiguration.program, debuggerConfiguration.workingDirectory,
debuggerConfiguration.arguments.split(" "), debuggerConfiguration.GDBPath);
debuggerConfiguration.arguments.split(" "), gdbPath);
emit debuggerLaunched();
}
}
Expand Down
14 changes: 2 additions & 12 deletions OMEdit/OMEditGUI/MainWindow.cpp
Expand Up @@ -822,12 +822,7 @@ void MainWindow::fetchInterfaceData(LibraryTreeItem *pLibraryTreeItem)
}
}
if (OptionsDialog::instance()->getTLMPage()->getTLMManagerProcessTextBox()->text().isEmpty()) {
QString message;
#ifdef Q_OS_MAC
message = GUIMessages::getMessage(GUIMessages::TLMMANAGER_NOT_SET).arg(Helper::toolsOptionsPathMAC);
#else
message = GUIMessages::getMessage(GUIMessages::TLMMANAGER_NOT_SET).arg(Helper::toolsOptionsPath);
#endif
QString message = GUIMessages::getMessage(GUIMessages::TLMMANAGER_NOT_SET).arg(Helper::toolsOptionsPath);
QMessageBox::information(this, QString(Helper::applicationName).append(" - ").append(Helper::information), message, Helper::ok);
} else {
if (pLibraryTreeItem->isSaved()) {
Expand Down Expand Up @@ -1992,12 +1987,7 @@ void MainWindow::openTerminal()
{
QString terminalCommand = OptionsDialog::instance()->getGeneralSettingsPage()->getTerminalCommand();
if (terminalCommand.isEmpty()) {
QString message;
#ifdef Q_OS_MAC
message = GUIMessages::getMessage(GUIMessages::TERMINAL_COMMAND_NOT_SET).arg(Helper::toolsOptionsPathMAC);
#else
message = GUIMessages::getMessage(GUIMessages::TERMINAL_COMMAND_NOT_SET).arg(Helper::toolsOptionsPath);
#endif
QString message = GUIMessages::getMessage(GUIMessages::TERMINAL_COMMAND_NOT_SET).arg(Helper::toolsOptionsPath);
MessagesWidget::instance()->addGUIMessage(MessageItem(MessageItem::Modelica, "", false, 0, 0, 0, 0, message, Helper::scriptingKind,
Helper::errorLevel));
return;
Expand Down
Expand Up @@ -933,12 +933,7 @@ void TransformationsWidget::fetchOperations(const OMVariable &variable)
mpVariableOperationsTreeWidget->setItemWidget(pOperationTreeItem, 0, opText);
}
} else {
QString message;
#ifdef Q_OS_MAC
message = GUIMessages::getMessage(GUIMessages::SET_INFO_XML_FLAG).arg(Helper::toolsOptionsPathMAC).arg(Helper::toolsOptionsPathMAC);
#else
message = GUIMessages::getMessage(GUIMessages::SET_INFO_XML_FLAG).arg(Helper::toolsOptionsPath).arg(Helper::toolsOptionsPath);
#endif
QString message = GUIMessages::getMessage(GUIMessages::SET_INFO_XML_FLAG).arg(Helper::toolsOptionsPath).arg(Helper::toolsOptionsPath);
QStringList values;
values << message;
QString toolTip = message;
Expand Down Expand Up @@ -1130,12 +1125,7 @@ void TransformationsWidget::fetchOperations(OMEquation *equation)
mpEquationOperationsTreeWidget->setItemWidget(pOperationTreeItem, 0, opText);
}
} else {
QString message;
#ifdef Q_OS_MAC
message = GUIMessages::getMessage(GUIMessages::SET_INFO_XML_FLAG).arg(Helper::toolsOptionsPathMAC).arg(Helper::toolsOptionsPathMAC);
#else
message = GUIMessages::getMessage(GUIMessages::SET_INFO_XML_FLAG).arg(Helper::toolsOptionsPath).arg(Helper::toolsOptionsPath);
#endif
QString message = GUIMessages::getMessage(GUIMessages::SET_INFO_XML_FLAG).arg(Helper::toolsOptionsPath).arg(Helper::toolsOptionsPath);
QStringList values;
values << message;
QString toolTip = message;
Expand Down
5 changes: 4 additions & 1 deletion OMEdit/OMEditGUI/Util/Helper.cpp
Expand Up @@ -88,8 +88,11 @@ QString Helper::textOutput = "Text";
QString Helper::utf8 = "UTF-8";
QFontInfo Helper::systemFontInfo = QFontInfo(QFont());
QFontInfo Helper::monospacedFontInfo = QFontInfo(QFont());
#ifdef Q_OS_MAC
QString Helper::toolsOptionsPath = "OMEdit->Preferences";
#else
QString Helper::toolsOptionsPath = "Tools->Options";
QString Helper::toolsOptionsPathMAC = "OMEdit->Preferences";
#endif
/* Meta Modelica Types */
QString Helper::MODELICA_METATYPE = QString("modelica_metatype");
QString Helper::MODELICA_STRING = QString("modelica_string");
Expand Down
1 change: 0 additions & 1 deletion OMEdit/OMEditGUI/Util/Helper.h
Expand Up @@ -95,7 +95,6 @@ class Helper : public QObject
static QFontInfo systemFontInfo;
static QFontInfo monospacedFontInfo;
static QString toolsOptionsPath;
static QString toolsOptionsPathMAC;
/* Meta Modelica Types */
static QString MODELICA_METATYPE;
static QString MODELICA_STRING;
Expand Down

0 comments on commit b947d01

Please sign in to comment.