kopia lustrzana https://gitlab.com/eliggett/wfview
Only allow admin users to manage memories
rodzic
cf6c984429
commit
4cfcf94e37
|
@ -4,7 +4,7 @@
|
|||
#include "memories.h"
|
||||
#include "ui_memories.h"
|
||||
|
||||
memories::memories(bool slowLoad, QWidget *parent) :
|
||||
memories::memories(bool isAdmin, bool slowLoad, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
slowLoad(slowLoad),
|
||||
ui(new Ui::memories)
|
||||
|
@ -19,7 +19,10 @@ memories::memories(bool slowLoad, QWidget *parent) :
|
|||
this->setObjectName("memories");
|
||||
queue = cachingQueue::getInstance(this);
|
||||
rigCaps = queue->getRigCaps();
|
||||
|
||||
if (!isAdmin)
|
||||
{
|
||||
ui->disableEditing->setEnabled(false);
|
||||
}
|
||||
if (rigCaps == Q_NULLPTR)
|
||||
{
|
||||
// We have no rigCaps, so cannot continue
|
||||
|
|
|
@ -32,7 +32,7 @@ class memories : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit memories(bool slowLoad=false,QWidget *parent = nullptr);
|
||||
explicit memories(bool isAdmin, bool slowLoad=false,QWidget *parent = nullptr);
|
||||
~memories();
|
||||
void populate();
|
||||
|
||||
|
|
16
wfmain.cpp
16
wfmain.cpp
|
@ -443,8 +443,8 @@ void wfmain::openRig()
|
|||
emit connectionStatus(true); // Signal any other parts that need to know if we are connecting/connected.
|
||||
ui->connectBtn->setText("Cancel connection"); // We are attempting to connect
|
||||
connStatus = connConnecting;
|
||||
|
||||
// PET: This could be in a better place?
|
||||
isRadioAdmin = true; // Set user to admin, will be reset if not.
|
||||
// M0VSE: This could be in a better place maybe?
|
||||
if (prefs.audioSystem == tciAudio)
|
||||
{
|
||||
prefs.rxSetup.tci = tci;
|
||||
|
@ -502,6 +502,7 @@ void wfmain::makeRig()
|
|||
|
||||
connect(rig, SIGNAL(requestRadioSelection(QList<radio_cap_packet>)), this, SLOT(radioSelection(QList<radio_cap_packet>)));
|
||||
connect(rig, SIGNAL(setRadioUsage(quint8, bool, quint8, QString, QString)), selRad, SLOT(setInUse(quint8, bool, quint8, QString, QString)));
|
||||
connect(rig, SIGNAL(setRadioUsage(quint8, bool, quint8, QString, QString)), this, SLOT(radioInUse(quint8, bool, quint8, QString, QString)));
|
||||
connect(selRad, SIGNAL(selectedRadio(quint8)), rig, SLOT(setCurrentRadio(quint8)));
|
||||
// Rig comm setup:
|
||||
connect(this, SIGNAL(sendCommSetup(rigTypedef,unsigned char, udpPreferences, audioSetup, audioSetup, QString, quint16)), rig, SLOT(commSetup(rigTypedef,unsigned char, udpPreferences, audioSetup, audioSetup, QString, quint16)));
|
||||
|
@ -5163,7 +5164,7 @@ void wfmain::on_memoriesBtn_clicked()
|
|||
if (rigCaps != Q_NULLPTR) {
|
||||
if (memWindow == Q_NULLPTR) {
|
||||
// Add slowload option for background loading.
|
||||
memWindow = new memories(false);
|
||||
memWindow = new memories(isRadioAdmin, false);
|
||||
this->memWindow->connect(this, SIGNAL(haveMemory(memoryType)), memWindow, SLOT(receiveMemory(memoryType)));
|
||||
|
||||
memWindow->populate(); // Call populate to get the initial memories
|
||||
|
@ -6049,6 +6050,15 @@ void wfmain::receiveRigCaps(rigCapabilities* caps)
|
|||
getInitialRigState();
|
||||
}
|
||||
|
||||
|
||||
void wfmain::radioInUse(quint8 radio, bool admin, quint8 busy, QString user, QString ip)
|
||||
{
|
||||
Q_UNUSED(busy)
|
||||
Q_UNUSED(radio)
|
||||
qDebug(logSystem()) << "Is this user an admin?" << user << admin;
|
||||
isRadioAdmin = admin;
|
||||
}
|
||||
|
||||
/* USB Hotplug support added at the end of the file for convenience */
|
||||
#ifdef USB_HOTPLUG
|
||||
|
||||
|
|
4
wfmain.h
4
wfmain.h
|
@ -500,7 +500,7 @@ private slots:
|
|||
void receiveElapsed(bool sub, qint64 us);
|
||||
void connectionTimeout();
|
||||
void receiveRigCaps(rigCapabilities* caps);
|
||||
|
||||
void radioInUse(quint8 radio, bool admin, quint8 busy, QString user, QString ip);
|
||||
|
||||
private:
|
||||
Ui::wfmain *ui; // Main UI
|
||||
|
@ -822,7 +822,7 @@ private:
|
|||
QImage lcdImage;
|
||||
connectionStatus_t connStatus = connDisconnected;
|
||||
uchar currentReceiver = 0;
|
||||
|
||||
bool isRadioAdmin = true;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(udpPreferences)
|
||||
|
|
Ładowanie…
Reference in New Issue