Beispiel #1
0
bool ATMainWindow_c::InitMenusAndActions()
{
	QAction *pAction;

	QMenu *pFileMenu	= new QMenu(this);
	pAction				= new QAction(QObject::tr("&Quit"), this);
	pAction->setShortcut(QObject::tr("CTRL+Q"));
	bool bRet			= QObject::connect(pAction, SIGNAL(triggered()), this, SLOT(slotTentativeQuit()));
	ATASSERT( bRet );

	pFileMenu->addAction( pAction );

	QMenu *pStyleMenu		= new QMenu(this);
	QStringList styleList	= QStyleFactory::keys();

	for( int i=0; i<styleList.count(); i++ )
	{
		ATNamedAction *pNamedAction = new ATNamedAction( styleList.at(i), this );
		ATASSERT( connect( pNamedAction, SIGNAL( signalTriggerNamed(QString) ), this, SLOT(slotChangeStyle(QString))) );
		pStyleMenu->addAction(pNamedAction);
	}

	QMenu *pHelpMenu	= new QMenu(this);
	pAction				= new QAction(QObject::tr("&About..."), this);
//	pAction->setShortcut(QObject::tr("F1"));
	ATASSERT( QObject::connect(pAction, SIGNAL(triggered()), this, SLOT(slotShowAbout())) );
	pHelpMenu->addAction(pAction);

	menuBar()->addMenu(pFileMenu)->setText(QObject::tr("File"));
	menuBar()->addMenu(pStyleMenu)->setText(QObject::tr("Style"));
	menuBar()->addMenu(pHelpMenu)->setText(QObject::tr("Help"));

	return true;
}
Beispiel #2
0
ATMainWindow_c::ATMainWindow_c( QWidget *vpParent ):
QMainWindow( vpParent ),
m_iconConnected( QPixmap( ":connected.png" ) ),
m_iconConnecting( QPixmap( ":connecting.png" ) ),
m_iconDisconnected( QPixmap( ":disconnected.png" ) ),
m_bHotkeyEnabled( false ),
m_bMinimizeToTray( false )
{
	m_pMainWindow = new ATSkeletonWindow(this);
	setCentralWidget( m_pMainWindow );

	ATVERIFY( connect( m_pMainWindow, SIGNAL( signalReadOptions() ), this, SLOT( slotReadOptions() ) ) );

	setWindowIcon( m_iconDisconnected );
	setWindowTitle( QString( "%1 %2" ).arg( APP_NICE_NAME ).arg( APP_VERSION ) );

	InitMenusAndActions();

	createTrayIcon();

	readSettings();

	updateOptions();

	DoRegisterHotKey();

	slotChangeStyle( m_strStyle );

	m_lastTrayTrigger.start();
}
int Style::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: slotChangeStyle((*reinterpret_cast< QString(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 1;
    }
    return _id;
}