1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

Moved new map plug-in openGL option to it's options page.

Added 'Edit waypoint' option to the right click context menu on the new map plug-in.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@935 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2010-06-29 11:11:35 +00:00 committed by pip
parent 8a582f44e1
commit d19ada4193
14 changed files with 655 additions and 192 deletions

View File

@ -11,7 +11,8 @@ HEADERS += opmapplugin.h \
opmapgadget.h \
opmapgadgetwidget.h \
opmap_waypointeditor_dialog.h \
opmap_mapoverlaywidget.h
opmap_mapoverlaywidget.h \
opmap_edit_waypoint_dialog.h
SOURCES += opmapplugin.cpp \
opmapgadgetwidget.cpp \
opmapgadgetoptionspage.cpp \
@ -19,10 +20,12 @@ SOURCES += opmapplugin.cpp \
opmapgadgetconfiguration.cpp \
opmapgadget.cpp \
opmap_waypointeditor_dialog.cpp \
opmap_mapoverlaywidget.cpp
opmap_mapoverlaywidget.cpp \
opmap_edit_waypoint_dialog.cpp
OTHER_FILES += OPMapGadget.pluginspec
FORMS += opmapgadgetoptionspage.ui \
opmap_widget.ui \
opmap_waypointeditor_dialog.ui \
opmap_mapoverlaywidget.ui
opmap_mapoverlaywidget.ui \
opmap_edit_waypoint_dialog.ui
RESOURCES += opmap.qrc

View File

@ -0,0 +1,76 @@
/**
******************************************************************************
*
* @file opmap_edit_waypoint_dialog.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup opmap
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "opmap_edit_waypoint_dialog.h"
#include "ui_opmap_edit_waypoint_dialog.h"
opmap_edit_waypoint_dialog::opmap_edit_waypoint_dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::opmap_edit_waypoint_dialog)
{
ui->setupUi(this);
setWindowFlags(Qt::Dialog);
}
opmap_edit_waypoint_dialog::~opmap_edit_waypoint_dialog()
{
delete ui;
}
void opmap_edit_waypoint_dialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void opmap_edit_waypoint_dialog::on_pushButtonOK_clicked()
{
// to do
close();
}
void opmap_edit_waypoint_dialog::on_pushButtonApply_clicked()
{
// to do
}
void opmap_edit_waypoint_dialog::on_pushButtonRevert_clicked()
{
// to do
}
void opmap_edit_waypoint_dialog::on_pushButtonCancel_clicked()
{
close();
}

View File

@ -0,0 +1,58 @@
/**
******************************************************************************
*
* @file opmap_edit_waypoint_dialog.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup opmap
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OPMAP_EDIT_WAYPOINT_DIALOG_H
#define OPMAP_EDIT_WAYPOINT_DIALOG_H
#include <QDialog>
namespace Ui {
class opmap_edit_waypoint_dialog;
}
class opmap_edit_waypoint_dialog : public QDialog {
Q_OBJECT
public:
opmap_edit_waypoint_dialog(QWidget *parent = 0);
~opmap_edit_waypoint_dialog();
protected:
void changeEvent(QEvent *e);
private:
Ui::opmap_edit_waypoint_dialog *ui;
private slots:
private slots:
void on_pushButtonCancel_clicked();
void on_pushButtonRevert_clicked();
void on_pushButtonApply_clicked();
void on_pushButtonOK_clicked();
};
#endif // OPMAP_EDIT_WAYPOINT_DIALOG_H

View File

@ -0,0 +1,237 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>opmap_edit_waypoint_dialog</class>
<widget class="QDialog" name="opmap_edit_waypoint_dialog">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>476</width>
<height>187</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>OpenPilot GCS Edit Waypoint</string>
</property>
<property name="windowIcon">
<iconset resource="../coreplugin/core.qrc">
<normaloff>:/core/images/openpilot_logo_128.png</normaloff>:/core/images/openpilot_logo_128.png</iconset>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Description </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="1" colspan="5">
<widget class="QLineEdit" name="lineEditDescription"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Number </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Latitude </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Longitude </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Height </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditNumber">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditLatitude">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>130</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditLongitude">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>130</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEditHeight">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>130</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>130</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>degrees</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>degrees</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>feet</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButtonOK">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonApply">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonRevert">
<property name="text">
<string>Revert</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonCancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../coreplugin/core.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,3 +1,30 @@
/**
******************************************************************************
*
* @file opmap_mapoverlaywidget.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup opmap
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "opmap_mapoverlaywidget.h"
#include "ui_opmap_mapoverlaywidget.h"

View File

@ -1,3 +1,30 @@
/**
******************************************************************************
*
* @file opmap_mapoverlaywidget.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup opmap
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OPMAP_MAPOVERLAYWIDGET_H
#define OPMAP_MAPOVERLAYWIDGET_H

View File

@ -768,7 +768,7 @@ QTreeView::branch:open:has-children:!has-siblings, QTreeView::branch:open:has-ch
</size>
</property>
<property name="mouseTracking">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="acceptDrops">
<bool>true</bool>
@ -873,6 +873,9 @@ border-radius: 2px;
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="styleSheet">
<string notr="true">QWidget { /* all types of qwidget */
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(71, 71, 71, 255), stop:1 rgba(110, 110, 110, 255));
@ -1143,6 +1146,9 @@ border-radius: 3px;
<height>0</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="styleSheet">
<string notr="true">QFrame{
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(110, 110, 110, 255), stop:1 rgba(71, 71, 71, 255));

