Example #1
0
void TableWidget::keyPressEvent(QKeyEvent *event)
{
	if (this->selectedItems().size() == 0)
	{
		QTableWidget::keyPressEvent(event);
		return;
	}
	for (int i=0;i<m_hotkeyList.size();i++)
	{
		if (event->modifiers() != Qt::NoModifier)
		{
			if (m_hotkeyList[i].first == event->key() && m_hotkeyList[i].second & event->modifiers())
			{
				qDebug() << "found event";
				emit hotKeyPressed(event->key(),event->modifiers());
				return;
			}
		}
		else
		{
			if (m_hotkeyList[i].first == event->key())
			{
				qDebug() << "found event2";
				emit hotKeyPressed(event->key(),event->modifiers());
				return;
			}
		}
	}
	//qDebug() << "Unhandled event:" << event->key() << event->modifiers();
	event->ignore();
	QTableWidget::keyPressEvent(event);
}
Example #2
0
dUpload::dUpload( const QString &file, QWidget *parent ) : QWidget( parent )
{
	ui.setupUi( this );
	ui.progress->setVisible( false );
	move( qApp->desktop()->screenGeometry().center() - rect().center() );

	m_icon.addFile( ":/dUpload.ico" );
	setWindowIcon( m_icon );

	droparea = new dropArea( this );
	connect( droparea, SIGNAL( changed( const QString &, const QString & ) ), this, SLOT( changed( const QString &, const QString & ) ) );
	connect( droparea, SIGNAL( clicked() ), this, SLOT( clicked() ) );
	ui.layout->addWidget( droparea, 0, 0 );

	QAbstractEventDispatcher::instance()->installNativeEventFilter( this );
	QNetworkProxyFactory::setUseSystemConfiguration( true );

	m_netman = new QNetworkAccessManager();
	connect( m_netman, SIGNAL( finished( QNetworkReply * ) ), this, SLOT( finished( QNetworkReply * ) ) );

	m_trayicon = new dTrayIcon( this );

	m_webcam_creating = false;

	//new dPlayerMpc( this );

#ifdef Q_OS_WIN
	m_dll = new dDll();
	connect( dSettings::instance(), &dSettings::settingsChanged, m_dll, &dDll::updateSettings );
#endif

	m_file = new dFile();

	setUserlogin( QString() );

	dExternal::instance( this );

	dGlobalHotKey::instance()->shortcut("Alt+B");
	dGlobalHotKey::instance()->shortcut("Alt+N");
	dGlobalHotKey::instance()->shortcut("Alt+V");
	dGlobalHotKey::instance()->shortcut("Alt+S");
	dGlobalHotKey::instance()->shortcut("Alt+E");
	dGlobalHotKey::instance()->shortcut("Alt+A");
	dGlobalHotKey::instance()->shortcut("Ctrl+Shift+S");
	dGlobalHotKey::instance()->shortcut("Ctrl+Shift+W");
	dGlobalHotKey::instance()->shortcut("Ctrl+Shift+F");
	dGlobalHotKey::instance()->shortcut("Ctrl+Shift+Alt+S");
	dGlobalHotKey::instance()->shortcut("Ctrl+Shift+Alt+F");

	connect( dGlobalHotKey::instance(), SIGNAL( hotKeyPressed( quint32 ) ), this, SLOT( hotKeyPressed( quint32 ) ) );

	if ( QFileInfo( file ).isFile() )
		changed( file );
}
Example #3
0
GlobalHotkey::GlobalHotkey(QObject *parent) :
	QObject(parent)
{
	_impl = new GlobalHotkeyPrivate;
	connect(_impl, SIGNAL(hotKeyPressed()), this, SLOT(onHotkeyPressed()));
	_enabled = true;
	_hotkey = 0;
}
Example #4
0
bool HotKey::winEvent(MSG *message, long *result)
{
    switch (message->message)
    {
    case WM_HOTKEY:
        emit hotKeyPressed((Qt::Key)0, (Qt::KeyboardModifier)0);
        return true;
    }
    return false;
}
Example #5
0
void HotKey::externalListenerError()
{
    QString out = externalListener->readAllStandardError();
    QStringList key = out.split(":");
    if (key.size() == 3)
    {
        if (key[0] == "HotKey")
            emit hotKeyPressed((Qt::Key)0, (Qt::KeyboardModifier)0);
    }
    //qDebug("%s", qPrintable(out));
}
bool GlobalHotkey::GlobalHotkeyPrivate::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
{
	Q_UNUSED(result);
	if (eventType == "xcb_generic_event_t") {
		xcb_generic_event_t* ev = static_cast<xcb_generic_event_t *>(message);
		if ((ev->response_type & 127) == XCB_KEY_PRESS)
		{
			xcb_key_press_event_t *k = (xcb_key_press_event_t *)ev;
			// Check if the key is one of the registered
			for (int i = 0; i < _grabbedKeys.size(); ++i)
				if (k->detail == _grabbedKeys[i].code && k->state == _grabbedKeys[i].mod)
				{
					emit hotKeyPressed();
					return true;
				}
		}
	}
	return false;
}
Example #7
0
void GlobalHotkey::onHotkeyPressed()
{
	if (_enabled)
		emit hotKeyPressed();
}
Example #8
0
/** ***************************************************************************/
void HotkeyManager::onHotkeyPressed() {
	if (_enabled)
		emit hotKeyPressed();
}