File indexing completed on 2024-04-21 05:41:02

0001 /*
0002     SPDX-FileCopyrightText: 2011 Vishesh Yadav <vishesh3y@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef HG_SERVE_DIALOG
0008 #define HG_SERVE_DIALOG
0009 
0010 #include "dialogbase.h"
0011 
0012 class QSpinBox;
0013 class QTextEdit;
0014 class QLabel;
0015 class HgServeWrapper;
0016 
0017 /**
0018  * Implements dialog to Start and Stop Mercurial web server.
0019  * Several server instances can be handled.
0020  */
0021 class HgServeDialog : public DialogBase
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     explicit HgServeDialog(QWidget *parent = nullptr);
0027     void setupUI();
0028     void loadConfig();
0029 
0030 public Q_SLOTS:
0031     void slotStart();
0032     void slotStop();
0033     void slotBrowse(); // opens system defined browser with localhost:m_portNumber->value()
0034 
0035 private Q_SLOTS:
0036     void slotUpdateButtons();
0037     void slotServerError();
0038     void saveGeometry();
0039 
0040     /**
0041      * Append stdout and stderr to m_logEdit
0042      */
0043     void appendServerOutput(const QString &repoLocation, const QString &line);
0044 
0045 private:
0046     QSpinBox          *m_portNumber;
0047     QPushButton       *m_startButton;
0048     QPushButton       *m_stopButton;
0049     QPushButton       *m_browseButton;
0050     QTextEdit         *m_logEdit;
0051     QLabel            *m_repoPathLabel;
0052 
0053     HgServeWrapper    *m_serverWrapper;
0054 };
0055 
0056 #endif /* HG_SERVE_DIALOG */
0057