mirror of
https://github.com/Ximi1970/systray-x.git
synced 2026-07-05 22:49:22 +02:00
WIP Setup Win / refactor
This commit is contained in:
@@ -5,9 +5,59 @@
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
WindowCtrl::WindowCtrl(QObject *parent) : QObject(parent)
|
||||
WindowCtrlWin::WindowCtrlWin( QObject *parent) : QObject( parent )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Find the window with title
|
||||
*/
|
||||
bool WindowCtrlWin::findWindow( const QString& title )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display the window elements
|
||||
*/
|
||||
void WindowCtrlWin::displayWindowElements( const QString& title )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the Thunderbird window ID
|
||||
*/
|
||||
QList< WinId > WindowCtrlWin::getWinIds()
|
||||
{
|
||||
return m_tb_windows;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Minimize a window
|
||||
*/
|
||||
void WindowCtrlWin::minimizeWindow( WinId window )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Normalize a window
|
||||
*/
|
||||
void WindowCtrlWin::normalizeWindow( WinId window )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Hide a window
|
||||
*/
|
||||
void WindowCtrlWin::hideWindow( WinId window, bool state )
|
||||
{
|
||||
}
|
||||
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
@@ -6,6 +6,14 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
/*
|
||||
* Define the windows Id
|
||||
*/
|
||||
typedef unsigned long WinId;
|
||||
|
||||
/**
|
||||
* @brief The WindowCtrlWin class
|
||||
*/
|
||||
class WindowCtrlWin : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -19,6 +27,51 @@ class WindowCtrlWin : public QObject
|
||||
*/
|
||||
explicit WindowCtrlWin( QObject *parent = nullptr );
|
||||
|
||||
/**
|
||||
* @brief findWindow. Find window with title.
|
||||
*
|
||||
* @param title The title to find.
|
||||
*
|
||||
* @return State of the find.
|
||||
*/
|
||||
bool findWindow( const QString& title );
|
||||
|
||||
/**
|
||||
* @brief displayWindowElements. Display window elements.
|
||||
*
|
||||
* @param title The title to find.
|
||||
*/
|
||||
void displayWindowElements( const QString& title );
|
||||
|
||||
/**
|
||||
* @brief getWinIds. Get the Thunderbird window IDs.
|
||||
*
|
||||
* @return The list of window IDs.
|
||||
*/
|
||||
QList< WinId > getWinIds();
|
||||
|
||||
/**
|
||||
* @brief minimizeWindow. Minimize window.
|
||||
*
|
||||
* @param window The window.
|
||||
*/
|
||||
void minimizeWindow( WinId window );
|
||||
|
||||
/**
|
||||
* @brief normalizeWindow. Normalize window.
|
||||
*
|
||||
* @param window The window.
|
||||
*/
|
||||
void normalizeWindow( WinId window );
|
||||
|
||||
/**
|
||||
* @brief hideWindow. Hide window.
|
||||
*
|
||||
* @param window The window.
|
||||
* @param state The state of the window.
|
||||
*/
|
||||
void hideWindow( WinId window, bool state );
|
||||
|
||||
signals:
|
||||
|
||||
/**
|
||||
@@ -37,6 +90,20 @@ class WindowCtrlWin : public QObject
|
||||
* @brief signalWindowMinimuze. Signal minimize window.
|
||||
*/
|
||||
void signalWindowMinimize();
|
||||
|
||||
/**
|
||||
* @brief signalConsole. Send a console message.
|
||||
*
|
||||
* @param message The message.
|
||||
*/
|
||||
void signalConsole( QString message );
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief m_tb_window. The Thunderbird windows.
|
||||
*/
|
||||
QList< WinId > m_tb_windows;
|
||||
};
|
||||
|
||||
#endif // WINDOWCTRLWIN_H
|
||||
|
||||
@@ -9,13 +9,18 @@
|
||||
*/
|
||||
#include "windowctrl.h"
|
||||
|
||||
/*
|
||||
* System includes
|
||||
*/
|
||||
#include "preferences.h"
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
WindowCtrl::WindowCtrl( Preferences* pref, QObject *parent ) :
|
||||
#ifdef Q_OS_UNIX
|
||||
WindowCtrlUnix( parent )
|
||||
#elif Q_OS_WIN
|
||||
#elif defined Q_OS_WIN
|
||||
WindowCtrlWin( parent )
|
||||
#else
|
||||
public QObject
|
||||
@@ -40,7 +45,7 @@ void WindowCtrl::slotWindowTest1()
|
||||
|
||||
// Do something.
|
||||
|
||||
displayWindowAtoms( "- Mozilla Thunderbird" );
|
||||
displayWindowElements( "- Mozilla Thunderbird" );
|
||||
// findWindow( 4313 );
|
||||
|
||||
|
||||
@@ -149,9 +154,9 @@ void WindowCtrl::slotShowHide()
|
||||
{
|
||||
m_state = "normal";
|
||||
|
||||
foreach( unsigned long win_id, getWIds() )
|
||||
foreach( unsigned long win_id, getWinIds() )
|
||||
{
|
||||
skipTaskbarWindow( win_id, false );
|
||||
hideWindow( win_id, false );
|
||||
normalizeWindow( win_id );
|
||||
}
|
||||
|
||||
@@ -160,11 +165,11 @@ void WindowCtrl::slotShowHide()
|
||||
} else {
|
||||
m_state = "minimized";
|
||||
|
||||
foreach( unsigned long win_id, getWIds() )
|
||||
foreach( unsigned long win_id, getWinIds() )
|
||||
{
|
||||
if( m_minimize_hide )
|
||||
{
|
||||
skipTaskbarWindow( win_id, true );
|
||||
hideWindow( win_id, true );
|
||||
}
|
||||
minimizeWindow( win_id );
|
||||
}
|
||||
|
||||
@@ -16,14 +16,15 @@
|
||||
* Predefines
|
||||
*/
|
||||
class QWindow;
|
||||
class Preferences;
|
||||
|
||||
/**
|
||||
* @brief The WindowCtrl class.
|
||||
*/
|
||||
#ifdef Q_OS_UNIX
|
||||
class WindowCtrl : public WindowCtrlUnix
|
||||
#elif Q_OS_WIN
|
||||
class WindowCtrl : public WindowCtrl
|
||||
#elif defined Q_OS_WIN
|
||||
class WindowCtrl : public WindowCtrlWin
|
||||
#else
|
||||
class WindowCtrl : public QObject
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user