From: Konrad Rosenbaum Date: Mon, 11 Jul 2016 11:24:11 +0000 (+0200) Subject: create external admin client X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=86981262d5a8a8d4626ac3c611e9966b10597bbf;p=web%2Fkonrad%2Fsmoke.git create external admin client --- diff --git a/Makefile b/Makefile index cdac6fc..0072c48 100644 --- a/Makefile +++ b/Makefile @@ -107,6 +107,7 @@ client: wob taurus tzone wbase cd mainapp && $(QMAKE) $(QMAKEFLAGS) && $(MAKE) cd sessman && $(QMAKE) $(QMAKEFLAGS) && $(MAKE) cd plugins && $(QMAKE) $(QMAKEFLAGS) && $(MAKE) + cd adminapp && $(QMAKE) $(QMAKEFLAGS) && $(MAKE) taurus: cd taurus && $(QMAKE) $(QMCFG) $(QMAKEFLAGS) && $(MAKE) diff --git a/adminapp/adminapp.pro b/adminapp/adminapp.pro new file mode 100644 index 0000000..13f0989 --- /dev/null +++ b/adminapp/adminapp.pro @@ -0,0 +1,20 @@ +#Project File for MagicSmoke +# (c) Konrad Rosenbaum, 2016 + +TEMPLATE = app +TARGET = magicsmoke-admin + + +#main source files +SOURCES = main.cpp +INCLUDEPATH += . ../src ../src/mwin +LIBS+= -lmagicsmoke + +include (../basics.pri) + +include (../iface/iface.pri) +include (../commonlib/commonlib.pri) +include (../sesscli/sesscli.pri) + +#make sure dependencies are found +DEPENDPATH += $$INCLUDEPATH diff --git a/adminapp/main.cpp b/adminapp/main.cpp new file mode 100644 index 0000000..27d1c10 --- /dev/null +++ b/adminapp/main.cpp @@ -0,0 +1,48 @@ +// +// C++ Implementation: main +// +// Description: Main Program +// +// +// Author: Konrad Rosenbaum , (C) 2007-2016 +// +// Copyright: See README/COPYING.GPL files that come with this distribution +// +// + + +#include "aclwin.h" + +#include +#include +#include "msinterface.h" + +#include +#include "barcode-plugin.h" + + +int main(int argc,char**argv) +{ + //create global app + MApplication app(argc,argv); + + //init + app.initialize(); + + //get session + MSessionClient sc; + sc.connect(&sc,SIGNAL(sessionLost()),&app,SLOT(quit())); + sc.connect(&sc,SIGNAL(managerLost()),&app,SLOT(quit())); + if(sc.waitForSessionAvailable()){ + WTransaction::setLogPrefix("Admin-T"); + MSInterface*ms=new MSInterface(sc.currentProfileId()); + ms->loginSession(sc.currentUsername(), sc.currentSessionId()); + ms->initialize(); + MAclWindow::showWindow(nullptr); + }else{ + qDebug()<<"Unable to get session. Giving up."; + return 1; + } + + return app.exec(); +} diff --git a/sessman/login.cpp b/sessman/login.cpp index 9976746..be42348 100644 --- a/sessman/login.cpp +++ b/sessman/login.cpp @@ -120,7 +120,7 @@ void MLogin::loadProfile() void MLogin::initClients(MSessionManager*sm) { //was sman started by a slave? If so: do not allow selection. - if(sm->connectionCount()>0){ + if(sm->connectionCount()>0 || sm->haveSlave()){ clients->setEnabled(false); return; } diff --git a/sessman/sman.cpp b/sessman/sman.cpp index eff6959..b0637ae 100644 --- a/sessman/sman.cpp +++ b/sessman/sman.cpp @@ -69,6 +69,7 @@ MSessionManager::MSessionManager ( QObject* parent ) : QObject ( parent ) ls.write(mkey.toLatin1()+"\n"); ls.waitForBytesWritten(1000); ls.close(); + mhaveslave=true; } } @@ -334,6 +335,7 @@ QList> MSessionManager::menuItems() const _("@@main",tr("Start &Expert Client")); _("@wizard",tr("Start &Wizard")); _("@statistic",tr("Start &Statistics Client")); + _("@admin",tr("Start &Admin Client")); _("@print",tr("Start &Print@Home Daemon")); _("quit",tr("&Quit Session")); } diff --git a/sessman/sman.h b/sessman/sman.h index 3ef0db7..c726ac5 100644 --- a/sessman/sman.h +++ b/sessman/sman.h @@ -38,6 +38,7 @@ public: virtual QString profileName()const; int connectionCount()const{return mconnections.count();} + bool haveSlave()const{return mhaveslave;} virtual QList> menuItems()const; @@ -64,6 +65,7 @@ private: QListmconnections; QString mkey; QSystemTrayIcon*micon; + bool mhaveslave=false; void sendMenu(QLocalSocket*); void sendSessionInfo(QLocalSocket*); diff --git a/sessman/smoke-sm_de.ts b/sessman/smoke-sm_de.ts index 71a2c13..d6f2357 100644 --- a/sessman/smoke-sm_de.ts +++ b/sessman/smoke-sm_de.ts @@ -147,52 +147,57 @@ MSessionManager - + MagicSmoke Session Manager, waiting for login... MagicSmoke Session Manager, warte auf Login... - + Warning Warnung - + Cannot start a client while not logged in! Programm kann nicht gestartet werden wenn noch kein Login besteht! - + MagicSmoke Session Manager, logged in as %1 at %2. MagicSmoke Session Manager, eingeloggt als %1 auf Profil %2. - + &Configuration... &Konfigurieren... - + Start &Expert Client Starte &Experten-Programm - + Start &Wizard Starte &Wizard - + Start &Statistics Client Starte &Statistik-Programm - + + Start &Admin Client + Starte &Administrationsprogramm + + + Start &Print@Home Daemon Starte &Print@Home Hintergrundprogramm - + &Quit Session Session &Beenden diff --git a/sessman/smoke-sm_en.ts b/sessman/smoke-sm_en.ts index a9a1cc4..e58c53c 100644 --- a/sessman/smoke-sm_en.ts +++ b/sessman/smoke-sm_en.ts @@ -147,52 +147,57 @@ MSessionManager - + MagicSmoke Session Manager, waiting for login... - + Warning - + Cannot start a client while not logged in! - + MagicSmoke Session Manager, logged in as %1 at %2. - + &Configuration... - + Start &Expert Client - + Start &Wizard - + Start &Statistics Client - + + Start &Admin Client + + + + Start &Print@Home Daemon - + &Quit Session diff --git a/src/main.h b/src/main.h index 49d34de..98e9b51 100644 --- a/src/main.h +++ b/src/main.h @@ -15,11 +15,7 @@ #include -#ifdef MAGICSMOKE_LIB_BUILD -#define MAGICSMOKE_EXPORT Q_DECL_EXPORT -#else -#define MAGICSMOKE_EXPORT Q_DECL_IMPORT -#endif +#include "smokeexport.h" ///shortcut: the main function class MAGICSMOKE_EXPORT MagicSmokeMain diff --git a/src/mwin/aclwin.h b/src/mwin/aclwin.h index fc1fd7e..d4365e4 100644 --- a/src/mwin/aclwin.h +++ b/src/mwin/aclwin.h @@ -18,13 +18,14 @@ #include #include "tabwin.h" +#include "smokeexport.h" class MUserTab; class MHostTab; class MRoleTab; class MFlagTab; -class MAclWindow:public MTabWin +class MAGICSMOKE_EXPORT MAclWindow:public MTabWin { Q_OBJECT public: diff --git a/src/mwin/tabwin.h b/src/mwin/tabwin.h index 4435e04..d692e6b 100644 --- a/src/mwin/tabwin.h +++ b/src/mwin/tabwin.h @@ -18,13 +18,15 @@ #include #include +#include "smokeexport.h" + class QTabWidget; class QStackedWidget; class MSInterface; /**Main Overview Window*/ -class MTabWin:public QMainWindow +class MAGICSMOKE_EXPORT MTabWin:public QMainWindow { Q_OBJECT public: diff --git a/src/smokeexport.h b/src/smokeexport.h new file mode 100644 index 0000000..38658e3 --- /dev/null +++ b/src/smokeexport.h @@ -0,0 +1,10 @@ + +#ifndef MAGICSMOKE_EXPORT + +#ifdef MAGICSMOKE_LIB_BUILD +#define MAGICSMOKE_EXPORT Q_DECL_EXPORT +#else +#define MAGICSMOKE_EXPORT Q_DECL_IMPORT +#endif + +#endif