DatabaseTabWidget::DatabaseTabWidget(QWidget* parent)
    : QTabWidget(parent)
{
    DragTabBar* tabBar = new DragTabBar(this);
    tabBar->setDrawBase(false);
    setTabBar(tabBar);

    connect(this, SIGNAL(tabCloseRequested(int)), SLOT(closeDatabase(int)));
    connect(autoType(), SIGNAL(globalShortcutTriggered()), SLOT(performGlobalAutoType()));
}
示例#2
0
DatabaseTabWidget::DatabaseTabWidget(QWidget* parent)
    : QTabWidget(parent),
      m_fileWatcher(new QFileSystemWatcher(this))
{
    DragTabBar* tabBar = new DragTabBar(this);
    tabBar->setDrawBase(false);
    setTabBar(tabBar);

    connect(this, SIGNAL(tabCloseRequested(int)), SLOT(closeDatabase(int)));
    connect(autoType(), SIGNAL(globalShortcutTriggered()), SLOT(performGlobalAutoType()));
    connect(m_fileWatcher, SIGNAL(fileChanged(QString)), SLOT(fileChanged(QString)));
}
示例#3
0
DatabaseTabWidget::DatabaseTabWidget(QWidget* parent)
    : QTabWidget(parent)
    , m_dbWidgetSateSync(new DatabaseWidgetStateSync(this))
{
    DragTabBar* tabBar = new DragTabBar(this);
    setTabBar(tabBar);
    setDocumentMode(true);

    connect(this, SIGNAL(tabCloseRequested(int)), SLOT(closeDatabase(int)));
    connect(this, SIGNAL(currentChanged(int)), SLOT(emitActivateDatabaseChanged()));
    connect(this, SIGNAL(activateDatabaseChanged(DatabaseWidget*)), m_dbWidgetSateSync, SLOT(setActive(DatabaseWidget*)));
    connect(autoType(), SIGNAL(globalShortcutTriggered()), SLOT(performGlobalAutoType()));
}
示例#4
0
int AutoTypePlatformX11::platformEventFilter(void* event)
{
    xcb_generic_event_t* genericEvent = static_cast<xcb_generic_event_t*>(event);
    quint8 type = genericEvent->response_type & 0x7f;

    if (type == XCB_KEY_PRESS || type == XCB_KEY_RELEASE) {
        xcb_key_press_event_t* keyPressEvent = static_cast<xcb_key_press_event_t*>(event);
        if (keyPressEvent->detail == m_currentGlobalKeycode
                && (keyPressEvent->state & m_modifierMask) == m_currentGlobalNativeModifiers
                && !QApplication::focusWidget()
                && m_loaded) {
            if (type == XCB_KEY_PRESS) {
                Q_EMIT globalShortcutTriggered();
            }

            return 1;
        }
    }
    else if (type == XCB_MAPPING_NOTIFY) {
        xcb_mapping_notify_event_t* mappingNotifyEvent = static_cast<xcb_mapping_notify_event_t*>(event);
        if (mappingNotifyEvent->request == XCB_MAPPING_KEYBOARD
                || mappingNotifyEvent->request == XCB_MAPPING_MODIFIER)
        {
            XMappingEvent xMappingEvent;
            memset(&xMappingEvent, 0, sizeof(xMappingEvent));
            xMappingEvent.type = MappingNotify;
            xMappingEvent.display = m_dpy;
            if (mappingNotifyEvent->request == XCB_MAPPING_KEYBOARD) {
                xMappingEvent.request = MappingKeyboard;
            }
            else {
                xMappingEvent.request = MappingModifier;
            }
            xMappingEvent.first_keycode = mappingNotifyEvent->first_keycode;
            xMappingEvent.count = mappingNotifyEvent->count;
            XRefreshKeyboardMapping(&xMappingEvent);
            updateKeymap();
        }
    }

    return -1;
}
示例#5
0
int AutoTypePlatformX11::platformEventFilter(void* event)
{
    XEvent* xevent = static_cast<XEvent*>(event);

    if ((xevent->type == KeyPress || xevent->type == KeyRelease)
            && m_currentGlobalKey
            && xevent->xkey.keycode == m_currentGlobalKeycode
            && (xevent->xkey.state & m_modifierMask) == m_currentGlobalNativeModifiers
            && !QApplication::focusWidget()
            && m_loaded) {
        if (xevent->type == KeyPress) {
            Q_EMIT globalShortcutTriggered();
        }
        return 1;
    }
    if (xevent->type == MappingNotify && m_loaded) {
        XRefreshKeyboardMapping(reinterpret_cast<XMappingEvent*>(xevent));
        updateKeymap();
    }

    return -1;
}