13 #include <QMessageBox> 15 #include "../include/%(package)s/main_window.hpp" 29 MainWindow::MainWindow(
int argc,
char** argv, QWidget *parent)
34 QObject::connect(
ui.actionAbout_Qt, SIGNAL(triggered(
bool)), qApp, SLOT(aboutQt()));
37 setWindowIcon(QIcon(
":/images/icon.png"));
38 ui.tab_manager->setCurrentIndex(0);
39 QObject::connect(&
qnode, SIGNAL(rosShutdown()),
this, SLOT(close()));
50 if (
ui.checkbox_remember_settings->isChecked() ) {
63 msgBox.setText(
"Couldn't find the ros master.");
74 if (
ui.checkbox_use_environment->isChecked() ) {
78 ui.button_connect->setEnabled(
false);
81 if ( !
qnode.
init(
ui.line_edit_master->text().toStdString(),
82 ui.line_edit_host->text().toStdString()) ) {
85 ui.button_connect->setEnabled(
false);
86 ui.line_edit_master->setReadOnly(
true);
87 ui.line_edit_host->setReadOnly(
true);
88 ui.line_edit_topic->setReadOnly(
true);
101 ui.line_edit_master->setEnabled(enabled);
102 ui.line_edit_host->setEnabled(enabled);
116 ui.view_logging->scrollToBottom();
124 QMessageBox::about(
this, tr(
"About ..."),tr(
"<h2>PACKAGE_NAME Test Program 0.10</h2><p>Copyright Yujin Robot</p><p>This package needs an about description.</p>"));
132 QSettings settings(
"Qt-Ros Package",
"%(package)s");
133 restoreGeometry(settings.value(
"geometry").toByteArray());
134 restoreState(settings.value(
"windowState").toByteArray());
135 QString master_url = settings.value(
"master_url",QString(
"http://192.168.1.2:11311/")).toString();
136 QString host_url = settings.value(
"host_url", QString(
"192.168.1.3")).toString();
138 ui.line_edit_master->setText(master_url);
139 ui.line_edit_host->setText(host_url);
141 bool remember = settings.value(
"remember_settings",
false).toBool();
142 ui.checkbox_remember_settings->setChecked(remember);
143 bool checked = settings.value(
"use_environment_variables",
false).toBool();
144 ui.checkbox_use_environment->setChecked(checked);
146 ui.line_edit_master->setEnabled(
false);
147 ui.line_edit_host->setEnabled(
false);
153 QSettings settings(
"Qt-Ros Package",
"%(package)s");
154 settings.setValue(
"master_url",
ui.line_edit_master->text());
155 settings.setValue(
"host_url",
ui.line_edit_host->text());
157 settings.setValue(
"use_environment_variables",QVariant(
ui.checkbox_use_environment->isChecked()));
158 settings.setValue(
"geometry", saveGeometry());
159 settings.setValue(
"windowState", saveState());
160 settings.setValue(
"remember_settings",QVariant(
ui.checkbox_remember_settings->isChecked()));
167 QMainWindow::closeEvent(event);
void on_actionAbout_triggered()
void on_button_connect_clicked(bool check)
void showNoMasterMessage()
QStringListModel * loggingModel()
void on_checkbox_use_environment_stateChanged(int state)
void closeEvent(QCloseEvent *event)