Commit f27e3b7a authored by pixhawk's avatar pixhawk

Fixed custom widgets, now working as expected with default config

parent 126ad85e
[PIXHAWK%20Quadrotor%20Commands]
QGC_TOOL_WIDGET_ITEMS\1\TYPE=BUTTON
QGC_TOOL_WIDGET_ITEMS\1\QGC_ACTION_BUTTON_DESCRIPTION=CALIBRATE GYRO
QGC_TOOL_WIDGET_ITEMS\1\QGC_ACTION_BUTTON_BUTTONTEXT=Calibrate
QGC_TOOL_WIDGET_ITEMS\1\QGC_ACTION_BUTTON_ACTIONID=17
QGC_TOOL_WIDGET_ITEMS\2\TYPE=BUTTON
QGC_TOOL_WIDGET_ITEMS\2\QGC_ACTION_BUTTON_DESCRIPTION=Record logfile and images
QGC_TOOL_WIDGET_ITEMS\2\QGC_ACTION_BUTTON_BUTTONTEXT=Start
QGC_TOOL_WIDGET_ITEMS\2\QGC_ACTION_BUTTON_ACTIONID=21
QGC_TOOL_WIDGET_ITEMS\3\TYPE=BUTTON
QGC_TOOL_WIDGET_ITEMS\3\QGC_ACTION_BUTTON_DESCRIPTION=Stop recording
QGC_TOOL_WIDGET_ITEMS\3\QGC_ACTION_BUTTON_BUTTONTEXT=Stop
QGC_TOOL_WIDGET_ITEMS\3\QGC_ACTION_BUTTON_ACTIONID=23
QGC_TOOL_WIDGET_ITEMS\size=3
......@@ -84,6 +84,8 @@ macx {
# Copy audio files if needed
QMAKE_POST_LINK += && cp -rf $$BASEDIR/audio $$TARGETDIR/qgroundcontrol.app/Contents/MacOS
# Copy contributed files
QMAKE_POST_LINK += && cp -rf $$BASEDIR/files $$TARGETDIR/qgroundcontrol.app/Contents/MacOS
# Copy google earth starter file
QMAKE_POST_LINK += && cp -f $$BASEDIR/images/earth.html $$TARGETDIR/qgroundcontrol.app/Contents/MacOS
# Copy CSS stylesheets
......@@ -219,6 +221,10 @@ message("Compiling for linux 32")
DEFINES += QGC_LIBFREENECT_ENABLED
}
# Validated copy commands
QMAKE_POST_LINK += && cp -rf $$BASEDIR/audio $$DESTDIR
QMAKE_POST_LINK += && cp -rf $$BASEDIR/files $$DESTDIR
QMAKE_POST_LINK += && cp -rf $$BASEDIR/models $$DESTDIR
QMAKE_POST_LINK += && cp -rf $$BASEDIR/data $$DESTDIR
QMAKE_POST_LINK += && mkdir -p $$DESTDIR/images
......@@ -293,6 +299,10 @@ linux-g++-64 {
DEFINES += QGC_LIBFREENECT_ENABLED
}
# Validated copy commands
QMAKE_POST_LINK += && cp -rf $$BASEDIR/audio $$DESTDIR
QMAKE_POST_LINK += && cp -rf $$BASEDIR/files $$DESTDIR
QMAKE_POST_LINK += && cp -rf $$BASEDIR/models $$DESTDIR
QMAKE_POST_LINK += && cp -rf $$BASEDIR/data $$DESTDIR
QMAKE_POST_LINK += && mkdir -p $$DESTDIR/images
......@@ -369,6 +379,7 @@ DEFINES += QGC_OSG_ENABLED
exists($$TARGETDIR/debug) {
QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\audio" "$$TARGETDIR_WIN\\debug\\audio" /E /I $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\files" "$$TARGETDIR_WIN\\debug\\files" /E /I $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\models" "$$TARGETDIR_WIN\\debug\\models" /E /I $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\images\\earth.html" "$$TARGETDIR_WIN\\debug"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /Y "$$(QTDIR)\\plugins" "$$TARGETDIR_WIN\\debug" /E /I /EXCLUDE:copydebug.txt $$escape_expand(\\n))
......@@ -388,6 +399,7 @@ DEFINES += QGC_OSG_ENABLED
exists($$TARGETDIR/release) {
QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\lib\\sdl\\win32\\SDL.dll" "$$TARGETDIR_WIN\\release"$$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\audio" "$$TARGETDIR_WIN\\release\\audio" /E /I $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\files" "$$TARGETDIR_WIN\\release\\files" /E /I $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /Y "$$BASEDIR_WIN\\models" "$$TARGETDIR_WIN\\release\\models" /E /I $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(copy /Y "$$BASEDIR_WIN\\images\\earth.html" "$$TARGETDIR_WIN\\release\\earth.html" $$escape_expand(\\n))
QMAKE_POST_LINK += $$quote(xcopy /Y "$$(QTDIR)\\plugins" "$$TARGETDIR_WIN\\release" /E /I /EXCLUDE:copyrelease.txt $$escape_expand(\\n))
......
......@@ -326,9 +326,6 @@ void MainWindow::buildCustomWidget()
// Show custom widgets only if UAS is connected
if (UASManager::instance()->getActiveUAS() != NULL)
{
// Enable custom widgets
ui.actionNewCustomWidget->setEnabled(true);
// Create custom widgets
QList<QGCToolWidget*> widgets = QGCToolWidget::createWidgetsFromSettings(this);
......@@ -355,9 +352,6 @@ void MainWindow::buildCustomWidget()
widgets.at(i)->setMainMenuAction(showAction);
ui.menuTools->addAction(showAction);
// // Load visibility for view (default is off)
// dock->setVisible(tool->isVisible(currentView));
// Load dock widget location (default is bottom)
Qt::DockWidgetArea location = static_cast <Qt::DockWidgetArea>(tool->getDockWidgetArea(currentView));
......@@ -685,7 +679,7 @@ void MainWindow::loadCustomWidget()
{
QString widgetFileExtension(".qgw");
QString fileName = QFileDialog::getOpenFileName(this, tr("Specify Widget File Name"), QDesktopServices::storageLocation(QDesktopServices::DesktopLocation), tr("QGroundControl Widget (*%1);;").arg(widgetFileExtension));
loadCustomWidget(fileName);
if (fileName != "") loadCustomWidget(fileName);
}
void MainWindow::loadCustomWidget(const QString& fileName, bool singleinstance)
......@@ -699,7 +693,7 @@ void MainWindow::loadCustomWidget(const QString& fileName, bool singleinstance)
dock->setWidget(tool);
tool->setParent(dock);
QAction* showAction = new QAction("Show Unnamed Tool", this);
QAction* showAction = new QAction(tool->getTitle(), this);
showAction->setCheckable(true);
connect(dock, SIGNAL(visibilityChanged(bool)), showAction, SLOT(setChecked(bool)));
connect(showAction, SIGNAL(triggered(bool)), dock, SLOT(setVisible(bool)));
......@@ -734,7 +728,8 @@ void MainWindow::loadCustomWidgetsFromDefaults(const QString& systemType, const
{
// Will only be loaded if not already a custom widget with
// the same name is present
loadCustomWidget(file, true);
qDebug() << "Tried to load file: " << file;
loadCustomWidget(defaultsDir+"/"+file, true);
}
}
}
......@@ -776,9 +771,11 @@ void MainWindow::configureWindowName()
windowname.append(" (" + QHostInfo::localHostName() + ": ");
for (int i = 0; i < hostAddresses.size(); i++) {
for (int i = 0; i < hostAddresses.size(); i++)
{
// Exclude loopback IPv4 and all IPv6 addresses
if (hostAddresses.at(i) != QHostAddress("127.0.0.1") && !hostAddresses.at(i).toString().contains(":")) {
if (hostAddresses.at(i) != QHostAddress("127.0.0.1") && !hostAddresses.at(i).toString().contains(":"))
{
if(prevAddr) windowname.append("/");
windowname.append(hostAddresses.at(i).toString());
prevAddr = true;
......@@ -823,7 +820,8 @@ void MainWindow::saveScreen()
QPixmap window = QPixmap::grabWindow(this->winId());
QString format = "bmp";
if (!screenFileName.isEmpty()) {
if (!screenFileName.isEmpty())
{
window.save(screenFileName, format.toAscii());
}
}
......@@ -969,8 +967,6 @@ void MainWindow::showInfoMessage(const QString& title, const QString& message)
**/
void MainWindow::connectCommonActions()
{
ui.actionNewCustomWidget->setEnabled(false);
// Bind together the perspective actions
QActionGroup* perspectives = new QActionGroup(ui.menuPerspectives);
perspectives->addAction(ui.actionEngineersView);
......@@ -987,11 +983,6 @@ void MainWindow::connectCommonActions()
if (currentView == VIEW_OPERATOR) ui.actionOperatorsView->setChecked(true);
if (currentView == VIEW_UNCONNECTED) ui.actionUnconnectedView->setChecked(true);
// The pilot, engineer and operator view are not available on startup
// since they only make sense with a system connected.
ui.actionPilotsView->setEnabled(false);
ui.actionOperatorsView->setEnabled(false);
ui.actionEngineersView->setEnabled(false);
// The UAS actions are not enabled without connection to system
ui.actionLiftoff->setEnabled(false);
ui.actionLand->setEnabled(false);
......
......@@ -51,7 +51,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>22</height>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuMGround">
......@@ -152,7 +152,7 @@
<widget class="QStatusBar" name="statusBar"/>
<action name="actionExit">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/actions/system-log-out.svg</normaloff>:/images/actions/system-log-out.svg</iconset>
</property>
<property name="text">
......@@ -167,7 +167,7 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/control/launch.svg</normaloff>
<normalon>:/images/control/launch.svg</normalon>:/images/control/launch.svg</iconset>
</property>
......@@ -177,7 +177,7 @@
</action>
<action name="actionLand">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/control/land.svg</normaloff>:/images/control/land.svg</iconset>
</property>
<property name="text">
......@@ -186,7 +186,7 @@
</action>
<action name="actionEmergency_Land">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/actions/process-stop.svg</normaloff>:/images/actions/process-stop.svg</iconset>
</property>
<property name="text">
......@@ -198,7 +198,7 @@
</action>
<action name="actionEmergency_Kill">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/actions/process-stop.svg</normaloff>:/images/actions/process-stop.svg</iconset>
</property>
<property name="text">
......@@ -210,7 +210,7 @@
</action>
<action name="actionAdd_Link">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/actions/list-add.svg</normaloff>:/images/actions/list-add.svg</iconset>
</property>
<property name="text">
......@@ -219,7 +219,7 @@
</action>
<action name="actionConfiguration">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/categories/applications-system.svg</normaloff>:/images/categories/applications-system.svg</iconset>
</property>
<property name="text">
......@@ -231,7 +231,7 @@
</action>
<action name="actionJoystickSettings">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/devices/input-gaming.svg</normaloff>:/images/devices/input-gaming.svg</iconset>
</property>
<property name="text">
......@@ -246,7 +246,7 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/control/launch.svg</normaloff>:/images/control/launch.svg</iconset>
</property>
<property name="text">
......@@ -258,7 +258,7 @@
</action>
<action name="actionShow_Slugs_View">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/contrib/slugs.png</normaloff>:/images/contrib/slugs.png</iconset>
</property>
<property name="text">
......@@ -267,7 +267,7 @@
</action>
<action name="actionJoystick_Settings">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/devices/input-gaming.svg</normaloff>:/images/devices/input-gaming.svg</iconset>
</property>
<property name="text">
......@@ -279,7 +279,7 @@
</action>
<action name="actionOnline_Documentation">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/apps/utilities-system-monitor.svg</normaloff>:/images/apps/utilities-system-monitor.svg</iconset>
</property>
<property name="text">
......@@ -288,7 +288,7 @@
</action>
<action name="actionProject_Roadmap_2">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/status/software-update-available.svg</normaloff>:/images/status/software-update-available.svg</iconset>
</property>
<property name="text">
......@@ -297,7 +297,7 @@
</action>
<action name="actionDeveloper_Credits">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/categories/preferences-system.svg</normaloff>:/images/categories/preferences-system.svg</iconset>
</property>
<property name="text">
......@@ -309,7 +309,7 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/status/weather-overcast.svg</normaloff>:/images/status/weather-overcast.svg</iconset>
</property>
<property name="text">
......@@ -324,7 +324,7 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/apps/utilities-system-monitor.svg</normaloff>:/images/apps/utilities-system-monitor.svg</iconset>
</property>
<property name="text">
......@@ -339,7 +339,7 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/devices/network-wired.svg</normaloff>:/images/devices/network-wired.svg</iconset>
</property>
<property name="text">
......@@ -351,7 +351,7 @@
</action>
<action name="actionSelectStylesheet">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/categories/applications-internet.svg</normaloff>:/images/categories/applications-internet.svg</iconset>
</property>
<property name="text">
......@@ -363,7 +363,7 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/status/network-wireless-encrypted.svg</normaloff>:/images/status/network-wireless-encrypted.svg</iconset>
</property>
<property name="text">
......@@ -375,7 +375,7 @@
</action>
<action name="actionNewCustomWidget">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/apps/utilities-system-monitor.svg</normaloff>:/images/apps/utilities-system-monitor.svg</iconset>
</property>
<property name="text">
......@@ -387,7 +387,7 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/status/audio-volume-high.svg</normaloff>
<normalon>:/images/status/audio-volume-muted.svg</normalon>
<activeon>:/images/status/audio-volume-muted.svg</activeon>
......@@ -403,7 +403,7 @@
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/devices/network-wireless.svg</normaloff>:/images/devices/network-wireless.svg</iconset>
</property>
<property name="text">
......@@ -415,7 +415,7 @@
</action>
<action name="actionShutdownMAV">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/actions/system-log-out.svg</normaloff>:/images/actions/system-log-out.svg</iconset>
</property>
<property name="text">
......@@ -459,7 +459,7 @@
</action>
<action name="actionLoadCustomWidgetFile">
<property name="icon">
<iconset resource="../../mavground.qrc">
<iconset resource="../../qgroundcontrol.qrc">
<normaloff>:/images/status/folder-drag-accept.svg</normaloff>:/images/status/folder-drag-accept.svg</iconset>
</property>
<property name="text">
......@@ -469,7 +469,7 @@
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
<include location="../../mavground.qrc"/>
<include location="../../qgroundcontrol.qrc"/>
</resources>
<connections>
<connection>
......
......@@ -116,12 +116,19 @@ bool QGCToolWidget::loadSettings(const QString& settings, bool singleinstance)
{
QSettings set(settings, QSettings::IniFormat);
QStringList groups = set.childGroups();
QString widgetName = groups.first();
if (singleinstance && QGCToolWidget::instances()->keys().contains(widgetName)) return false;
setTitle(widgetName);
qDebug() << "WIDGET TITLE LOADED: " << widgetName;
loadSettings(set);
return true;
if (groups.length() > 0)
{
QString widgetName = groups.first();
if (singleinstance && QGCToolWidget::instances()->keys().contains(widgetName)) return false;
setTitle(widgetName);
qDebug() << "WIDGET TITLE LOADED: " << widgetName;
loadSettings(set);
return true;
}
else
{
return false;
}
}
void QGCToolWidget::loadSettings(QSettings& settings)
......
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