View File

@ -45,6 +45,8 @@ void OPMapGadget::loadConfiguration(IUAVGadgetConfiguration *config)
m_widget->setMapProvider(m->mapProvider());
m_widget->setZoom(m->zoom());
m_widget->setPosition(QPointF(m->longitude(), m->latitude()));
m_widget->setUseOpenGL(m->useOpenGL());
m_widget->setShowTileGridLines(m->showTileGridLines());
m_widget->setAccessMode(m->accessMode());
m_widget->setUseMemoryCache(m->useMemoryCache());
m_widget->setCacheLocation(m->cacheLocation());

View File

@ -35,6 +35,8 @@ OPMapGadgetConfiguration::OPMapGadgetConfiguration(QString classId, const QByteA
m_defaultZoom(2),
m_defaultLatitude(0),
m_defaultLongitude(0),
m_useOpenGL(false),
m_showTileGridLines(false),
m_accessMode("ServerAndCache"),
m_useMemoryCache(true),
m_cacheLocation(QDir::currentPath() + QDir::separator() + "mapscache" + QDir::separator())
@ -43,26 +45,33 @@ OPMapGadgetConfiguration::OPMapGadgetConfiguration(QString classId, const QByteA
{
QDataStream stream(state);
int zoom;
QString mapProvider;
int zoom;
double latitude;
double longitude;
QString mapProvider;
bool useOpenGL;
bool showTileGridLines;
QString accessMode;
bool useMemoryCache;
QString cacheLocation;
stream >> mapProvider;
stream >> zoom;
stream >> latitude;
stream >> longitude;
stream >> mapProvider;
stream >> useOpenGL;
stream >> showTileGridLines;
stream >> accessMode;
stream >> useMemoryCache;
stream >> cacheLocation;
if (!mapProvider.isEmpty()) m_mapProvider = mapProvider;
m_defaultZoom = zoom;
m_defaultLatitude = latitude;
m_defaultLongitude = longitude;
if (!mapProvider.isEmpty()) m_mapProvider = mapProvider;
m_useOpenGL = useOpenGL;
m_showTileGridLines = showTileGridLines;
if (!accessMode.isEmpty()) m_accessMode = accessMode;
m_useMemoryCache = useMemoryCache;
if (!cacheLocation.isEmpty()) m_cacheLocation = cacheLocation;
@ -73,10 +82,12 @@ IUAVGadgetConfiguration * OPMapGadgetConfiguration::clone()
{
OPMapGadgetConfiguration *m = new OPMapGadgetConfiguration(this->classId());
m->m_mapProvider = m_mapProvider;
m->m_defaultZoom = m_defaultZoom;
m->m_defaultLatitude = m_defaultLatitude;
m->m_defaultLongitude = m_defaultLongitude;
m->m_mapProvider = m_mapProvider;
m->m_useOpenGL = m_useOpenGL;
m->m_showTileGridLines = m_showTileGridLines;
m->m_accessMode = m_accessMode;
m->m_useMemoryCache = m_useMemoryCache;
m->m_cacheLocation = m_cacheLocation;
@ -89,10 +100,12 @@ QByteArray OPMapGadgetConfiguration::saveState() const
QByteArray bytes;
QDataStream stream(&bytes, QIODevice::WriteOnly);
stream << m_mapProvider;
stream << m_defaultZoom;
stream << m_defaultLatitude;
stream << m_defaultLongitude;
stream << m_mapProvider;
stream << m_useOpenGL;
stream << m_showTileGridLines;
stream << m_accessMode;
stream << m_useMemoryCache;
stream << m_cacheLocation;

View File

@ -41,6 +41,8 @@ Q_PROPERTY(QString mapProvider READ mapProvider WRITE setMapProvider)
Q_PROPERTY(int zoommo READ zoom WRITE setZoom)
Q_PROPERTY(double latitude READ latitude WRITE setLatitude)
Q_PROPERTY(double longitude READ longitude WRITE setLongitude)
Q_PROPERTY(bool useOpenGL READ useOpenGL WRITE setUseOpenGL)
Q_PROPERTY(bool showTileGridLines READ showTileGridLines WRITE setShowTileGridLines)
Q_PROPERTY(QString accessMode READ accessMode WRITE setAccessMode)
Q_PROPERTY(bool useMemoryCache READ useMemoryCache WRITE setUseMemoryCache)
Q_PROPERTY(QString cacheLocation READ cacheLocation WRITE setCacheLocation)
@ -54,6 +56,8 @@ public:
int zoom() const { return m_defaultZoom; }
double latitude() const { return m_defaultLatitude; }
double longitude() const { return m_defaultLongitude; }
bool useOpenGL() const { return m_useOpenGL; }
bool showTileGridLines() const { return m_showTileGridLines; }
QString accessMode() const { return m_accessMode; }
bool useMemoryCache() const { return m_useMemoryCache; }
QString cacheLocation() const { return m_cacheLocation; }
@ -63,6 +67,8 @@ public slots:
void setZoom(int zoom) { m_defaultZoom = zoom; }
void setLatitude(double latitude) { m_defaultLatitude = latitude; }
void setLongitude(double longitude) { m_defaultLongitude = longitude; }
void setUseOpenGL(bool useOpenGL) { m_useOpenGL = useOpenGL; }
void setShowTileGridLines(bool showTileGridLines) { m_showTileGridLines = showTileGridLines; }
void setAccessMode(QString accessMode) { m_accessMode = accessMode; }
void setUseMemoryCache(bool useMemoryCache) { m_useMemoryCache = useMemoryCache; }
void setCacheLocation(QString cacheLocation) { m_cacheLocation = cacheLocation; }
@ -72,6 +78,8 @@ private:
int m_defaultZoom;
double m_defaultLatitude;
double m_defaultLongitude;
bool m_useOpenGL;
bool m_showTileGridLines;
QString m_accessMode;
bool m_useMemoryCache;
QString m_cacheLocation;

View File

@ -69,11 +69,14 @@ QWidget *OPMapGadgetOptionsPage::createPage(QWidget *parent)
m_page->latitudeSpinBox->setValue(m_config->latitude());
m_page->longitudeSpinBox->setValue(m_config->longitude());
m_page->checkBoxUseOpenGL->setChecked(m_config->useOpenGL());
m_page->checkBoxShowTileGridLines->setChecked(m_config->showTileGridLines());
index = m_page->accessModeComboBox->findText(m_config->accessMode());
index = (index >= 0) ? index : 0;
m_page->accessModeComboBox->setCurrentIndex(index);
m_page->pushButtonUseMemoryCache->setChecked(m_config->useMemoryCache());
m_page->checkBoxUseMemoryCache->setChecked(m_config->useMemoryCache());
m_page->lineEditCacheLocation->setText(m_config->cacheLocation());
connect(m_page->pushButtonCacheLocation, SIGNAL(clicked()), this, SLOT(on_pushButtonCacheLocation_clicked()));
@ -101,7 +104,7 @@ void OPMapGadgetOptionsPage::on_pushButtonCacheDefaults_clicked()
index = (index >= 0) ? index : 0;
m_page->accessModeComboBox->setCurrentIndex(index);
m_page->pushButtonUseMemoryCache->setChecked(true);
m_page->checkBoxUseMemoryCache->setChecked(true);
m_page->lineEditCacheLocation->setText(QDir::currentPath() + QDir::separator() + "mapscache" + QDir::separator());
}
@ -112,8 +115,10 @@ void OPMapGadgetOptionsPage::apply()
m_config->setZoom(m_page->zoomSpinBox->value());
m_config->setLatitude(m_page->latitudeSpinBox->value());
m_config->setLongitude(m_page->longitudeSpinBox->value());
m_config->setUseOpenGL(m_page->checkBoxUseOpenGL->isChecked());
m_config->setShowTileGridLines(m_page->checkBoxShowTileGridLines->isChecked());
m_config->setAccessMode(m_page->accessModeComboBox->currentText());
m_config->setUseMemoryCache(m_page->pushButtonUseMemoryCache->isChecked());
m_config->setUseMemoryCache(m_page->checkBoxUseMemoryCache->isChecked());
m_config->setCacheLocation(m_page->lineEditCacheLocation->text());
}

View File

@ -25,24 +25,7 @@
</property>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="1">
<widget class="QComboBox" name="providerComboBox">
<property name="cursor">
<cursorShape>OpenHandCursor</cursorShape>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Map type </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="2">
<item row="4" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Default longitude </string>
@ -52,7 +35,7 @@
</property>
</widget>
</item>
<item row="2" column="3">
<item row="4" column="3">
<widget class="QDoubleSpinBox" name="longitudeSpinBox">
<property name="decimals">
<number>8</number>
@ -65,33 +48,20 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="checkBoxShowGrid">
<item row="5" column="3">
<widget class="QCheckBox" name="checkBoxUseOpenGL">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Show Grid</string>
<string>Use OpenGL</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QCheckBox" name="checkBoxOpenGL">
<property name="enabled">
<bool>false</bool>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>OpenGL</string>
</property>
</widget>
</item>
<item row="0" column="3">
<item row="2" column="3">
<widget class="QDoubleSpinBox" name="latitudeSpinBox">
<property name="decimals">
<number>8</number>
@ -104,17 +74,7 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Default zoom </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<item row="2" column="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Default latitude </string>
@ -124,16 +84,59 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="1" column="3">
<widget class="QSpinBox" name="zoomSpinBox">
<property name="maximum">
<number>18</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Default zoom </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QComboBox" name="providerComboBox">
<property name="cursor">
<cursorShape>OpenHandCursor</cursorShape>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Map type </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QCheckBox" name="checkBoxShowTileGridLines">
<property name="enabled">
<bool>true</bool>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Show Tile Grid Lines</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="8" column="0">
<item row="10" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -158,69 +161,21 @@
<property name="text">
<string>Server and Cache</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="4" column="0">
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="5">
<widget class="QComboBox" name="accessModeComboBox">
<property name="cursor">
<cursorShape>OpenHandCursor</cursorShape>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Access mode </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonUseMemoryCache">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="cursor">
<cursorShape>OpenHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>Use memory caching</string>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
}
QPushButton:pressed {
}
QPushButton:hover {
}
QPushButton:checked {
/*background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 rgba(180, 190, 220, 255), stop: 1 rgba(200, 230, 255, 255));*/
}
</string>
</property>
<property name="text">
<string> Memory Cache </string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<item row="9" column="0">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="7" column="0">
<layout class="QGridLayout" name="gridLayout_5">
<item row="5" column="2">
<widget class="QPushButton" name="pushButtonCacheDefaults">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -248,7 +203,7 @@ stop: 0 rgba(180, 190, 220, 255), stop: 1 rgba(200, 230, 255, 255));*/
</property>
</widget>
</item>
<item row="0" column="3">
<item row="5" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -261,30 +216,60 @@ stop: 0 rgba(180, 190, 220, 255), stop: 1 rgba(200, 230, 255, 255));*/
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
</layout>
</item>
<item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Access mode </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="accessModeComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="cursor">
<cursorShape>OpenHandCursor</cursorShape>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item row="6" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Cache location:</string>
<string>Cache location </string>
</property>
</widget>
</item>
@ -314,12 +299,35 @@ stop: 0 rgba(180, 190, 220, 255), stop: 1 rgba(200, 230, 255, 255));*/
</item>
</layout>
</item>
<item row="6" column="0">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<item row="5" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseMemoryCache">
<property name="enabled">
<bool>true</bool>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Use Memory Cache</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>

