mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-03 07:35:48 +08:00
80 lines
2.6 KiB
C++
80 lines
2.6 KiB
C++
/* Copyright (C) 2015
|
|
* 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.
|
|
*/
|
|
|
|
//! \file
|
|
|
|
#ifndef BLACKGUI_OVERLAYMESSAGES_FRAME_H
|
|
#define BLACKGUI_OVERLAYMESSAGES_FRAME_H
|
|
|
|
#include "blackgui/blackguiexport.h"
|
|
#include "blackgui/overlaymessages.h"
|
|
#include <QFrame>
|
|
|
|
namespace BlackGui
|
|
{
|
|
/*!
|
|
* Display status messages (nested in another widget)
|
|
*/
|
|
class BLACKGUI_EXPORT COverlayMessagesFrame : public QFrame
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
//! Constructor
|
|
explicit COverlayMessagesFrame(QWidget *parent = nullptr);
|
|
|
|
//! Destructor
|
|
~COverlayMessagesFrame();
|
|
|
|
//! Show the inner frame
|
|
void showStatusMessagesFrame();
|
|
|
|
//! Hide the inner frame
|
|
void hideStatusMessagesFrame();
|
|
|
|
//! \copydoc COverlayMessages::showMessagesWithConfirmation
|
|
void showMessagesWithConfirmation(const BlackMisc::CStatusMessageList &messages,
|
|
const QString &confirmationMessage,
|
|
std::function<void()> okLambda,
|
|
int defaultButton = QMessageBox::Cancel,
|
|
int timeOutMs = -1);
|
|
|
|
public slots:
|
|
//! \copydoc COverlayMessages::showMessages
|
|
void showMessages(const BlackMisc::CStatusMessageList &messages, int timeOutMs = -1);
|
|
|
|
//! \copydoc COverlayMessages::showMessage
|
|
void showMessage(const BlackMisc::CStatusMessage &message, int timeOutMs = -1);
|
|
|
|
//! \copydoc COverlayMessages::showTextMessage
|
|
void showTextMessage(const BlackMisc::Network::CTextMessage &textMessage, int timeOutMs = -1);
|
|
|
|
//! \copydoc COverlayMessages::showVariant
|
|
void showVariant(const BlackMisc::CVariant &variant, int timeOutMs = -1);
|
|
|
|
protected:
|
|
//! \copydoc QFrame::paintEvent
|
|
virtual void paintEvent(QPaintEvent *event) override;
|
|
|
|
//! \copydoc QFrame::keyPressEvent
|
|
virtual void keyPressEvent(QKeyEvent *event) override;
|
|
|
|
COverlayMessages *m_overlayMessages = nullptr; //!< embedded QFrame with Status messages
|
|
|
|
private:
|
|
//! Calculate inner frame size
|
|
QSize innerFrameSize() const;
|
|
|
|
//! Init the inner frame (if not yet initialized)
|
|
void initInnerFrame();
|
|
};
|
|
} // ns
|
|
|
|
#endif // guard
|