mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
84 lines
3.2 KiB
C++
84 lines
3.2 KiB
C++
/* Copyright (C) 2013
|
||
* swift project Community / Contributors
|
||
*
|
||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||
* contained in the LICENSE file.
|
||
*/
|
||
|
||
#include "blackgui/components/maininfoareacomponent.h"
|
||
#include "blackgui/components/settingscomponent.h"
|
||
#include "blackgui/guiactionbind.h"
|
||
#include "blackgui/guiapplication.h"
|
||
#include "blackmisc/aviation/altitude.h"
|
||
#include "blackmisc/pq/units.h"
|
||
#include "swiftguistd.h"
|
||
#include "ui_swiftguistd.h"
|
||
|
||
#include <QAction>
|
||
#include <QMenu>
|
||
#include <QObject>
|
||
#include <QScopedPointer>
|
||
#include <QStackedWidget>
|
||
#include <QtGlobal>
|
||
|
||
using namespace BlackGui;
|
||
using namespace BlackCore;
|
||
using namespace BlackMisc;
|
||
using namespace BlackMisc::PhysicalQuantities;
|
||
using namespace BlackMisc::Aviation;
|
||
|
||
void SwiftGuiStd::ps_onMenuClicked()
|
||
{
|
||
QObject *sender = QObject::sender();
|
||
if (sender == ui->menu_TestLocationsEDRY)
|
||
{
|
||
this->setTestPosition("N 049° 18' 17", "E 008° 27' 05", CAltitude(312, CAltitude::MeanSeaLevel, CLengthUnit::ft()));
|
||
}
|
||
else if (sender == ui->menu_TestLocationsEDNX)
|
||
{
|
||
this->setTestPosition("N 048° 14′ 22", "E 011° 33′ 41", CAltitude(486, CAltitude::MeanSeaLevel, CLengthUnit::m()));
|
||
}
|
||
else if (sender == ui->menu_TestLocationsEDDM)
|
||
{
|
||
this->setTestPosition("N 048° 21′ 14", "E 011° 47′ 10", CAltitude(448, CAltitude::MeanSeaLevel, CLengthUnit::m()));
|
||
}
|
||
else if (sender == ui->menu_TestLocationsEDDF)
|
||
{
|
||
this->setTestPosition("N 50° 2′ 0", "E 8° 34′ 14", CAltitude(100, CAltitude::MeanSeaLevel, CLengthUnit::m()));
|
||
}
|
||
else if (sender == ui->menu_TestLocationsLOWW)
|
||
{
|
||
this->setTestPosition("N 48° 7′ 6.3588", "E 16° 33′ 39.924", CAltitude(100, CAltitude::MeanSeaLevel, CLengthUnit::m()));
|
||
}
|
||
else if (sender == ui->menu_WindowFont)
|
||
{
|
||
this->ps_setMainPageToInfoArea();
|
||
ui->comp_MainInfoArea->selectSettingsTab(BlackGui::Components::CSettingsComponent::SettingTabGui);
|
||
}
|
||
else if (sender == ui->menu_InternalsPage)
|
||
{
|
||
ui->sw_MainMiddle->setCurrentIndex(MainPageInternals);
|
||
}
|
||
}
|
||
|
||
void SwiftGuiStd::initMenus()
|
||
{
|
||
Q_ASSERT(ui->menu_InfoAreas);
|
||
Q_ASSERT(ui->comp_MainInfoArea);
|
||
sGui->addMenuFile(*ui->menu_File);
|
||
sGui->addMenuInternals(*ui->menu_Internals);
|
||
sGui->addMenuWindow(*ui->menu_Window);
|
||
sGui->addMenuHelp(*ui->menu_Help);
|
||
ui->menu_InfoAreas->addActions(ui->comp_MainInfoArea->getInfoAreaSelectActions(true, ui->menu_InfoAreas));
|
||
|
||
// for hotkeys
|
||
const QString swift(CGuiActionBindHandler::pathSwiftPilotClient());
|
||
static const CActionBind swiftRoot(swift, CIcons::swift16()); // inserts action for root folder
|
||
Q_UNUSED(swiftRoot);
|
||
m_menuHotkeyHandlers.append(CGuiActionBindHandler::bindMenu(ui->menu_InfoAreas, swift + "Info areas"));
|
||
m_menuHotkeyHandlers.append(CGuiActionBindHandler::bindMenu(ui->menu_File, swift + "File"));
|
||
m_menuHotkeyHandlers.append(CGuiActionBindHandler::bindMenu(ui->menu_Window, swift + "Window"));
|
||
}
|