View File

@ -44,7 +44,6 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
m_widget = NULL;
m_map = NULL;
waypoint_editor = NULL;
wayPoint_treeView_model = NULL;
findPlaceCompleter = NULL;
m_map_graphics_scene = NULL;
@ -164,17 +163,10 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
m_map->SetMaxZoom(19); // increase the maximum zoom level
m_map->SetMouseWheelZoomType(internals::MouseWheelZoomType::MousePositionWithoutCenter); // set how the mouse wheel zoom functions
m_map->SetFollowMouse(true); // we want a contiuous mouse position reading
m_map->SetUseOpenGL(openGLAct->isChecked()); // enable/disable openGL
m_map->SetShowTileGridLines(gridLinesAct->isChecked()); // map grid lines on/off
m_map->SetCurrentPosition(internals::PointLatLng(data.Latitude, data.Longitude)); // set the default map position
}
// **************
// create the waypoint editor dialog
waypoint_editor = new opmap_waypointeditor_dialog(this);
// **************
@ -259,9 +251,9 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
OPMapGadgetWidget::~OPMapGadgetWidget()
{
clearWayPoints();
if (m_map_overlay_widget) delete m_map_overlay_widget;
if (wayPoint_treeView_model) delete wayPoint_treeView_model;
if (waypoint_editor) delete waypoint_editor;
if (m_map_overlay_widget) delete m_map_overlay_widget;
if (m_map) delete m_map;
if (m_widget) delete m_widget;
}
@ -356,14 +348,12 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(wayPointEditorAct);
menu.addAction(addWayPointAct);
menu.addAction(editWayPointAct);
menu.addAction(deleteWayPointAct);
menu.addAction(clearWayPointsAct);
menu.addSeparator();
// menu.addAction(gridLinesAct);
menu.addAction(openGLAct);
menu.exec(event->globalPos());
// ****************
@ -704,8 +694,7 @@ void OPMapGadgetWidget::on_toolButtonAddWaypoint_clicked()
void OPMapGadgetWidget::on_toolButtonWaypointEditor_clicked()
{
if (waypoint_editor)
waypoint_editor->show();
openWayPointEditor();
}
void OPMapGadgetWidget::on_treeViewWaypoints_clicked(QModelIndex index)
@ -765,6 +754,18 @@ void OPMapGadgetWidget::setAccessMode(QString accessMode)
m_map->configuration->SetAccessMode(mapcontrol::Helper::AccessModeFromString(accessMode));
}
void OPMapGadgetWidget::setUseOpenGL(bool useOpenGL)
{
if (m_map)
m_map->SetUseOpenGL(useOpenGL);
}
void OPMapGadgetWidget::setShowTileGridLines(bool showTileGridLines)
{
if (m_map)
m_map->SetShowTileGridLines(showTileGridLines);
}
void OPMapGadgetWidget::setUseMemoryCache(bool useMemoryCache)
{
if (m_map)
@ -866,6 +867,11 @@ void OPMapGadgetWidget::createActions()
addWayPointAct->setStatusTip(tr("Add waypoint"));
connect(addWayPointAct, SIGNAL(triggered()), this, SLOT(addWayPoint()));
editWayPointAct = new QAction(tr("&Edit waypoint"), this);
editWayPointAct->setShortcut(tr("Ctrl+E"));
editWayPointAct->setStatusTip(tr("Edit waypoint"));
connect(editWayPointAct, SIGNAL(triggered()), this, SLOT(editWayPoint()));
deleteWayPointAct = new QAction(tr("&Delete waypoint"), this);
deleteWayPointAct->setShortcut(tr("Ctrl+D"));
deleteWayPointAct->setStatusTip(tr("Delete waypoint"));
@ -876,20 +882,6 @@ void OPMapGadgetWidget::createActions()
clearWayPointsAct->setStatusTip(tr("Clear waypoints"));
connect(clearWayPointsAct, SIGNAL(triggered()), this, SLOT(clearWayPoints()));
gridLinesAct = new QAction(tr("Grid lines"), this);
gridLinesAct->setShortcut(tr("Ctrl+G"));
gridLinesAct->setStatusTip(tr("Show/Hide grid lines"));
gridLinesAct->setCheckable(true);
gridLinesAct->setChecked(false);
connect(gridLinesAct, SIGNAL(triggered()), this, SLOT(gridLines()));
openGLAct = new QAction(tr("Use OpenGL"), this);
openGLAct->setShortcut(tr("Ctrl+O"));
openGLAct->setStatusTip(tr("Enable/Disable OpenGL"));
openGLAct->setCheckable(true);
openGLAct->setChecked(false);
connect(openGLAct, SIGNAL(triggered()), this, SLOT(openGL()));
zoom2Act = new QAction(tr("2"), this);
zoom2Act->setCheckable(true);
connect(zoom2Act, SIGNAL(triggered()), this, SLOT(zoom2()));
@ -1052,8 +1044,7 @@ void OPMapGadgetWidget::on_followUAVheadingAct_toggled(bool checked)
void OPMapGadgetWidget::openWayPointEditor()
{
if (waypoint_editor)
waypoint_editor->show();
waypoint_editor_dialog.show();
}
void OPMapGadgetWidget::addWayPoint()
@ -1077,6 +1068,12 @@ void OPMapGadgetWidget::addWayPoint()
// to do
}
void OPMapGadgetWidget::editWayPoint()
{
// to do
waypoint_edit_dialog.show();
}
void OPMapGadgetWidget::deleteWayPoint()
{
// to do
@ -1090,16 +1087,4 @@ void OPMapGadgetWidget::clearWayPoints()
m_waypoint_list_mutex.unlock();
}
void OPMapGadgetWidget::gridLines()
{
if (m_map)
m_map->SetShowTileGridLines(gridLinesAct->isChecked());
}
void OPMapGadgetWidget::openGL()
{
if (m_map)
m_map->SetUseOpenGL(openGLAct->isChecked());
}
// *************************************************************************************

