Remove obsolete UI files
This commit is contained in:
parent
d34edaa569
commit
31c781257b
5 changed files with 0 additions and 237 deletions
|
@ -1,37 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NoOfficialHangarMessage</class>
|
||||
<widget class="QWidget" name="NoOfficialHangarMessage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>607</width>
|
||||
<height>134</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>The official FlightGear aircraft hangar is not selected, so only the default aircraft will be available. You can add the official hangar by <a href="action:add-official"><span style=" text-decoration: underline; color:#0000ff;">clicking here</span></a>, or go to the 'add-ons' page to add other hangars or aircraft folders.</p><p><a href="action:hide"><span style=" text-decoration: underline; color:#0000ff;">Click here</span></a> to permanently hide this message.</p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,114 +0,0 @@
|
|||
#include "PreviewWindow.hxx"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
#include <QNetworkReply>
|
||||
#include <QDebug>
|
||||
|
||||
const int BORDER_SIZE = 16;
|
||||
|
||||
PreviewWindow::PreviewWindow(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, m_netAccess(new QNetworkAccessManager(this))
|
||||
{
|
||||
setWindowFlags(Qt::Popup);
|
||||
setModal(true);
|
||||
|
||||
m_closeIcon.load(":/preview/close-icon");
|
||||
m_leftIcon.load(":/preview/left-arrow-icon");
|
||||
m_rightIcon.load(":/preview/right-arrow-icon");
|
||||
}
|
||||
|
||||
void PreviewWindow::setUrls(QVariantList urls)
|
||||
{
|
||||
m_cache.clear();
|
||||
|
||||
Q_FOREACH (QVariant v, urls) {
|
||||
QUrl url = v.toUrl();
|
||||
QNetworkReply* reply = m_netAccess->get(QNetworkRequest(url));
|
||||
connect(reply, &QNetworkReply::finished, this, &PreviewWindow::onDownloadFinished);
|
||||
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onDownloadError(QNetworkReply::NetworkError)));
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewWindow::paintEvent(QPaintEvent *pe)
|
||||
{
|
||||
QUrl key = m_urls.at(m_currentPreview);
|
||||
QPixmap pm = m_cache.value(key.toString());
|
||||
|
||||
QPainter painter(this);
|
||||
painter.fillRect(rect(), Qt::black);
|
||||
|
||||
QRect imgRect = rect().adjusted(BORDER_SIZE, BORDER_SIZE, -BORDER_SIZE, -BORDER_SIZE);
|
||||
painter.drawPixmap(imgRect, pm);
|
||||
|
||||
QRect closeIconRect = m_closeIcon.rect();
|
||||
closeIconRect.moveTopRight(rect().topRight());
|
||||
painter.drawPixmap(closeIconRect, m_closeIcon);
|
||||
|
||||
QRect leftArrowRect = m_leftIcon.rect();
|
||||
unsigned int iconTop = rect().center().y() - (m_leftIcon.size().height() / 2);
|
||||
leftArrowRect.moveTopLeft(QPoint(0, iconTop));
|
||||
painter.drawPixmap(leftArrowRect, m_leftIcon);
|
||||
|
||||
QRect rightArrowRect = m_rightIcon.rect();
|
||||
rightArrowRect.moveTopRight(QPoint(width(), iconTop));
|
||||
painter.drawPixmap(rightArrowRect, m_rightIcon);
|
||||
}
|
||||
|
||||
void PreviewWindow::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
QRect closeIconRect = m_closeIcon.rect();
|
||||
closeIconRect.moveTopRight(rect().topRight());
|
||||
|
||||
QRect leftArrowRect = m_leftIcon.rect();
|
||||
unsigned int iconTop = rect().center().y() - (m_leftIcon.size().height() / 2);
|
||||
leftArrowRect.moveTopLeft(QPoint(0, iconTop));
|
||||
|
||||
QRect rightArrowRect = m_rightIcon.rect();
|
||||
rightArrowRect.moveTopRight(QPoint(width(), iconTop));
|
||||
|
||||
if (closeIconRect.contains(event->pos())) {
|
||||
close();
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
if (leftArrowRect.contains(event->pos())) {
|
||||
m_currentPreview = (m_currentPreview - 1) % m_urls.size();
|
||||
update();
|
||||
}
|
||||
|
||||
if (rightArrowRect.contains(event->pos())) {
|
||||
m_currentPreview = (m_currentPreview + 1) % m_urls.size();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewWindow::onDownloadFinished()
|
||||
{
|
||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
|
||||
|
||||
QImage img;
|
||||
if (!img.load(reply, nullptr)) {
|
||||
qWarning() << Q_FUNC_INFO << "failed to read image data from" << reply->url();
|
||||
return;
|
||||
}
|
||||
|
||||
m_cache.insert(reply->url().toString(), QPixmap::fromImage(img));
|
||||
m_urls.append(reply->url());
|
||||
|
||||
if (!isVisible()) {
|
||||
QSize winSize(img.width() + BORDER_SIZE * 2, img.height() + BORDER_SIZE * 2);
|
||||
resize(winSize);
|
||||
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
void PreviewWindow::onDownloadError(QNetworkReply::NetworkError errorCode)
|
||||
{
|
||||
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
|
||||
qWarning() << "failed to download:" << reply->url();
|
||||
qWarning() << reply->errorString();
|
||||
m_urls.removeOne(reply->url());
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
#ifndef PREVIEWWINDOW_H
|
||||
#define PREVIEWWINDOW_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include <QVariant>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QMap>
|
||||
#include <QNetworkReply>
|
||||
|
||||
class PreviewWindow : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PreviewWindow(QWidget *parent = 0);
|
||||
|
||||
void setUrls(QVariantList urls);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent *pe) override;
|
||||
|
||||
virtual void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void onDownloadError(QNetworkReply::NetworkError errorCode);
|
||||
|
||||
private:
|
||||
void onDownloadFinished();
|
||||
|
||||
unsigned int m_currentPreview = 0;
|
||||
QNetworkAccessManager* m_netAccess;
|
||||
QList<QUrl> m_urls;
|
||||
QMap<QUrl, QPixmap> m_cache;
|
||||
|
||||
QPixmap m_leftIcon, m_rightIcon, m_closeIcon;
|
||||
};
|
||||
|
||||
#endif // PREVIEWWINDOW_H
|
|
@ -1,16 +0,0 @@
|
|||
#include "aircraftpreviewwindow.h"
|
||||
|
||||
AircraftPreviewWindow::AircraftPreviewWindow(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
// setWindowFlags(); // frameless ?
|
||||
}
|
||||
|
||||
void AircraftPreviewWindow::setUrls(QList<QUrl> urls)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AircraftPreviewWindow::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
#ifndef AIRCRAFTPREVIEWWINDOW_H
|
||||
#define AIRCRAFTPREVIEWWINDOW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QUrl>
|
||||
|
||||
class AircraftPreviewWindow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AircraftPreviewWindow(QWidget *parent = 0);
|
||||
|
||||
void setUrls(QList<QUrl> urls);
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event) override;
|
||||
|
||||
private:
|
||||
unsigned int m_currentIndex = 0;
|
||||
|
||||
QList<QUrl> m_urls;
|
||||
QList<QPixmap> m_pixmaps; // lazily populated
|
||||
};
|
||||
|
||||
#endif // AIRCRAFTPREVIEWWINDOW_H
|
Loading…
Add table
Reference in a new issue