File indexing completed on 2025-05-04 05:17:22
0001 /* 0002 SPDX-FileCopyrightText: 2021 Hamed Masafi <hamed.masfi@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "libkommitwidgets_export.h" 0010 0011 #ifdef LIBKOMMIT_WIDGET_USE_KF 0012 #include <KXmlGuiWindow> 0013 #endif 0014 0015 class QEventLoop; 0016 class LIBKOMMITWIDGETS_EXPORT AppMainWindow : public 0017 #ifdef LIBKOMMIT_WIDGET_USE_KF 0018 KXmlGuiWindow 0019 #else 0020 QMainWindow 0021 #endif 0022 { 0023 Q_OBJECT 0024 0025 public: 0026 enum DialogCode { Rejected, Accepted }; 0027 0028 explicit AppMainWindow(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); 0029 0030 int exec(); 0031 void showModal(); 0032 void accept(); 0033 void reject(); 0034 void setVisible(bool visible); 0035 0036 protected: 0037 void keyPressEvent(QKeyEvent *event); 0038 0039 private: 0040 QEventLoop *mLoop{nullptr}; 0041 bool mIsModal{false}; 0042 int mReturnCode{0}; 0043 };