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

Commit

Permalink
Merge branch 'master' of github.com:trueos/sysadm-ui-qt
Browse files Browse the repository at this point in the history
  • Loading branch information
beanpole135 committed Feb 17, 2017
2 parents aa509ee + e142a86 commit 8913850
Show file tree
Hide file tree
Showing 31 changed files with 4,646 additions and 3,840 deletions.
2 changes: 2 additions & 0 deletions port-files/pkg-plist
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
bin/sysadm
bin/sysadm-client
share/applications/sysadm-client.desktop
share/applications/sysadm-moused.desktop
share/applications/sysadm-updatemanager.desktop
share/applications/pccontrol.desktop
share/applications/appcafe.desktop
etc/xdg/autostart/sysadm-client-auto.desktop
Expand Down
14 changes: 8 additions & 6 deletions src-qt5/Core/sysadm-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,19 @@ QString sysadm_client::bridgedHostname(QString bridge_id){
//Check if the sysadm server is running on the local system
bool sysadm_client::localhostAvailable(){
#ifdef __FreeBSD__
/*QProcess P;
P.start("sockstat -l46 -P tcp -p "+QString::number(WSPORTDEFAULT) );
P.waitForFinished();
if( 0 == P.exitCode() ){
if( QString(P.readAllStandardOutput()).contains(QString::number(WSPORTDEFAULT)) ){ return true; }
}*/
return QFile::exists("/usr/local/bin/sysadm-binary"); //server available
#endif
return false;
}

bool sysadm_client::localhostRunning(){
//If the local server is running
#ifdef __FreeBSD__
return (0 == system("service sysadm status"));
#endif
return false;
}

// Register for Event Notifications (no notifications by default)
void sysadm_client::registerForEvents(EVENT_TYPE event, bool receive){
bool set = events.contains(event);
Expand Down
3 changes: 2 additions & 1 deletion src-qt5/Core/sysadm-client.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class sysadm_client : public QObject{
QString bridgedHostname(QString bridge_id);

//Check if the sysadm server is running on the local system
static bool localhostAvailable();
static bool localhostAvailable(); //If the server is installed
static bool localhostRunning(); //If the local server is running

// Register for Event Notifications (no notifications by default)
void registerForEvents(EVENT_TYPE event, bool receive = true);
Expand Down
4 changes: 2 additions & 2 deletions src-qt5/gui_client/MenuItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ void CoreAction::CoreEvent(sysadm_client::EVENT_TYPE type, QJsonValue val){
else{
QString msg, icon;
int priority = 3;
if(stat=="rebootrequired"){ msg = tr("%1: Reboot required to finish updates"); icon = ":/icons/black/sync-circled.svg"; }
else if(stat=="updaterunning"){ msg = tr("%1: Updates in progress"); icon = ":/icons/grey/sync.svg"; }
if(stat=="rebootrequired"){ msg = tr("%1: Updates ready: Restart system to proceed"); icon = ":/icons/black/sync-circled.svg"; }
else if(stat=="updaterunning"){ msg = tr("%1: Updates downloading"); icon = ":/icons/grey/sync.svg"; }
else if(stat=="updatesavailable"){ msg = tr("%1: Updates available"); icon = ":/icons/black/sync.svg"; }
if(val.toObject().value("updates").toObject().contains("priority")){
priority = val.toObject().value("updates").toObject().value("priority").toString().section("-",0,0).simplified().toInt();
Expand Down
16 changes: 12 additions & 4 deletions src-qt5/gui_client/TrayUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ sysadm_tray::sysadm_tray() : QSystemTrayIcon(){
iconTimer = new QTimer(this);
iconTimer->setInterval(1500); //1.5 seconds
connect(iconTimer, SIGNAL(timeout()), this, SLOT(UpdateIcon()) );
msgTimer = new QTimer(this);
msgTimer->setInterval(300); //~1/3 seconds
msgTimer->setSingleShot(true);
connect(msgTimer, SIGNAL(timeout()), this, SLOT(updateMessageMenu()) );

//Load any CORES
updateCoreList();

Expand Down Expand Up @@ -246,15 +251,17 @@ void sysadm_tray::ShowMessage(HostMessage msg){
}
//Now update the user-viewable menu's
if(refreshlist){
QTimer::singleShot(10,this, SLOT(updateMessageMenu()) );
msgTimer->start();
//QTimer::singleShot(10,this, SLOT(updateMessageMenu()) );
}
}

void sysadm_tray::ClearMessage(QString host, QString msg_id){
//qDebug() << "Clear Message:" << host << msg_id;
if(MESSAGES.contains(host+"/"+msg_id)){
MESSAGES.remove(host+"/"+msg_id);
QTimer::singleShot(10,this, SLOT(updateMessageMenu()) );
msgTimer->start();
//QTimer::singleShot(10,this, SLOT(updateMessageMenu()) );
}
}

Expand All @@ -271,11 +278,11 @@ void sysadm_tray::MessageTriggered(QAction *act){
MESSAGES.insert(keys[i],msg);
}
}
QTimer::singleShot(10,this, SLOT(updateMessageMenu()) );
msgTimer->start();
}else if(MESSAGES.contains(act->whatsThis())){
//Open the designated host
HostMessage msg = MESSAGES[act->whatsThis()];
QTimer::singleShot(10,this, SLOT(updateMessageMenu()) );
msgTimer->start();
if(act->whatsThis().section("/",-1)=="updates"){ OpenCore(msg.host_id, "page_updates"); }
else if(act->whatsThis().section("/",-1)=="pkg"){ OpenCore(msg.host_id, "page_pkg"); }
else if(act->whatsThis().count("/")==2){ OpenCore(msg.host_id, "page_"+act->whatsThis().section("/",1,1)); } //Life Preserver Message
Expand Down Expand Up @@ -304,6 +311,7 @@ void sysadm_tray::updateMessageMenu(){
}else if( acts[i]->whatsThis()!="clearall" && !acts[i]->whatsThis().isEmpty() ) {
//qDebug() << " - Remove Action";
msgMenu->removeAction(acts[i]);
acts[i]->deleteLater();
}
}
//Now add in any new messages
Expand Down
2 changes: 1 addition & 1 deletion src-qt5/gui_client/TrayUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class sysadm_tray : public QSystemTrayIcon{
QIcon generateMsgIcon(QString iconfile, int priority);

//Timers/flags to control the icon "flash" frequency
QTimer *iconTimer;
QTimer *iconTimer, *msgTimer;
bool iconreset;
int cPriority;

Expand Down
11 changes: 11 additions & 0 deletions src-qt5/gui_client/extras/sysadm-moused.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Version=1.0
Type=Application
StartupNotify=true
Comment=SysAdm: moused configuration
Categories=Settings;
GenericName=moused settings
Name=Mouse Configuration
TryExec=sysadm-client
Exec=sysadm-client -page page_moused
Icon=preferences-desktop-mouse
11 changes: 11 additions & 0 deletions src-qt5/gui_client/extras/sysadm-updatemanager.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Version=1.0
Type=Application
StartupNotify=true
Comment=TrueOS: Update Manager
Categories=Settings;
GenericName=system update manager
Name=System Updates
TryExec=pc-updatemanager
Exec=sysadm-client -page page_updates
Icon=trueos
4 changes: 3 additions & 1 deletion src-qt5/gui_client/gui_client.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ freebsd-*{
#Install the XDG registration files
xdg.files=extras/sysadm-client.desktop \
extras/appcafe.desktop \
extras/pccontrol.desktop
extras/pccontrol.desktop \
extras/sysadm-updatemanager.desktop \
extras/sysadm-moused.desktop
xdg.path=/usr/local/share/applications

xdg_auto.files=extras/sysadm-client-auto.desktop
Expand Down
Loading

0 comments on commit 8913850

Please sign in to comment.