Merge branch 'master' into hostdev
This commit is contained in:
commit
cd9758f165
86
client/applymsg.h
Normal file
86
client/applymsg.h
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
Copyright (C) 2019 Srivats P.
|
||||
|
||||
This file is part of "Ostinato"
|
||||
|
||||
This is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
#ifndef _APPLY_MESSAGE_H
|
||||
#define _APPLY_MESSAGE_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMainWindow>
|
||||
#include <QProgressBar>
|
||||
#include <QTimer>
|
||||
|
||||
extern QMainWindow *mainWindow;
|
||||
|
||||
class ApplyMessage: public QDialog
|
||||
{
|
||||
public:
|
||||
ApplyMessage(QWidget *parent = Q_NULLPTR);
|
||||
|
||||
public slots:
|
||||
void show();
|
||||
virtual void done(int r);
|
||||
|
||||
private:
|
||||
QLabel *help_;
|
||||
QTimer *helpTimer_;
|
||||
};
|
||||
|
||||
ApplyMessage::ApplyMessage(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
auto layout = new QVBoxLayout(this);
|
||||
auto message = new QLabel(tr("Pushing configuration changes to agent "
|
||||
"and re-building packets ..."), this);
|
||||
auto progress = new QProgressBar(this);
|
||||
progress->setRange(0, 0);
|
||||
progress->setTextVisible(false);
|
||||
help_ = new QLabel(tr("<b>This may take some time</b>"), this);
|
||||
help_->setAlignment(Qt::AlignCenter);
|
||||
layout->addWidget(message);
|
||||
layout->addWidget(progress);
|
||||
layout->addWidget(help_);
|
||||
|
||||
helpTimer_ = new QTimer(this);
|
||||
helpTimer_->setSingleShot(true);
|
||||
helpTimer_->setInterval(4000);
|
||||
connect(helpTimer_, SIGNAL(timeout()), help_, SLOT(show()));
|
||||
}
|
||||
|
||||
void ApplyMessage::show()
|
||||
{
|
||||
help_->hide(); // shown when helpTimer_ expires
|
||||
|
||||
QWidget *parent = parentWidget();
|
||||
if (!parent)
|
||||
parent = mainWindow;
|
||||
move(parent->frameGeometry().center() - rect().center());
|
||||
setModal(true);
|
||||
QDialog::show();
|
||||
|
||||
helpTimer_->start();
|
||||
}
|
||||
|
||||
void ApplyMessage::done(int r)
|
||||
{
|
||||
helpTimer_->stop();
|
||||
QDialog::done(r);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.3 KiB |
@ -153,10 +153,16 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
this, SLOT(onNewVersion(QString)));
|
||||
updater->checkForNewVersion();
|
||||
|
||||
// Add the "Local" Port Group
|
||||
if (appParams.optLocalDrone()) {
|
||||
PortGroup *pg = new PortGroup;
|
||||
pgl->addPortGroup(*pg);
|
||||
}
|
||||
|
||||
if (appParams.argumentCount()) {
|
||||
QString fileName = appParams.argument(0);
|
||||
if (QFile::exists(fileName))
|
||||
on_actionOpenSession_triggered(fileName);
|
||||
openSession(fileName);
|
||||
else
|
||||
QMessageBox::information(NULL, qApp->applicationName(),
|
||||
QString("File not found: " + fileName));
|
||||
@ -201,7 +207,7 @@ MainWindow::~MainWindow()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionOpenSession_triggered(QString fileName)
|
||||
void MainWindow::openSession(QString fileName)
|
||||
{
|
||||
qDebug("Open Session Action (%s)", qPrintable(fileName));
|
||||
|
||||
@ -253,6 +259,11 @@ _exit:
|
||||
return;
|
||||
}
|
||||
|
||||
void MainWindow::on_actionOpenSession_triggered()
|
||||
{
|
||||
openSession();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionSaveSession_triggered()
|
||||
{
|
||||
qDebug("Save Session Action");
|
||||
|
@ -36,6 +36,7 @@ class MainWindow : public QMainWindow, private Ui::MainWindow
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
void openSession(QString fileName = QString());
|
||||
bool openSession(QString fileName, QString &error);
|
||||
bool saveSession(QString fileName, QString fileType, QString &error);
|
||||
|
||||
@ -55,7 +56,7 @@ public:
|
||||
~MainWindow();
|
||||
|
||||
public slots:
|
||||
void on_actionOpenSession_triggered(QString fileName = QString());
|
||||
void on_actionOpenSession_triggered();
|
||||
void on_actionSaveSession_triggered();
|
||||
void on_actionPreferences_triggered();
|
||||
void on_actionViewRestoreDefaults_triggered();
|
||||
|
@ -770,6 +770,8 @@ void PortGroup::processModifyStreamAck(int portIndex,
|
||||
_error_exit:
|
||||
mPorts[portIndex]->when_syncComplete();
|
||||
|
||||
emit applyFinished();
|
||||
|
||||
mainWindow->setEnabled(true);
|
||||
QApplication::restoreOverrideCursor();
|
||||
delete controller;
|
||||
|
@ -171,6 +171,7 @@ public:
|
||||
void processStreamStatsList(PbRpcController *controller);
|
||||
|
||||
signals:
|
||||
void applyFinished();
|
||||
void portGroupDataChanged(int portGroupId, int portId = 0xFFFF);
|
||||
void portListAboutToBeChanged(quint32 portGroupId);
|
||||
void portListChanged(quint32 portGroupId);
|
||||
|
@ -43,12 +43,6 @@ PortGroupList::PortGroupList()
|
||||
deviceGroupModelTester_ = new ModelTest(getDeviceGroupModel());
|
||||
deviceModelTester_ = new ModelTest(getDeviceModel());
|
||||
#endif
|
||||
|
||||
// Add the "Local" Port Group
|
||||
if (appParams.optLocalDrone()) {
|
||||
PortGroup *pg = new PortGroup;
|
||||
addPortGroup(*pg);
|
||||
}
|
||||
}
|
||||
|
||||
PortGroupList::~PortGroupList()
|
||||
|
@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
#include "portswindow.h"
|
||||
|
||||
#include "applymsg.h"
|
||||
#include "deviceswidget.h"
|
||||
#include "portconfigdialog.h"
|
||||
#include "settings.h"
|
||||
@ -52,6 +53,7 @@ PortsWindow::PortsWindow(PortGroupList *pgl, QWidget *parent)
|
||||
plm = pgl;
|
||||
|
||||
setupUi(this);
|
||||
applyMsg_ = new ApplyMessage();
|
||||
devicesWidget->setPortGroupList(plm);
|
||||
|
||||
tvPortList->header()->hide();
|
||||
@ -173,6 +175,7 @@ PortsWindow::~PortsWindow()
|
||||
{
|
||||
delete delegate;
|
||||
delete proxyPortModel;
|
||||
delete applyMsg_;
|
||||
}
|
||||
|
||||
int PortsWindow::portGroupCount()
|
||||
@ -647,6 +650,11 @@ void PortsWindow::on_pbApply_clicked()
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
disconnect(applyMsg_);
|
||||
connect(&(plm->portGroup(curPortGroup)), SIGNAL(applyFinished()),
|
||||
applyMsg_, SLOT(hide()));
|
||||
applyMsg_->show();
|
||||
|
||||
// FIXME(HI): shd this be a signal?
|
||||
//portGroup.when_configApply(port);
|
||||
// FIXME(MED): mixing port id and index!!!
|
||||
|
@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
#include "ui_portswindow.h"
|
||||
#include "portgrouplist.h"
|
||||
|
||||
class ApplyMessage;
|
||||
class QAbstractItemDelegate;
|
||||
class QProgressDialog;
|
||||
class QSortFilterProxyModel;
|
||||
@ -61,6 +62,7 @@ private:
|
||||
QString lastNewPortGroup;
|
||||
QAbstractItemDelegate *delegate;
|
||||
QSortFilterProxyModel *proxyPortModel;
|
||||
ApplyMessage *applyMsg_;
|
||||
|
||||
public slots:
|
||||
void showMyReservedPortsOnly(bool enabled);
|
||||
|
@ -49,6 +49,9 @@ int main(int argc, char *argv[])
|
||||
int exitCode = 0;
|
||||
QCoreApplication app(argc, argv);
|
||||
|
||||
qDebug("Version: %s", version);
|
||||
qDebug("Revision: %s", revision);
|
||||
|
||||
// TODO: command line options
|
||||
// -v (--version)
|
||||
// -h (--help)
|
||||
|
Loading…
Reference in New Issue
Block a user