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

Merge branch 'about' into qtquick2

This commit is contained in:
Fredrik Larrson 2013-11-16 05:38:38 +11:00
commit 94b9ef10d5
11 changed files with 207 additions and 556 deletions

View File

@ -1,14 +1,9 @@
/**
******************************************************************************
*
* @file authorsdialog.cpp
* @file aboutdialog.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup CorePlugin Core Plugin
* @{
* @brief The Core GCS plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
@ -26,72 +21,44 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "authorsdialog.h"
#include "aboutdialog.h"
#include "version_info/version_info.h"
#include "coreconstants.h"
#include "icore.h"
#include <utils/qtcassert.h>
#include <QtCore/QDate>
#include <QtCore/QFile>
#include <QtCore/QSysInfo>
#include <QDialogButtonBox>
#include <QGridLayout>
#include <QLabel>
#include <QPushButton>
#include <QTextBrowser>
#include <QDesktopServices>
#include <QLayout>
#include <QVBoxLayout>
#include <QtQuick>
#include <QQuickView>
#include <QQmlEngine>
#include <QQmlContext>
using namespace Core;
using namespace Core::Internal;
using namespace Core::Constants;
AuthorsDialog::AuthorsDialog(QWidget *parent)
: QDialog(parent)
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent)
{
// We need to set the window icon explicitly here since for some reason the
// application icon isn't used when the size of the dialog is fixed (at least not on X11/GNOME)
setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png"));
setWindowTitle(tr("About OpenPilot"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
// This loads a QML doc containing a Tabbed view
QQuickView *view = new QQuickView();
QString version = QLatin1String(GCS_VERSION_LONG);
version += QDate(2007, 25, 10).toString(Qt::SystemLocaleDate);
QString ideRev;
// : This gets conditionally inserted as argument %8 into the description string.
ideRev = tr("From revision %1<br/>").arg(VersionInfo::revision().left(10));
setMinimumSize(600, 400);
setMaximumSize(800, 600);
const QString description = tr(
"<h3>OpenPilot Ground Control Station</h3>"
"GCS Revision: <b>%1</b><br/>"
"Revision: <b>%1</b><br/>"
"UAVO Hash: <b>%2</b><br/>"
"<br/>"
"Built from %3<br/>"
"Built on %4 at %5<br/>"
"Based on Qt %6 (%7 bit)<br/>"
"<br/>"
"&copy; %8, 2010-%9. All rights reserved.<br/>"
"<br/>"
"<small>This program is free software; you can redistribute it and/or modify<br/>"
"it under the terms of the GNU General Public License as published by<br/>"
"the Free Software Foundation; either version 3 of the License, or<br/>"
"(at your option) any later version.<br/>"
"<br/>"
"The program is provided AS IS with NO WARRANTY OF ANY KIND, "
"INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
"PARTICULAR PURPOSE.</small>"
"&copy; %8, 2010-%9. All rights reserved.<br/>"
).arg(
VersionInfo::revision().left(60), // %1
VersionInfo::uavoHash().left(8), // %2
@ -103,10 +70,28 @@ AuthorsDialog::AuthorsDialog(QWidget *parent)
QLatin1String(GCS_AUTHOR), // %8
VersionInfo::year() // %9
);
// Expose the version description to the QML doc
QQuickView *view = new QQuickView();
view->rootContext()->setContextProperty("dialog", this);
view->rootContext()->setContextProperty("version", description);
view->setSource(QUrl("qrc:/core/qml/AboutDialog.qml"));
view->setResizeMode(QQuickView::SizeRootObjectToView);
QWidget * container = QWidget::createWindowContainer(view,this);
container->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
view->setSource(QUrl("qrc:/core/qml/AboutDialog.qml"));
QWidget * container = QWidget::createWindowContainer(view);
container->setMinimumSize(600, 400);
container->setMaximumSize(800, 600);
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QVBoxLayout *lay = new QVBoxLayout();
lay->setContentsMargins(0,0,0,0);
setLayout(lay);
layout()->addWidget(container);
}
void AboutDialog::openUrl(const QString &url)
{
QDesktopServices::openUrl(QUrl(url));
}
AboutDialog::~AboutDialog()
{
}

View File

@ -1,14 +1,9 @@
/**
******************************************************************************
*
* @file authors.h
* @file aboutdialog.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup CorePlugin Core Plugin
* @{
* @brief The Core GCS plugin
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
@ -26,19 +21,22 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef AUTHORSDIALOG_H
#define AUTHORSDIALOG_H
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QDialog>
namespace Core {
namespace Internal {
class AuthorsDialog : public QDialog {
class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AuthorsDialog(QWidget *parent);
};
} // namespace Internal
} // namespace Core
#endif // AUTHORSDIALOG_H
public:
explicit AboutDialog(QWidget *parent = 0);
~AboutDialog();
public slots:
void openUrl(const QString &url);
};
#endif // ABOUTDIALOG_H

View File

@ -62,8 +62,6 @@
<file>images/cpu.png</file>
<file>images/tx-rx.svg</file>
<file>qml/images/tab.png</file>
<file>qml/ScrollDecorator.qml</file>
<file>qml/TabWidget.qml</file>
<file>qml/AboutDialog.qml</file>
<file alias="qml/AuthorsModel.qml">../../../../../build/openpilotgcs-synthetics/AuthorsModel.qml</file>
</qresource>

View File

@ -2,7 +2,8 @@ TEMPLATE = lib
TARGET = Core
DEFINES += CORE_LIBRARY
QT += qml quick \
QT += qml \
quick \
xml \
network \
script \
@ -32,7 +33,6 @@ SOURCES += mainwindow.cpp \
uniqueidmanager.cpp \
messagemanager.cpp \
messageoutputwindow.cpp \
versiondialog.cpp \
iuavgadget.cpp \
uavgadgetmanager/uavgadgetmanager.cpp \
uavgadgetmanager/uavgadgetview.cpp \
@ -70,8 +70,8 @@ SOURCES += mainwindow.cpp \
uavgadgetdecorator.cpp \
workspacesettings.cpp \
uavconfiginfo.cpp \
authorsdialog.cpp \
telemetrymonitorwidget.cpp
telemetrymonitorwidget.cpp \
aboutdialog.cpp
HEADERS += mainwindow.h \
tabpositionindicator.h \
@ -105,7 +105,6 @@ HEADERS += mainwindow.h \
iversioncontrol.h \
iview.h \
icorelistener.h \
versiondialog.h \
core_global.h \
basemode.h \
baseview.h \
@ -131,9 +130,9 @@ HEADERS += mainwindow.h \
uavgadgetdecorator.h \
workspacesettings.h \
uavconfiginfo.h \
authorsdialog.h \
iconfigurableplugin.h \
telemetrymonitorwidget.h
telemetrymonitorwidget.h \
aboutdialog.h
FORMS += dialogs/settingsdialog.ui \
dialogs/shortcutsettings.ui \

View File

@ -45,7 +45,7 @@
#include "uavgadgetinstancemanager.h"
#include "workspacesettings.h"
#include "authorsdialog.h"
#include "aboutdialog.h"
#include "baseview.h"
#include "ioutputpane.h"
#include "icorelistener.h"
@ -56,7 +56,6 @@
#include "threadmanager.h"
#include "uniqueidmanager.h"
#include "variablemanager.h"
#include "versiondialog.h"
#include <coreplugin/settingsdatabase.h>
#include <extensionsystem/pluginmanager.h>
@ -114,8 +113,7 @@ MainWindow::MainWindow() :
m_modeManager(0),
m_connectionManager(0),
m_mimeDatabase(new MimeDatabase),
m_versionDialog(0),
m_authorsDialog(0),
m_aboutDialog(0),
m_activeContext(0),
m_generalSettings(new GeneralSettings),
m_shortcutSettings(new ShortcutSettings),
@ -790,7 +788,7 @@ void MainWindow::registerDefaultActions()
#ifdef Q_WS_MAC
cmd->action()->setMenuRole(QAction::ApplicationSpecificRole);
#endif
connect(tmpaction, SIGNAL(triggered()), this, SLOT(aboutOpenPilotAuthors()));
connect(tmpaction, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
}
void MainWindow::newFile()
@ -799,42 +797,6 @@ void MainWindow::newFile()
void MainWindow::openFile()
{}
/*static QList<IFileFactory*> getNonEditorFileFactories()
{
QList<IFileFactory*> tmp;
return tmp;
}
static IFileFactory *findFileFactory(const QList<IFileFactory*> &fileFactories,
const MimeDatabase *db,
const QFileInfo &fi)
{
if (const MimeType mt = db->findByFile(fi)) {
const QString type = mt.type();
foreach (IFileFactory *factory, fileFactories) {
if (factory->mimeTypes().contains(type))
return factory;
}
}
return 0;
}
// opens either an editor or loads a project
void MainWindow::openFiles(const QStringList &fileNames)
{
QList<IFileFactory*> nonEditorFileFactories = getNonEditorFileFactories();
foreach (const QString &fileName, fileNames) {
const QFileInfo fi(fileName);
const QString absoluteFilePath = fi.absoluteFilePath();
if (IFileFactory *fileFactory = findFileFactory(nonEditorFileFactories, mimeDatabase(), fi)) {
fileFactory->open(absoluteFilePath);
} else {
}
}
}*/
void MainWindow::setFocusToEditor()
{}
@ -1401,43 +1363,24 @@ void MainWindow::openRecentFile()
if (!fileName.isEmpty()) {}
}
void MainWindow::aboutOpenPilotGCS()
void MainWindow::showAboutDialog()
{
if (!m_versionDialog) {
m_versionDialog = new VersionDialog(this);
connect(m_versionDialog, SIGNAL(finished(int)),
this, SLOT(destroyVersionDialog()));
if (!m_aboutDialog) {
m_aboutDialog = new AboutDialog(this);
connect(m_aboutDialog, SIGNAL(finished(int)),
this, SLOT(destroyAboutDialog()));
}
m_versionDialog->show();
m_aboutDialog->show();
}
void MainWindow::destroyVersionDialog()
void MainWindow::destroyAboutDialog()
{
if (m_versionDialog) {
m_versionDialog->deleteLater();
m_versionDialog = 0;
if (m_aboutDialog) {
m_aboutDialog->deleteLater();
m_aboutDialog = 0;
}
}
void MainWindow::aboutOpenPilotAuthors()
{
if (!m_authorsDialog) {
m_authorsDialog = new AuthorsDialog(this);
connect(m_authorsDialog, SIGNAL(finished(int)),
this, SLOT(destroyAuthorsDialog()));
}
m_authorsDialog->show();
}
void MainWindow::destroyAuthorsDialog()
{
if (m_authorsDialog) {
m_authorsDialog->deleteLater();
m_authorsDialog = 0;
}
}
void MainWindow::aboutPlugins()
{
PluginDialog dialog(this);
@ -1453,12 +1396,8 @@ void MainWindow::setFullScreen(bool on)
if (on) {
setWindowState(windowState() | Qt::WindowFullScreen);
// statusBar()->hide();
// menuBar()->hide();
} else {
setWindowState(windowState() & ~Qt::WindowFullScreen);
// menuBar()->show();
// statusBar()->show();
}
}

View File

@ -43,6 +43,8 @@ class QToolButton;
class MyTabWidget;
QT_END_NAMESPACE
class AboutDialog;
namespace Core {
class ActionManager;
class BaseMode;
@ -72,8 +74,6 @@ class FancyTabWidget;
class GeneralSettings;
class ShortcutSettings;
class WorkspaceSettings;
class VersionDialog;
class AuthorsDialog;
class CORE_EXPORT MainWindow : public EventFilteringMainWindow {
Q_OBJECT
@ -154,12 +154,10 @@ private slots:
void openRecentFile();
void setFocusToEditor();
void saveAll();
void aboutOpenPilotGCS();
void showAboutDialog();
void destroyAboutDialog();
void aboutPlugins();
void aboutOpenPilotAuthors();
void updateFocusWidget(QWidget *old, QWidget *now);
void destroyVersionDialog();
void destroyAuthorsDialog();
void modeChanged(Core::IMode *mode);
void showUavGadgetMenus(bool show, bool hasSplitter);
void applyTabBarSettings(QTabWidget::TabPosition pos, bool movable);
@ -191,8 +189,7 @@ private:
MimeDatabase *m_mimeDatabase;
MyTabWidget *m_modeStack;
Core::BaseView *m_outputView;
VersionDialog *m_versionDialog;
AuthorsDialog *m_authorsDialog;
AboutDialog *m_aboutDialog;
IContext *m_activeContext;

View File

@ -1,110 +1,140 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/
/**
******************************************************************************
*
* @file aboutdialog.qml
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2013.
*
*****************************************************************************/
/*
* 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
*/
import QtQuick 2.1
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0
import QtQuick 2.0
// This is a tabbed pane element. Add a nested Rectangle to add a tab.
TabWidget {
// Define AuthorsModel as type
property AuthorsModel authors: AuthorsModel {}
id: tabs
width: 640; height: 480
// This tab is for the GCS version information
Rectangle {
property string title: "OpenPilot GCS"
anchors.fill: parent
color: "#e3e3e3"
Rectangle {
anchors.fill: parent; anchors.margins: 20
color: "#e3e3e3"
Image {
source: "../images/openpilot_logo_128.png"
x: 0; y: 0; z: 100
fillMode: Image.PreserveAspectFit
}
Flickable {
anchors.fill: parent
anchors.centerIn: parent
Text {
id: versionLabel
x: 156; y: 0
width: 430; height: 379
horizontalAlignment: Qt.AlignLeft
font.pixelSize: 12
wrapMode: Text.WordWrap
// @var version exposed in authorsdialog.cpp
text: version
}
Rectangle {
id: container
width: 600
height: 400
property AuthorsModel authors: AuthorsModel {}
ColumnLayout {
id: columnLayout1
anchors.fill: parent
spacing: 10
RowLayout {
id: rowLayout1
opacity: 1
Image {
id: logo
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: parent.top
anchors.topMargin: 10
source: "../images/openpilot_logo_128.png"
z: 100
fillMode: Image.PreserveAspectFit
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
dialog.openUrl("http://www.openpilot.org")
}
}
}
Rectangle {
anchors.left: logo.right
anchors.margins: 10
anchors.right: parent.right
anchors.top: parent.top
Layout.fillHeight: true
Layout.fillWidth: true
anchors.bottom: parent.bottom
color: "transparent"
ColumnLayout {
anchors.fill: parent
Text {
id: headerLabel
text: qsTr("OpenPilot Ground Control Station")
Layout.fillWidth: true
font.pixelSize: 14
font.bold: true
}
Text {
id: versionLabel
Layout.fillWidth: true
font.pixelSize: 12
wrapMode: Text.WordWrap
text: version
}
Text {
id: licenseLabel
Layout.fillWidth: true
font.pixelSize: 9
wrapMode: Text.WordWrap
text: qsTr("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.\n" +
"The program is provided AS IS with NO WARRANTY OF ANY KIND, " +
"INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.")
}
Text {
id: contributorLabel
text: qsTr("Contributors")
Layout.fillWidth: true
font.pixelSize: 14
font.bold: true
}
ScrollView {
Layout.fillWidth: true
Layout.fillHeight: true
frameVisible: true
ListView {
id: authorsView
anchors.fill: parent
spacing: 3
model: authors
delegate: Text {
font.pixelSize: 12
text: name
}
clip: true
}
}
}
}
}
// This tab is for the authors/contributors/credits
Rectangle {
property string title: "Contributors"
anchors.fill: parent; color: "#e3e3e3"
Rectangle {
anchors.fill: parent; anchors.margins: 20
color: "#e3e3e3"
Text {
id: description
text: "<h4>These people have been key contributors to the OpenPilot project. Without the work of the people in this list, OpenPilot would not be what it is today.</h4><p>This list is sorted alphabetically by name</p>"
width: 600
wrapMode: Text.WordWrap
}
ListView {
id: authorsView
y: description.y + description.height + 20
width: parent.width; height: parent.height - description.height - 20
spacing: 3
model: authors
delegate: Text {
text: name
}
clip: true
}
ScrollDecorator {
flickableItem: authorsView
}
}
}
Button {
id: button
text: qsTr("Ok")
activeFocusOnPress: true
anchors.right: parent.right
anchors.rightMargin: 10
anchors.bottom: parent.bottom
anchors.bottomMargin: 10
onClicked: dialog.close()
}
}
}

View File

@ -1,40 +0,0 @@
import QtQuick 2.0
Rectangle {
id: scrollDecorator
property Flickable flickableItem: null
Loader {
id: scrollLoader
sourceComponent: scrollDecorator.flickableItem ? scrollBar : undefined
}
Component.onDestruction: scrollLoader.sourceComponent = undefined
Component {
id: scrollBar
Rectangle {
property Flickable flickable: scrollDecorator.flickableItem
parent: flickable
anchors.right: parent.right
smooth: true
radius: 2
color: "gray"
border.color: "lightgray"
border.width: 1.0
opacity: flickable.moving ? 0.8 : 0.4
Behavior on opacity {
NumberAnimation { duration: 500 }
}
width: 4
height: flickable.height * (flickable.height / flickable.contentHeight)
y: flickable.height * (flickable.contentY / flickable.contentHeight)
visible: flickable.height < flickable.contentHeight
}
}
}

View File

@ -1,102 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.0
Item {
id: tabWidget
// Setting the default property to stack.children means any child items
// of the TabWidget are actually added to the 'stack' item's children.
// See the "Property Binding"
// documentation for details on default properties.
default property alias content: stack.children
property int current: 0
onCurrentChanged: setOpacities()
Component.onCompleted: setOpacities()
function setOpacities() {
for (var i = 0; i < stack.children.length; ++i) {
stack.children[i].opacity = (i == current ? 1 : 0)
}
}
Row {
id: header
Repeater {
model: stack.children.length
delegate: Rectangle {
width: tabWidget.width / stack.children.length; height: 36
Rectangle {
width: parent.width; height: 1
anchors { bottom: parent.bottom; bottomMargin: 1 }
color: "#acb2c2"
}
BorderImage {
anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 }
border { left: 7; right: 7 }
source: "images/tab.png"
visible: tabWidget.current == index
}
Text {
horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter
anchors.fill: parent
text: stack.children[index].title
elide: Text.ElideRight
font.bold: tabWidget.current == index
}
MouseArea {
anchors.fill: parent
onClicked: tabWidget.current = index
}
}
}
}
Item {
id: stack
width: tabWidget.width
anchors.top: header.bottom; anchors.bottom: tabWidget.bottom
}
}

View File

@ -1,109 +0,0 @@
/**
******************************************************************************
*
* @file versiondialog.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup CorePlugin Core Plugin
* @{
* @brief The Core GCS plugin
*****************************************************************************/
/*
* 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 "versiondialog.h"
#include "version_info/version_info.h"
#include "coreconstants.h"
#include "icore.h"
#include <utils/qtcassert.h>
#include <QtCore/QDate>
#include <QtCore/QFile>
#include <QtCore/QSysInfo>
#include <QDialogButtonBox>
#include <QGridLayout>
#include <QLabel>
#include <QPushButton>
#include <QTextBrowser>
using namespace Core;
using namespace Core::Internal;
using namespace Core::Constants;
VersionDialog::VersionDialog(QWidget *parent)
: QDialog(parent)
{
// We need to set the window icon explicitly here since for some reason the
// application icon isn't used when the size of the dialog is fixed (at least not on X11/GNOME)
setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png"));
setWindowTitle(tr("About OpenPilot GCS"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QGridLayout *layout = new QGridLayout(this);
layout->setSizeConstraint(QLayout::SetFixedSize);
const QString description = tr(
"<h3>OpenPilot Ground Control Station</h3>"
"GCS Revision: <b>%1</b><br/>"
"UAVO Hash: <b>%2</b><br/>"
"<br/>"
"Built from %3<br/>"
"Built on %4 at %5<br/>"
"Based on Qt %6 (%7 bit)<br/>"
"<br/>"
"&copy; %8, 2010-%9. All rights reserved.<br/>"
"<br/>"
"<small>This program is free software; you can redistribute it and/or modify<br/>"
"it under the terms of the GNU General Public License as published by<br/>"
"the Free Software Foundation; either version 3 of the License, or<br/>"
"(at your option) any later version.<br/>"
"<br/>"
"The program is provided AS IS with NO WARRANTY OF ANY KIND, "
"INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
"PARTICULAR PURPOSE.</small>"
).arg(
VersionInfo::revision().left(60), // %1
VersionInfo::uavoHash().left(8), // %2
VersionInfo::origin(), // $3
QLatin1String(__DATE__), // %4
QLatin1String(__TIME__), // %5
QLatin1String(QT_VERSION_STR), // %6
QString::number(QSysInfo::WordSize), // %7
QLatin1String(GCS_AUTHOR), // %8
VersionInfo::year() // %9
);
QLabel *copyRightLabel = new QLabel(description);
copyRightLabel->setWordWrap(true);
copyRightLabel->setOpenExternalLinks(true);
copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
QTC_ASSERT(closeButton, /**/);
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QLabel *logoLabel = new QLabel;
logoLabel->setPixmap(QPixmap(QLatin1String(":/core/images/openpilot_logo_128.png")));
layout->addWidget(logoLabel, 0, 0, 1, 1);
layout->addWidget(copyRightLabel, 0, 1, 4, 4);
layout->addWidget(buttonBox, 4, 0, 1, 5);
}

View File

@ -1,44 +0,0 @@
/**
******************************************************************************
*
* @file versiondialog.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup CorePlugin Core Plugin
* @{
* @brief The Core GCS plugin
*****************************************************************************/
/*
* 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 VERSIONDIALOG_H
#define VERSIONDIALOG_H
#include <QDialog>
namespace Core {
namespace Internal {
class VersionDialog : public QDialog {
Q_OBJECT
public:
explicit VersionDialog(QWidget *parent);
};
} // namespace Internal
} // namespace Core
#endif // VERSIONDIALOG_H