Example #1
0
cTrayIcon::cTrayIcon(cClipboardManager *ClipboardManager):QSystemTrayIcon()
{    
    m_ClipboardManager = ClipboardManager;

    connect(this,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(onTray(QSystemTrayIcon::ActivationReason)));

    connect(&m_Menu, SIGNAL(triggered(QAction*)), this, SLOT(onMenuSelection(QAction*)));
    setContextMenu(&m_Menu);
    m_Menu.addAction(tr("Disable"))->setData("SWITCH");
    m_Menu.addSeparator();
    m_Menu.addAction(tr("Paste files..."))->setData("PASTE_FILES");
    m_Menu.addSeparator();
    m_Menu.addAction(tr("Settings..."))->setData("SETTINGS");
    m_Menu.addSeparator();
    m_Menu.addAction(tr("Exit"))->setData("EXIT");

    setState(cClipboardManager::ENABLED);
    show();
}
Example #2
0
LRESULT CALLBACK windowProc(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam)
{
    switch (umsg)
    {
        case WM_CREATE:
            onCreate(hwnd);
            break;

        case WM_CLOSE:
            DestroyWindow(hwnd); // exit
            break;

        case WM_DESTROY:
            onDestroy(hwnd);
            break;

        case WM_SHELLNOTIFY:
            onTray(hwnd, wparam, lparam);
            break;

        case WM_TIMER:
            onTimer(hwnd, wparam, lparam);
            break;

        case WM_HOTKEY:
            onHotkey(hwnd, wparam, lparam);
            break;

        case WM_COMMAND:
            onCommand(hwnd, LOWORD(wparam), HIWORD(wparam), (HWND)lparam);
            SetForegroundWindow(tibia_getwindow()); // set focus to tibia window after using tray menu
            break;

        default:
            return DefWindowProc(hwnd, umsg, wparam, lparam);
    }
    return 0;
}
Example #3
0
void	MainWindowImpl::setSlots(void) {
	connect( actionExit,		SIGNAL( triggered() ),	this, SLOT( onActionExit() ) );
	connect( actionConnections,	SIGNAL( triggered() ),	this, SLOT( onActionConnections() ) );
	connect( actionHosts,		SIGNAL( triggered() ),	this, SLOT( onActionHosts() ) );
	connect( actionVariables,	SIGNAL( triggered() ),	this, SLOT( onActionVariables() ) );
	connect( actionProtocols,	SIGNAL( triggered() ),	this, SLOT( onActionProtocols() ) );
    connect( actionAdd,         SIGNAL( triggered() ),	this, SLOT( onActionAdd() ) );
	connect( actionEdit,		SIGNAL( triggered() ),	this, SLOT( onActionEdit() ) );
    connect( actionDel,         SIGNAL( triggered() ),	this, SLOT( onActionDel() ) );
	connect( actionOpen,		SIGNAL( triggered() ),	this, SLOT( onActionOpen() ) );
	connect( actionSettings,	SIGNAL( triggered() ),	this, SLOT( onActionSettings() ) );
	connect( actionBackupDB,	SIGNAL( triggered() ),	this, SLOT( onActionBackup() ) );
	connect( actionRestoreDB,	SIGNAL( triggered() ),	this, SLOT( onActionRestore() ) );
	connect( actionAbout,		SIGNAL( triggered() ),	this, SLOT( onActionAbout() ) );
	connect( actionAboutQt,		SIGNAL( triggered() ),	this, SLOT( onActionAboutQt() ) );
    connect( tray,              SIGNAL( activated ( QSystemTrayIcon::ActivationReason)), this, SLOT(onTray(QSystemTrayIcon::ActivationReason)));
	connect( actionHideRestore,	SIGNAL( triggered() ),	this, SLOT(onHideRestore()));
}