@ -1,10 +1,10 @@
/* BEGIN_COMMON_COPYRIGHT_HEADER
/* BEGIN_COMMON_COPYRIGHT_HEADER
* ( c ) LGPL2 +
* ( c ) LGPL2 +
*
*
* L x Qt - a lightweight , Qt based , desktop toolset
* L X Qt - a lightweight , Qt based , desktop toolset
* http : //razor-qt.org, http://lxde.org/
* http : //razor-qt.org, http://lxde.org/
*
*
* Copyright : 2010 - 2011 L x Qt team
* Copyright : 2010 - 2011 L X Qt team
* Authors :
* Authors :
* Petr Vanek < petr @ scribus . info >
* Petr Vanek < petr @ scribus . info >
* Hong Jen Yee ( PCMan ) < pcman . tw @ gmail . com >
* Hong Jen Yee ( PCMan ) < pcman . tw @ gmail . com >
@ -50,12 +50,12 @@
# define MAX_CRASHES_PER_APP 5
# define MAX_CRASHES_PER_APP 5
using namespace L x Qt;
using namespace L X Qt;
/**
/**
* @ brief the constructor , needs a valid modules . conf
* @ brief the constructor , needs a valid modules . conf
*/
*/
L xQtModuleManager: : Lx QtModuleManager( const QString & windowManager , QObject * parent )
L XQtModuleManager: : LX QtModuleManager( const QString & windowManager , QObject * parent )
: QObject ( parent ) ,
: QObject ( parent ) ,
mWindowManager ( windowManager ) ,
mWindowManager ( windowManager ) ,
mWmProcess ( new QProcess ( this ) ) ,
mWmProcess ( new QProcess ( this ) ) ,
@ -65,12 +65,12 @@ LxQtModuleManager::LxQtModuleManager(const QString & windowManager, QObject* par
mWaitLoop ( NULL )
mWaitLoop ( NULL )
{
{
connect ( mThemeWatcher , SIGNAL ( directoryChanged ( QString ) ) , SLOT ( themeFolderChanged ( QString ) ) ) ;
connect ( mThemeWatcher , SIGNAL ( directoryChanged ( QString ) ) , SLOT ( themeFolderChanged ( QString ) ) ) ;
connect ( L x Qt: : Settings : : globalSettings ( ) , SIGNAL ( lxqtThemeChanged ( ) ) , SLOT ( themeChanged ( ) ) ) ;
connect ( L X Qt: : Settings : : globalSettings ( ) , SIGNAL ( lxqtThemeChanged ( ) ) , SLOT ( themeChanged ( ) ) ) ;
qApp - > installNativeEventFilter ( this ) ;
qApp - > installNativeEventFilter ( this ) ;
}
}
void L xQtModuleManager: : startup ( Lx Qt: : Settings & s )
void L XQtModuleManager: : startup ( LX Qt: : Settings & s )
{
{
// The lxqt-confupdate can update the settings of the WM, so run it first.
// The lxqt-confupdate can update the settings of the WM, so run it first.
startConfUpdate ( ) ;
startConfUpdate ( ) ;
@ -94,7 +94,7 @@ void LxQtModuleManager::startup(LxQt::Settings& s)
themeChanged ( ) ;
themeChanged ( ) ;
}
}
void L x QtModuleManager: : startAutostartApps ( )
void L X QtModuleManager: : startAutostartApps ( )
{
{
// XDG autostart
// XDG autostart
XdgDesktopFileList fileList = XdgAutoStart : : desktopFileList ( ) ;
XdgDesktopFileList fileList = XdgAutoStart : : desktopFileList ( ) ;
@ -130,12 +130,12 @@ void LxQtModuleManager::startAutostartApps()
}
}
}
}
void L x QtModuleManager: : themeFolderChanged ( const QString & /*path*/ )
void L X QtModuleManager: : themeFolderChanged ( const QString & /*path*/ )
{
{
QString newTheme ;
QString newTheme ;
if ( ! QFileInfo ( mCurrentThemePath ) . exists ( ) )
if ( ! QFileInfo ( mCurrentThemePath ) . exists ( ) )
{
{
const QList < L x QtTheme> & allThemes = lxqtTheme . allThemes ( ) ;
const QList < L X QtTheme> & allThemes = lxqtTheme . allThemes ( ) ;
if ( ! allThemes . isEmpty ( ) )
if ( ! allThemes . isEmpty ( ) )
newTheme = allThemes [ 0 ] . name ( ) ;
newTheme = allThemes [ 0 ] . name ( ) ;
else
else
@ -144,7 +144,7 @@ void LxQtModuleManager::themeFolderChanged(const QString& /*path*/)
else
else
newTheme = lxqtTheme . currentTheme ( ) . name ( ) ;
newTheme = lxqtTheme . currentTheme ( ) . name ( ) ;
L x Qt: : Settings settings ( " lxqt " ) ;
L X Qt: : Settings settings ( " lxqt " ) ;
if ( newTheme = = settings . value ( " theme " ) )
if ( newTheme = = settings . value ( " theme " ) )
{
{
// force the same theme to be updated
// force the same theme to be updated
@ -156,7 +156,7 @@ void LxQtModuleManager::themeFolderChanged(const QString& /*path*/)
sync ( ) ;
sync ( ) ;
}
}
void L x QtModuleManager: : themeChanged ( )
void L X QtModuleManager: : themeChanged ( )
{
{
if ( ! mCurrentThemePath . isEmpty ( ) )
if ( ! mCurrentThemePath . isEmpty ( ) )
mThemeWatcher - > removePath ( mCurrentThemePath ) ;
mThemeWatcher - > removePath ( mCurrentThemePath ) ;
@ -168,7 +168,7 @@ void LxQtModuleManager::themeChanged()
}
}
}
}
void L xQtModuleManager: : startWm ( Lx Qt: : Settings * settings )
void L XQtModuleManager: : startWm ( LX Qt: : Settings * settings )
{
{
// if the WM is active do not run WM.
// if the WM is active do not run WM.
// all window managers must set their name according to the spec
// all window managers must set their name according to the spec
@ -206,7 +206,7 @@ void LxQtModuleManager::startWm(LxQt::Settings *settings)
// Maybe we can add a X-Wait-WM=true key in the desktop entry file?
// Maybe we can add a X-Wait-WM=true key in the desktop entry file?
}
}
void L x QtModuleManager: : startProcess ( const XdgDesktopFile & file )
void L X QtModuleManager: : startProcess ( const XdgDesktopFile & file )
{
{
if ( ! file . value ( " X-LXQt-Module " , false ) . toBool ( ) )
if ( ! file . value ( " X-LXQt-Module " , false ) . toBool ( ) )
{
{
@ -219,7 +219,7 @@ void LxQtModuleManager::startProcess(const XdgDesktopFile& file)
qWarning ( ) < < " Wrong desktop file " < < file . fileName ( ) ;
qWarning ( ) < < " Wrong desktop file " < < file . fileName ( ) ;
return ;
return ;
}
}
L xQtModule* proc = new Lx QtModule( file , this ) ;
L XQtModule* proc = new LX QtModule( file , this ) ;
connect ( proc , SIGNAL ( moduleStateChanged ( QString , bool ) ) , this , SIGNAL ( moduleStateChanged ( QString , bool ) ) ) ;
connect ( proc , SIGNAL ( moduleStateChanged ( QString , bool ) ) , this , SIGNAL ( moduleStateChanged ( QString , bool ) ) ) ;
proc - > start ( ) ;
proc - > start ( ) ;
@ -230,7 +230,7 @@ void LxQtModuleManager::startProcess(const XdgDesktopFile& file)
this , SLOT ( restartModules ( int , QProcess : : ExitStatus ) ) ) ;
this , SLOT ( restartModules ( int , QProcess : : ExitStatus ) ) ) ;
}
}
void L x QtModuleManager: : startProcess ( const QString & name )
void L X QtModuleManager: : startProcess ( const QString & name )
{
{
if ( ! mNameMap . contains ( name ) )
if ( ! mNameMap . contains ( name ) )
{
{
@ -245,18 +245,18 @@ void LxQtModuleManager::startProcess(const QString& name)
}
}
}
}
void L x QtModuleManager: : stopProcess ( const QString & name )
void L X QtModuleManager: : stopProcess ( const QString & name )
{
{
if ( mNameMap . contains ( name ) )
if ( mNameMap . contains ( name ) )
mNameMap [ name ] - > terminate ( ) ;
mNameMap [ name ] - > terminate ( ) ;
}
}
QStringList L x QtModuleManager: : listModules ( ) const
QStringList L X QtModuleManager: : listModules ( ) const
{
{
return QStringList ( mNameMap . keys ( ) ) ;
return QStringList ( mNameMap . keys ( ) ) ;
}
}
void L x QtModuleManager: : startConfUpdate ( )
void L X QtModuleManager: : startConfUpdate ( )
{
{
XdgDesktopFile desktop ( XdgDesktopFile : : ApplicationType , " :lxqt-confupdate " , " lxqt-confupdate --watch " ) ;
XdgDesktopFile desktop ( XdgDesktopFile : : ApplicationType , " :lxqt-confupdate " , " lxqt-confupdate --watch " ) ;
desktop . setValue ( " Name " , " LXQt config updater " ) ;
desktop . setValue ( " Name " , " LXQt config updater " ) ;
@ -264,9 +264,9 @@ void LxQtModuleManager::startConfUpdate()
startProcess ( desktop ) ;
startProcess ( desktop ) ;
}
}
void L x QtModuleManager: : restartModules ( int exitCode , QProcess : : ExitStatus exitStatus )
void L X QtModuleManager: : restartModules ( int exitCode , QProcess : : ExitStatus exitStatus )
{
{
L xQtModule* proc = qobject_cast < Lx QtModule* > ( sender ( ) ) ;
L XQtModule* proc = qobject_cast < LX QtModule* > ( sender ( ) ) ;
Q_ASSERT ( proc ) ;
Q_ASSERT ( proc ) ;
if ( ! proc - > isTerminating ( ) )
if ( ! proc - > isTerminating ( ) )
@ -303,7 +303,7 @@ void LxQtModuleManager::restartModules(int exitCode, QProcess::ExitStatus exitSt
}
}
L xQtModuleManager: : ~ Lx QtModuleManager( )
L XQtModuleManager: : ~ LX QtModuleManager( )
{
{
qApp - > removeNativeEventFilter ( this ) ;
qApp - > removeNativeEventFilter ( this ) ;
qDeleteAll ( mNameMap ) ;
qDeleteAll ( mNameMap ) ;
@ -313,7 +313,7 @@ LxQtModuleManager::~LxQtModuleManager()
/**
/**
* @ brief this logs us out by terminating our session
* @ brief this logs us out by terminating our session
* */
* */
void L x QtModuleManager: : logout ( )
void L X QtModuleManager: : logout ( )
{
{
// modules
// modules
ModulesMapIterator i ( mNameMap ) ;
ModulesMapIterator i ( mNameMap ) ;
@ -321,14 +321,14 @@ void LxQtModuleManager::logout()
{
{
i . next ( ) ;
i . next ( ) ;
qDebug ( ) < < " Module logout " < < i . key ( ) ;
qDebug ( ) < < " Module logout " < < i . key ( ) ;
L x QtModule* p = i . value ( ) ;
L X QtModule* p = i . value ( ) ;
p - > terminate ( ) ;
p - > terminate ( ) ;
}
}
i . toFront ( ) ;
i . toFront ( ) ;
while ( i . hasNext ( ) )
while ( i . hasNext ( ) )
{
{
i . next ( ) ;
i . next ( ) ;
L x QtModule* p = i . value ( ) ;
L X QtModule* p = i . value ( ) ;
if ( p - > state ( ) ! = QProcess : : NotRunning & & ! p - > waitForFinished ( ) )
if ( p - > state ( ) ! = QProcess : : NotRunning & & ! p - > waitForFinished ( ) )
{
{
qWarning ( ) < < QString ( " Module '%1' won't terminate ... killing. " ) . arg ( i . key ( ) ) ;
qWarning ( ) < < QString ( " Module '%1' won't terminate ... killing. " ) . arg ( i . key ( ) ) ;
@ -346,7 +346,7 @@ void LxQtModuleManager::logout()
QCoreApplication : : exit ( 0 ) ;
QCoreApplication : : exit ( 0 ) ;
}
}
QString L x QtModuleManager: : showWmSelectDialog ( )
QString L X QtModuleManager: : showWmSelectDialog ( )
{
{
WindowManagerList availableWM = getWindowManagerList ( true ) ;
WindowManagerList availableWM = getWindowManagerList ( true ) ;
if ( availableWM . count ( ) = = 1 )
if ( availableWM . count ( ) = = 1 )
@ -357,12 +357,12 @@ QString LxQtModuleManager::showWmSelectDialog()
return dlg . windowManager ( ) ;
return dlg . windowManager ( ) ;
}
}
void L x QtModuleManager: : resetCrashReport ( )
void L X QtModuleManager: : resetCrashReport ( )
{
{
mCrashReport . clear ( ) ;
mCrashReport . clear ( ) ;
}
}
bool L x QtModuleManager: : nativeEventFilter ( const QByteArray & eventType , void * message , long * result )
bool L X QtModuleManager: : nativeEventFilter ( const QByteArray & eventType , void * message , long * result )
{
{
if ( eventType ! = " xcb_generic_event_t " ) // We only want to handle XCB events
if ( eventType ! = " xcb_generic_event_t " ) // We only want to handle XCB events
return false ;
return false ;
@ -420,7 +420,7 @@ void lxqt_setenv_prepend(const char *env, const QByteArray &value, const QByteAr
lxqt_setenv ( env , orig ) ;
lxqt_setenv ( env , orig ) ;
}
}
L xQtModule: : Lx QtModule( const XdgDesktopFile & file , QObject * parent ) :
L XQtModule: : LX QtModule( const XdgDesktopFile & file , QObject * parent ) :
QProcess ( parent ) ,
QProcess ( parent ) ,
file ( file ) ,
file ( file ) ,
fileName ( QFileInfo ( file . fileName ( ) ) . fileName ( ) ) ,
fileName ( QFileInfo ( file . fileName ( ) ) . fileName ( ) ) ,
@ -429,7 +429,7 @@ LxQtModule::LxQtModule(const XdgDesktopFile& file, QObject* parent) :
connect ( this , SIGNAL ( stateChanged ( QProcess : : ProcessState ) ) , SLOT ( updateState ( QProcess : : ProcessState ) ) ) ;
connect ( this , SIGNAL ( stateChanged ( QProcess : : ProcessState ) ) , SLOT ( updateState ( QProcess : : ProcessState ) ) ) ;
}
}
void L x QtModule: : start ( )
void L X QtModule: : start ( )
{
{
mIsTerminating = false ;
mIsTerminating = false ;
QStringList args = file . expandExecString ( ) ;
QStringList args = file . expandExecString ( ) ;
@ -437,18 +437,18 @@ void LxQtModule::start()
QProcess : : start ( command , args ) ;
QProcess : : start ( command , args ) ;
}
}
void L x QtModule: : terminate ( )
void L X QtModule: : terminate ( )
{
{
mIsTerminating = true ;
mIsTerminating = true ;
QProcess : : terminate ( ) ;
QProcess : : terminate ( ) ;
}
}
bool L x QtModule: : isTerminating ( )
bool L X QtModule: : isTerminating ( )
{
{
return mIsTerminating ;
return mIsTerminating ;
}
}
void L x QtModule: : updateState ( QProcess : : ProcessState newState )
void L X QtModule: : updateState ( QProcess : : ProcessState newState )
{
{
if ( newState ! = QProcess : : Starting )
if ( newState ! = QProcess : : Starting )
emit moduleStateChanged ( fileName , ( newState = = QProcess : : Running ) ) ;
emit moduleStateChanged ( fileName , ( newState = = QProcess : : Running ) ) ;