View File

@ -42,6 +42,7 @@
#include "opmap_mapoverlaywidget.h"
#include "opmap_waypointeditor_dialog.h"
#include "opmap_edit_waypoint_dialog.h"
namespace Ui
{
@ -70,10 +71,17 @@ public:
OPMapGadgetWidget(QWidget *parent = 0);
~OPMapGadgetWidget();
void setZoom(int value);
void setPosition(QPointF pos);
void setMapProvider(QString provider);
void setAccessMode(QString accessMode);
/**
* @brief public functions
*
* @param
*/
void setZoom(int value);
void setPosition(QPointF pos);
void setMapProvider(QString provider);
void setUseOpenGL(bool useOpenGL);
void setShowTileGridLines(bool showTileGridLines);
void setAccessMode(QString accessMode);
void setUseMemoryCache(bool useMemoryCache);
void setCacheLocation(QString cacheLocation);
@ -152,10 +160,9 @@ private slots:
void on_followUAVheadingAct_toggled(bool checked);
void openWayPointEditor();
void addWayPoint();
void editWayPoint();
void deleteWayPoint();
void clearWayPoints();
void gridLines();
void openGL();
void zoom2() { setZoom(2); }
void zoom3() { setZoom(3); }
void zoom4() { setZoom(4); }
@ -194,7 +201,9 @@ private:
mapcontrol::OPMapWidget *m_map;
opmap_waypointeditor_dialog *waypoint_editor;
opmap_waypointeditor_dialog waypoint_editor_dialog;
opmap_edit_waypoint_dialog waypoint_edit_dialog;
QGraphicsScene *m_map_graphics_scene;
QGraphicsProxyWidget *m_map_scene_proxy;
@ -219,10 +228,9 @@ private:
QAction *followUAVheadingAct;
QAction *wayPointEditorAct;
QAction *addWayPointAct;
QAction *editWayPointAct;
QAction *deleteWayPointAct;
QAction *clearWayPointsAct;
QAction *gridLinesAct;
QAction *openGLAct;
QActionGroup *zoomActGroup;
QAction *zoom2Act;