Files
iDescriptor/src/virtuallocationwidget.h
T
2026-04-07 18:24:37 +00:00

89 lines
2.6 KiB
C++

/*
* iDescriptor: A free and open-source idevice management tool.
*
* Copyright (C) 2025 Uncore <https://github.com/uncor3>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef VIRTUAL_LOCATION_H
#define VIRTUAL_LOCATION_H
#include "appcontext.h"
#include "devdiskimagehelper.h"
#include "devdiskmanager.h"
#include "devmodewidget.h"
#include "iDescriptor-ui.h"
#include "iDescriptor.h"
#include "settingsmanager.h"
#include <QDebug>
#include <QDoubleValidator>
#include <QGeoCoordinate>
#include <QGridLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QMessageBox>
#include <QPushButton>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickItem>
#include <QQuickView>
#include <QQuickWidget>
#include <QTimer>
#include <QUrl>
#include <QVBoxLayout>
#include <QWidget>
class VirtualLocation : public QWidget
{
Q_OBJECT
public:
explicit VirtualLocation(const std::shared_ptr<iDescriptorDevice> device,
QWidget *parent = nullptr);
public slots:
void updateInputsFromMap(const QString &latitude, const QString &longitude);
private slots:
void onQuickWidgetStatusChanged(QQuickWidget::Status status);
void onInputChanged();
void onMapCenterChanged();
void onApplyClicked();
void updateMapFromInputs();
void onRecentLocationClicked(const QString &latitude,
const QString &longitude);
private:
void loadRecentLocations(QVBoxLayout *layout);
void refreshRecentLocations();
void addLocationButtons(QLayout *layout,
QList<QVariantMap> recentLocations);
void restoreButtons();
QQuickWidget *m_quickWidget;
QLineEdit *m_latitudeEdit;
QLineEdit *m_longitudeEdit;
QPushButton *m_applyButton;
QTimer m_updateTimer;
bool m_updatingFromInput = false;
const std::shared_ptr<iDescriptorDevice> m_device;
QVBoxLayout *m_rightLayout = nullptr;
QGroupBox *m_recentGroup = nullptr;
};
#endif // VIRTUAL_LOCATION_H