Skip to content
This repository was archived by the owner on Dec 4, 2020. It is now read-only.

Commit 8913850

Browse files
committed
Merge branch 'master' of github.com:trueos/sysadm-ui-qt
2 parents aa509ee + e142a86 commit 8913850

31 files changed

+4646
-3840
lines changed

port-files/pkg-plist

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
bin/sysadm
22
bin/sysadm-client
33
share/applications/sysadm-client.desktop
4+
share/applications/sysadm-moused.desktop
5+
share/applications/sysadm-updatemanager.desktop
46
share/applications/pccontrol.desktop
57
share/applications/appcafe.desktop
68
etc/xdg/autostart/sysadm-client-auto.desktop

src-qt5/Core/sysadm-client.cpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,19 @@ QString sysadm_client::bridgedHostname(QString bridge_id){
148148
//Check if the sysadm server is running on the local system
149149
bool sysadm_client::localhostAvailable(){
150150
#ifdef __FreeBSD__
151-
/*QProcess P;
152-
P.start("sockstat -l46 -P tcp -p "+QString::number(WSPORTDEFAULT) );
153-
P.waitForFinished();
154-
if( 0 == P.exitCode() ){
155-
if( QString(P.readAllStandardOutput()).contains(QString::number(WSPORTDEFAULT)) ){ return true; }
156-
}*/
157151
return QFile::exists("/usr/local/bin/sysadm-binary"); //server available
158152
#endif
159153
return false;
160154
}
161155

156+
bool sysadm_client::localhostRunning(){
157+
//If the local server is running
158+
#ifdef __FreeBSD__
159+
return (0 == system("service sysadm status"));
160+
#endif
161+
return false;
162+
}
163+
162164
// Register for Event Notifications (no notifications by default)
163165
void sysadm_client::registerForEvents(EVENT_TYPE event, bool receive){
164166
bool set = events.contains(event);

src-qt5/Core/sysadm-client.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ class sysadm_client : public QObject{
6868
QString bridgedHostname(QString bridge_id);
6969

7070
//Check if the sysadm server is running on the local system
71-
static bool localhostAvailable();
71+
static bool localhostAvailable(); //If the server is installed
72+
static bool localhostRunning(); //If the local server is running
7273

7374
// Register for Event Notifications (no notifications by default)
7475
void registerForEvents(EVENT_TYPE event, bool receive = true);

src-qt5/gui_client/MenuItem.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ void CoreAction::CoreEvent(sysadm_client::EVENT_TYPE type, QJsonValue val){
8282
else{
8383
QString msg, icon;
8484
int priority = 3;
85-
if(stat=="rebootrequired"){ msg = tr("%1: Reboot required to finish updates"); icon = ":/icons/black/sync-circled.svg"; }
86-
else if(stat=="updaterunning"){ msg = tr("%1: Updates in progress"); icon = ":/icons/grey/sync.svg"; }
85+
if(stat=="rebootrequired"){ msg = tr("%1: Updates ready: Restart system to proceed"); icon = ":/icons/black/sync-circled.svg"; }
86+
else if(stat=="updaterunning"){ msg = tr("%1: Updates downloading"); icon = ":/icons/grey/sync.svg"; }
8787
else if(stat=="updatesavailable"){ msg = tr("%1: Updates available"); icon = ":/icons/black/sync.svg"; }
8888
if(val.toObject().value("updates").toObject().contains("priority")){
8989
priority = val.toObject().value("updates").toObject().value("priority").toString().section("-",0,0).simplified().toInt();

src-qt5/gui_client/TrayUI.cpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ sysadm_tray::sysadm_tray() : QSystemTrayIcon(){
2626
iconTimer = new QTimer(this);
2727
iconTimer->setInterval(1500); //1.5 seconds
2828
connect(iconTimer, SIGNAL(timeout()), this, SLOT(UpdateIcon()) );
29+
msgTimer = new QTimer(this);
30+
msgTimer->setInterval(300); //~1/3 seconds
31+
msgTimer->setSingleShot(true);
32+
connect(msgTimer, SIGNAL(timeout()), this, SLOT(updateMessageMenu()) );
33+
2934
//Load any CORES
3035
updateCoreList();
3136

@@ -246,15 +251,17 @@ void sysadm_tray::ShowMessage(HostMessage msg){
246251
}
247252
//Now update the user-viewable menu's
248253
if(refreshlist){
249-
QTimer::singleShot(10,this, SLOT(updateMessageMenu()) );
254+
msgTimer->start();
255+
//QTimer::singleShot(10,this, SLOT(updateMessageMenu()) );
250256
}
251257
}
252258

253259
void sysadm_tray::ClearMessage(QString host, QString msg_id){
254260
//qDebug() << "Clear Message:" << host << msg_id;
255261
if(MESSAGES.contains(host+"/"+msg_id)){
256262
MESSAGES.remove(host+"/"+msg_id);
257-
QTimer::singleShot(10,this, SLOT(updateMessageMenu()) );
263+
msgTimer->start();
264+
//QTimer::singleShot(10,this, SLOT(updateMessageMenu()) );
258265
}
259266
}
260267

@@ -271,11 +278,11 @@ void sysadm_tray::MessageTriggered(QAction *act){
271278
MESSAGES.insert(keys[i],msg);
272279
}
273280
}
274-
QTimer::singleShot(10,this, SLOT(updateMessageMenu()) );
281+
msgTimer->start();
275282
}else if(MESSAGES.contains(act->whatsThis())){
276283
//Open the designated host
277284
HostMessage msg = MESSAGES[act->whatsThis()];
278-
QTimer::singleShot(10,this, SLOT(updateMessageMenu()) );
285+
msgTimer->start();
279286
if(act->whatsThis().section("/",-1)=="updates"){ OpenCore(msg.host_id, "page_updates"); }
280287
else if(act->whatsThis().section("/",-1)=="pkg"){ OpenCore(msg.host_id, "page_pkg"); }
281288
else if(act->whatsThis().count("/")==2){ OpenCore(msg.host_id, "page_"+act->whatsThis().section("/",1,1)); } //Life Preserver Message
@@ -304,6 +311,7 @@ void sysadm_tray::updateMessageMenu(){
304311
}else if( acts[i]->whatsThis()!="clearall" && !acts[i]->whatsThis().isEmpty() ) {
305312
//qDebug() << " - Remove Action";
306313
msgMenu->removeAction(acts[i]);
314+
acts[i]->deleteLater();
307315
}
308316
}
309317
//Now add in any new messages

src-qt5/gui_client/TrayUI.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class sysadm_tray : public QSystemTrayIcon{
3535
QIcon generateMsgIcon(QString iconfile, int priority);
3636

3737
//Timers/flags to control the icon "flash" frequency
38-
QTimer *iconTimer;
38+
QTimer *iconTimer, *msgTimer;
3939
bool iconreset;
4040
int cPriority;
4141

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Desktop Entry]
2+
Version=1.0
3+
Type=Application
4+
StartupNotify=true
5+
Comment=SysAdm: moused configuration
6+
Categories=Settings;
7+
GenericName=moused settings
8+
Name=Mouse Configuration
9+
TryExec=sysadm-client
10+
Exec=sysadm-client -page page_moused
11+
Icon=preferences-desktop-mouse
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[Desktop Entry]
2+
Version=1.0
3+
Type=Application
4+
StartupNotify=true
5+
Comment=TrueOS: Update Manager
6+
Categories=Settings;
7+
GenericName=system update manager
8+
Name=System Updates
9+
TryExec=pc-updatemanager
10+
Exec=sysadm-client -page page_updates
11+
Icon=trueos

src-qt5/gui_client/gui_client.pro

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ freebsd-*{
2020
#Install the XDG registration files
2121
xdg.files=extras/sysadm-client.desktop \
2222
extras/appcafe.desktop \
23-
extras/pccontrol.desktop
23+
extras/pccontrol.desktop \
24+
extras/sysadm-updatemanager.desktop \
25+
extras/sysadm-moused.desktop
2426
xdg.path=/usr/local/share/applications
2527

2628
xdg_auto.files=extras/sysadm-client-auto.desktop

0 commit comments

Comments
 (0)