diff --git a/src/blackgui/components/simbriefdownloaddialog.cpp b/src/blackgui/components/simbriefdownloaddialog.cpp new file mode 100644 index 000000000..7b9d3b49a --- /dev/null +++ b/src/blackgui/components/simbriefdownloaddialog.cpp @@ -0,0 +1,51 @@ +/* Copyright (C) 2019 + * 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. 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 "simbriefdownloaddialog.h" +#include "ui_simbriefdownloaddialog.h" + +using namespace BlackMisc::Aviation; + +namespace BlackGui +{ + namespace Components + { + CSimBriefDownloadDialog::CSimBriefDownloadDialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::CSimBriefDownloadDialog) + { + ui->setupUi(this); + this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); + } + + CSimBriefDownloadDialog::~CSimBriefDownloadDialog() + { } + + CSimBriefData CSimBriefDownloadDialog::getSimBriefData() const + { + return CSimBriefData(ui->le_SimBriefURL->text().trimmed(), ui->le_SimBriefUsername->text().trimmed()); + } + + void CSimBriefDownloadDialog::setSimBriefData(const CSimBriefData &data) + { + ui->le_SimBriefURL->setText(data.getUrl()); + ui->le_SimBriefUsername->setText(data.getUsername()); + } + + int CSimBriefDownloadDialog::exec() + { + this->setSimBriefData(m_simBrief.get()); + const int r = QDialog::exec(); + if (r == Accepted) + { + m_simBrief.set(this->getSimBriefData()); + } + return r; + } + } // ns +} // ns diff --git a/src/blackgui/components/simbriefdownloaddialog.h b/src/blackgui/components/simbriefdownloaddialog.h new file mode 100644 index 000000000..70b234fa4 --- /dev/null +++ b/src/blackgui/components/simbriefdownloaddialog.h @@ -0,0 +1,51 @@ +/* Copyright (C) 2019 + * 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. 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. + */ + +//! \file + +#ifndef BLACKGUI_COMPONENTS_SIMBRIEFDOWNLOADDIALOG_H +#define BLACKGUI_COMPONENTS_SIMBRIEFDOWNLOADDIALOG_H + +#include "blackmisc/aviation/simbriefdata.h" +#include +#include + +namespace Ui { class CSimBriefDownloadDialog; } +namespace BlackGui +{ + namespace Components + { + //! Download from SimBrief + class CSimBriefDownloadDialog : public QDialog + { + Q_OBJECT + + public: + //! Ctor + explicit CSimBriefDownloadDialog(QWidget *parent = nullptr); + + //! Dtor + virtual ~CSimBriefDownloadDialog() override; + + //! SimBrief data + BlackMisc::Aviation::CSimBriefData getSimBriefData() const; + + //! Set UI values from data + void setSimBriefData(const BlackMisc::Aviation::CSimBriefData &data); + + //! \copydoc QDialog::exec + virtual int exec() override; + + private: + QScopedPointer ui; + BlackMisc::CData m_simBrief { this }; + }; + } // ns +} // ns + +#endif // guard diff --git a/src/blackgui/components/simbriefdownloaddialog.ui b/src/blackgui/components/simbriefdownloaddialog.ui new file mode 100644 index 000000000..f3ee69d03 --- /dev/null +++ b/src/blackgui/components/simbriefdownloaddialog.ui @@ -0,0 +1,90 @@ + + + CSimBriefDownloadDialog + + + + 0 + 0 + 350 + 100 + + + + + 350 + 100 + + + + SimBrief download + + + + + + SimBrief username: + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + SimBrief URL: + + + + + + + + + + + + bb_DownloadDialog + accepted() + CSimBriefDownloadDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + bb_DownloadDialog + rejected() + CSimBriefDownloadDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +