void eTimeCorrectionEditWindow::yearChanged( eListBoxEntryText* )
{
	cmonth->setCurrent( (int) cmonth->getCurrent()->getKey(), true );
	setFocus(cyear);
}
Example #2
0
/*!

*/
void ColorPickerButton::mouseMoveEvent(QMouseEvent *)
{
    setFocus();
    update();
}
Example #3
0
void DkControlWidget::init() {

	// debug: show invisible widgets
	setFocusPolicy(Qt::StrongFocus);
	setFocus(Qt::TabFocusReason);
	setMouseTracking(true);

	// connect widgets with their settings
	mFilePreview->setDisplaySettings(&Settings::param().app().showFilePreview);
	mMetaDataInfo->setDisplaySettings(&Settings::param().app().showMetaData);
	mFileInfoLabel->setDisplaySettings(&Settings::param().app().showFileInfoLabel);
	mPlayer->setDisplaySettings(&Settings::param().app().showPlayer);
	mHistogram->setDisplaySettings(&Settings::param().app().showHistogram);
	mCommentWidget->setDisplaySettings(&Settings::param().app().showComment);
	mZoomWidget->setDisplaySettings(&Settings::param().app().showOverview);
	mFolderScroll->setDisplaySettings(&Settings::param().app().showScroller);

	// some adjustments
	mBottomLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
	mBottomLeftLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
	mRatingLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
	mZoomWidget->setContentsMargins(10, 10, 0, 0);
	mCropWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
	mCommentWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);

	// register actions
	DkActionManager& am = DkActionManager::instance();
	mFilePreview->registerAction(am.action(DkActionManager::menu_panel_preview));
	mMetaDataInfo->registerAction(am.action(DkActionManager::menu_panel_exif));
	mPlayer->registerAction(am.action(DkActionManager::menu_panel_player));
	mCropWidget->registerAction(am.action(DkActionManager::menu_edit_crop));
	mFileInfoLabel->registerAction(am.action(DkActionManager::menu_panel_info));
	mHistogram->registerAction(am.action(DkActionManager::menu_panel_histogram));
	mCommentWidget->registerAction(am.action(DkActionManager::menu_panel_comment));
	mFolderScroll->registerAction(am.action(DkActionManager::menu_panel_scroller));

	// dummy - needed for three equal columns @markus: do not delete!
	QWidget* dw = new QWidget(this);
	dw->setMouseTracking(true);
	QBoxLayout* dLayout = new QBoxLayout(QBoxLayout::LeftToRight, dw);
	dLayout->setContentsMargins(0,0,0,0);
	dLayout->addWidget(mBottomLabel);
	dLayout->addStretch();

	// zoom widget
	QWidget* bw = new QWidget(this);
	bw->setMouseTracking(true);
	//bw->setMinimumHeight(40);
	//bw->setMaximumHeight(80);
	QVBoxLayout* zLayout = new QVBoxLayout(bw);
	zLayout->setAlignment(Qt::AlignBottom);
	zLayout->setContentsMargins(0,0,0,20);
	zLayout->setSpacing(0);
	zLayout->addWidget(mBottomLabel);
	zLayout->addWidget(mBottomLeftLabel);
	zLayout->addWidget(mCommentWidget);

	// left column widget
	QWidget* leftWidget = new QWidget(this);
	leftWidget->setMouseTracking(true);
	QBoxLayout* ulLayout = new QBoxLayout(QBoxLayout::TopToBottom, leftWidget);
	ulLayout->setContentsMargins(0,0,0,0);
	ulLayout->setSpacing(0);
	ulLayout->addWidget(mZoomWidget);
	ulLayout->addStretch();
	ulLayout->addWidget(bw);
	ulLayout->addWidget(dw);

	// center column
	QWidget* center = new QWidget(this);
	center->setMouseTracking(true);
	QVBoxLayout* cLayout = new QVBoxLayout(center);
	cLayout->setContentsMargins(0,0,0,0);
	cLayout->setAlignment(Qt::AlignBottom);
	cLayout->addWidget(mPlayer);
	
	// rating widget
	QWidget* rw = new QWidget(this);
	rw->setMouseTracking(true);
	rw->setMinimumSize(0,0);
	QBoxLayout* rLayout = new QBoxLayout(QBoxLayout::RightToLeft, rw);
	rLayout->setContentsMargins(0,0,0,17);
	rLayout->addWidget(mRatingLabel);
	rLayout->addStretch();

	// file info
	QWidget* fw = new QWidget(this);
	fw->setContentsMargins(0,0,0,30);
	fw->setMouseTracking(true);
	fw->setMinimumSize(0,0);
	QBoxLayout* rwLayout = new QBoxLayout(QBoxLayout::RightToLeft, fw);
	rwLayout->setContentsMargins(0,0,0,0);
	rwLayout->addWidget(mFileInfoLabel);
	rwLayout->addStretch();

	// right column
	QWidget* hw = new QWidget(this);
	hw->setContentsMargins(0,10,10,0);
	hw->setMouseTracking(true);
	QBoxLayout* hwLayout = new QBoxLayout(QBoxLayout::RightToLeft, hw);
	hwLayout->setContentsMargins(0,0,0,0);
	hwLayout->addWidget(mHistogram);
	hwLayout->addStretch();

	// right column
	QWidget* rightWidget = new QWidget(this);
	rightWidget->setMouseTracking(true);
	QBoxLayout* lrLayout = new QBoxLayout(QBoxLayout::TopToBottom, rightWidget);
	lrLayout->setContentsMargins(0,0,0,0);
	lrLayout->addWidget(hw);
	lrLayout->addStretch();
	lrLayout->addWidget(fw);
	lrLayout->addWidget(rw);
	
	// init main widgets
	mWidgets.resize(widget_end);
	mWidgets[hud_widget] = new QWidget(this);
	mWidgets[crop_widget] = mCropWidget;

	// global controller layout
	mHudLayout = new QGridLayout(mWidgets[hud_widget]);
	mHudLayout->setContentsMargins(0,0,0,0);
	mHudLayout->setSpacing(0);

	//hudLayout->addWidget(thumbWidget, 0, 0);

	// add elements
	changeThumbNailPosition(mFilePreview->getWindowPosition());
	changeMetaDataPosition(mMetaDataInfo->getWindowPosition());
	//hudLayout->addWidget(filePreview, top_thumbs, left_thumbs, 1, hor_pos_end);
	mHudLayout->addWidget(leftWidget, ver_center, left, 1, 1);
	mHudLayout->addWidget(center, ver_center, hor_center, 1, 1);
	mHudLayout->addWidget(rightWidget, ver_center, right, 1, 1);
	mHudLayout->addWidget(mFolderScroll, top_scroll, left_thumbs, 1, hor_pos_end);

	//// we need to put everything into extra widgets (which are exclusive) in order to handle the mouse events correctly
	//QHBoxLayout* editLayout = new QHBoxLayout(widgets[crop_widget]);
	//editLayout->setContentsMargins(0,0,0,0);
	//editLayout->addWidget(cropWidget);

	mLayout = new QStackedLayout(this);
	mLayout->setContentsMargins(0,0,0,0);
	
	for (int idx = 0; idx < mWidgets.size(); idx++)
		mLayout->addWidget(mWidgets[idx]);

	//// debug code...
	//centerLabel->setText("ich bin richtig...", -1);
	//bottomLeftLabel->setText("topLeft label...", -1);
	//spinnerLabel->show();
	
	show();
	//thumbWidget->setVisible(true);
}
Example #4
0
/*! \reimp  */
bool QGroupBox::event(QEvent *e)
{
    Q_D(QGroupBox);
#ifndef QT_NO_SHORTCUT
    if (e->type() == QEvent::Shortcut) {
        QShortcutEvent *se = static_cast<QShortcutEvent *>(e);
        if (se->shortcutId() == d->shortcutId) {
            if (!isCheckable()) {
                d->_q_fixFocus(Qt::ShortcutFocusReason);
            } else {
                d->click();
                setFocus(Qt::ShortcutFocusReason);
            }
            return true;
        }
    }
#endif
    QStyleOptionGroupBox box;
    initStyleOption(&box);
    switch (e->type()) {
    case QEvent::HoverEnter:
    case QEvent::HoverMove: {
        QStyle::SubControl control = style()->hitTestComplexControl(QStyle::CC_GroupBox, &box,
                                                                    static_cast<QHoverEvent *>(e)->pos(),
                                                                    this);
        bool oldHover = d->hover;
        d->hover = d->checkable && (control == QStyle::SC_GroupBoxLabel || control == QStyle::SC_GroupBoxCheckBox);
        if (oldHover != d->hover) {
            QRect rect = style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this)
                         | style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxLabel, this);
            update(rect);
        }
        return true;
    }
    case QEvent::HoverLeave:
        d->hover = false;
        if (d->checkable) {
            QRect rect = style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this)
                         | style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxLabel, this);
            update(rect);
        }
        return true;
    case QEvent::KeyPress: {
        QKeyEvent *k = static_cast<QKeyEvent*>(e);
        if (!k->isAutoRepeat() && (k->key() == Qt::Key_Select || k->key() == Qt::Key_Space)) {
            d->pressedControl = QStyle::SC_GroupBoxCheckBox;
            update(style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this));
            return true;
        }
        break;
    }
    case QEvent::KeyRelease: {
        QKeyEvent *k = static_cast<QKeyEvent*>(e);
        if (!k->isAutoRepeat() && (k->key() == Qt::Key_Select || k->key() == Qt::Key_Space)) {
            bool toggle = (d->pressedControl == QStyle::SC_GroupBoxLabel
                           || d->pressedControl == QStyle::SC_GroupBoxCheckBox);
            d->pressedControl = QStyle::SC_None;
            if (toggle)
                d->click();
            return true;
        }
        break;
    }
    default:
        break;
    }
    return QWidget::event(e);
}
Example #5
0
/*! \internal

    Makes sure the button isn't pressed when the popup hides.
*/
void QtColorPicker::popupClosed()
{
    setChecked(false);
    setFocus();
}
Example #6
0
void AquariaMenuItem::destroy()
{
	setFocus(false);
	Quad::destroy();
	AquariaGuiElement::clean();
}
void Console::mousePressEvent(QMouseEvent*)
{
    setFocus();
}
Example #8
0
void RazorAppSwitcher::SwitcherItem::mouseMoveEvent(QMouseEvent * e)
{
    if (! hasFocus())
        setFocus(Qt::MouseFocusReason);
}
Example #9
0
void NMainMenuBar::setupEditMenu() {
    editMenu = this->addMenu(tr("&Edit"));
    QFont f = global.getGuiFont(QFont());
    editMenu->setFont(f);

    undoAction = new QAction(tr("&Undo"), this);
    setupShortcut(undoAction, QString("Edit_Undo"));
    editMenu->addAction(undoAction);

    redoAction = new QAction(tr("&Redo"), this);
    setupShortcut(redoAction, QString("Edit_Redo"));
    editMenu->addAction(redoAction);

    editMenu->addSeparator();

    cutAction = new QAction(tr("&Cut"), this);
    setupShortcut(cutAction, QString("Edit_Cut"));
    editMenu->addAction(cutAction);

    copyAction = new QAction(tr("C&opy"), this);
    setupShortcut(copyAction, QString("Edit_Copy"));
    editMenu->addAction(copyAction);

    pasteAction = new QAction(tr("&Paste"), this);
    setupShortcut(pasteAction, QString("Edit_Paste"));
    editMenu->addAction(pasteAction);

    pasteAsTextAction = new QAction(tr("Pas&te as Unformatted Text"), this);
    setupShortcut(pasteAsTextAction, QString("Edit_Paste_Without_Formatting"));
    editMenu->addAction(pasteAsTextAction);

    removeFormattingAction = new QAction(tr("Remo&ve Formatting"), this);
    //setupShortcut(removeFormjattingAction, QString("Edit_Remove_Formatting")); // For some reason this one makes the editorButtonBar one ambiguous
    editMenu->addAction(removeFormattingAction);

    editMenu->addSeparator();

    selectAllAction = new QAction(tr("Select &All"), this);
    setupShortcut(selectAllAction, QString("Edit_Select_All"));
    editMenu->addAction(selectAllAction);

    editMenu->addSeparator();

    findReplaceMenu = editMenu->addMenu(tr("F&ind and Replace"));
    findReplaceMenu->setFont(f);

    searchNotesAction = new QAction(tr("&Search Notes"), this);
    setupShortcut(searchNotesAction, QString("Edit_Search_Notes"));
    findReplaceMenu->addAction(searchNotesAction);
    connect(searchNotesAction, SIGNAL(triggered()), parent->searchText, SLOT(setFocus()));

    resetSearchAction = new QAction(tr("&Reset Search"), this);
    setupShortcut(resetSearchAction, QString("Edit_Reset_Search"));
    findReplaceMenu->addAction(resetSearchAction);
    connect(resetSearchAction, SIGNAL(triggered()), parent, SLOT(resetView()));

    findReplaceMenu->addSeparator();

    searchFindAction = new QAction(tr("&Find in Note"), this);
    setupShortcut(searchFindAction, QString("Edit_Search_Find"));
    findReplaceMenu->addAction(searchFindAction);
    connect(searchFindAction, SIGNAL(triggered()), parent, SLOT(findInNote()));


    searchFindNextAction = new QAction(tr("Find &Next"), this);
    setupShortcut(searchFindNextAction, QString("Edit_Search_Find_Next"));
    findReplaceMenu->addAction(searchFindNextAction);
    connect(searchFindNextAction, SIGNAL(triggered()), parent, SLOT(findNextInNote()));

    searchFindPrevAction = new QAction(tr("Find &Previous"), this);
    setupShortcut(searchFindPrevAction, QString("Edit_Search_Find_Prev"));
    findReplaceMenu->addAction(searchFindPrevAction);
    connect(searchFindPrevAction, SIGNAL(triggered()), parent, SLOT(findPrevInNote()));

    findReplaceMenu->addSeparator();

    searchFindReplaceAction = new QAction(tr("Replace &Within Note..."), this);
    setupShortcut(searchFindReplaceAction, QString("Edit_Search_Find_Replace"));
    findReplaceMenu->addAction(searchFindReplaceAction);
    connect(searchFindReplaceAction, SIGNAL(triggered()), parent, SLOT(findReplaceInNote()));

    editMenu->addSeparator();

    createThemeMenu(editMenu);

    preferencesAction = new QAction(tr("Preferences"), this);
    preferencesAction->setMenuRole(QAction::PreferencesRole);
    setupShortcut(preferencesAction, QString("Edit_Preferences"));
    editMenu->addAction(preferencesAction);
    connect(preferencesAction, SIGNAL(triggered()), parent, SLOT(openPreferences()));

}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    readSettings();
    ui->actionSound->setChecked(settings.soundsenabled);

    irc = new QIrc();
    if (!irc->createSession())
    {
        QMessageBox::critical(this, tr("Error"), tr("Can't create session"));
        close();
        return;
    }
    connect(irc, SIGNAL(sigConnected()), this, SLOT(sltConnected()));
    connect(irc, SIGNAL(sigMessage(QString,QString)), this, SLOT(sltMessage(QString,QString)));
    connect(irc, SIGNAL(sigChannelJoined(QString,QString)), this, SLOT(sltChannelJoined(QString,QString)));
    connect(irc, SIGNAL(sigChannelParted(QString,QString,QString)), this, SLOT(sltChannelParted(QString,QString,QString)));
    connect(irc, SIGNAL(sigChannelNames(QString,QString,QStringList)), this, SLOT(sltChannelNames(QString,QString,QStringList)));
    connect(irc, SIGNAL(sigChannelMessage(QString,QString,QString)), this, SLOT(sltChannelMessage(QString,QString,QString)));
    connect(irc, SIGNAL(sigPrivateMessage(QString,QString,QString)), this, SLOT(sltPrivateMessage(QString,QString,QString)));
    connect(irc, SIGNAL(sigNick(QString,QString)), this, SLOT(sltNick(QString,QString)));
    connect(irc, SIGNAL(sigNotice(QString,QString,QString)), this, SLOT(sltNotice(QString,QString,QString)));
    connect(irc, SIGNAL(sigTopic(QString,QString,QString)), this, SLOT(sltTopic(QString,QString,QString)));
    connect(irc, SIGNAL(sigTopicSet(QString,QString,QString,QString)), this, SLOT(sltTopicSet(QString,QString,QString,QString)));
    connect(irc, SIGNAL(sigKick(QString,QString,QString)), this, SLOT(sltKick(QString,QString,QString)));
    connect(irc, SIGNAL(sigQuit(QString,QString)), this, SLOT(sltQuit(QString,QString)));
    connect(irc, SIGNAL(sigChannelModeChanged(QString,QString,QStringList)), this, SLOT(sltChannelModeChanged(QString,QString,QStringList)));
    connect(irc, SIGNAL(sigUmode(QString,QString)), this, SLOT(sltUmode(QString,QString)));
    connect(irc, SIGNAL(sigInvite(QString,QString,QString)), this, SLOT(sltInvite(QString,QString,QString)));
    connect(irc, SIGNAL(sigCtcpAction(QString,QString,QString)), this, SLOT(sltCtcpAction(QString,QString,QString)));
    connect(irc, SIGNAL(sigErrorOccured(QString)), this, SLOT(sltErrorOccured(QString)));

    consolebrowser = new QTextEdit();
    consolebrowser->setReadOnly(true);
    QFont consolefont;
    if (consolefont.fromString(settings.consolefont))
        consolebrowser->setFont(consolefont);

    if (!settings.hideconsole)
        consoleindex =ui->tabWidget->insertTab(0, consolebrowser, tr("Console"));

    setsdlg = 0;

    usercontextmenu = new QMenu(this);
    usercontextmenu->addAction(ui->actionPrivateChat);
    usercontextmenu->addAction(ui->actionInsert_to_editor);
    QMenu *managementmenu = usercontextmenu->addMenu(tr("Management"));
    managementmenu->addAction(ui->actionKick);
    managementmenu->addAction(ui->actionBan);
    managementmenu->addAction(ui->actionKickBan);
    managementmenu->addSeparator();
    managementmenu->addAction(ui->actionOp);
    managementmenu->addAction(ui->actionDeOp);
    managementmenu->addSeparator();
    managementmenu->addAction(ui->actionVoice);
    managementmenu->addAction(ui->actiondeVoice);
    connect(ui->treeWidget, SIGNAL(userContextMenu(QPoint)), this, SLOT(userContextMenuRequested(QPoint)));

    channelcontextmenu = new QMenu(this);
    channelcontextmenu->addAction(ui->actionLeave_channel);
    channelcontextmenu->addAction(ui->actionChannel_settings);
    connect(ui->treeWidget, SIGNAL(channelContextMenu(QPoint)), this, SLOT(channelContextMenuRequested(QPoint)));

    channelsettingsdialog = 0;
    trayicon = 0;
    traymenu = 0;
    setTrayIcon(settings.trayicon);
    connect(ui->actionChannel_settings, SIGNAL(triggered()), this, SLOT(channelSettingsPressed()));

    //smile menu
    smilemenu = new QMenu(this);
    smilewidgetaction = new QWidgetAction(smilemenu);
    smilebar = new SmileBar();
    smilewidgetaction->setDefaultWidget(smilebar);
    smilemenu->addAction(smilewidgetaction);
    connect(smilebar, SIGNAL(smileClicked(QString)), ui->plainTextEditMessage, SLOT(insertPlainText(QString)));
    connect(smilebar, SIGNAL(smileClicked(QString)), ui->plainTextEditMessage, SLOT(setFocus()));
    ui->actionEmoticons->setMenu(smilemenu);
    smilebutton = new QToolButton();
    smilebutton->setDefaultAction(ui->actionEmoticons);
    smilebutton->setPopupMode(QToolButton::InstantPopup);
    ui->mainToolBar->addWidget(smilebutton);

    channellistdialog = new ChannelListDialog();
    connect(irc, SIGNAL(sigChannelListStart()), channellistdialog, SLOT(showAndClear()));
    connect(irc, SIGNAL(sigChannelListAddItem(QString,QString,QString)), channellistdialog,
            SLOT(addListItem(QString,QString,QString)));
    connect(irc, SIGNAL(sigChannelListEnd()), channellistdialog, SLOT(endOfList()));
    connect(channellistdialog, SIGNAL(channelDoubleClicked(QString)), irc, SLOT(joinChannel(QString)));

    connect(ui->pushButtonSend, SIGNAL(clicked()), ui->plainTextEditMessage, SIGNAL(sendKeyPressed()));
    connect(ui->plainTextEditMessage, SIGNAL(sendKeyPressed()), this, SLOT(sendPressed()));
    connect(ui->actionConnect, SIGNAL(triggered()), this, SLOT(connectPressed()));
    connect(ui->actionDisconnect, SIGNAL(triggered()), this, SLOT(disconnectPressed()));
    connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(settingsPressed()));
    connect(ui->actionJoin, SIGNAL(triggered()), this, SLOT(joinPressed()));
    connect(ui->treeWidget, SIGNAL(userDoubleClicked(QString)), this, SLOT(userDoubleClicked(QString)));
    connect(ui->actionPrivateChat, SIGNAL(triggered()), this, SLOT(privateChatPressed()));
    connect(ui->actionLeave_channel, SIGNAL(triggered()), this, SLOT(leaveChannelPressed()));
    connect(ui->actionKick, SIGNAL(triggered()), this, SLOT(kickPressed()));
    connect(ui->actionBan, SIGNAL(triggered()), this, SLOT(BanPressed()));
    connect(ui->actionKickBan, SIGNAL(triggered()), this, SLOT(kickBanPressed()));
    connect(ui->actionOp, SIGNAL(triggered()), this, SLOT(opPressed()));
    connect(ui->actionDeOp, SIGNAL(triggered()), this, SLOT(deOpPressed()));
    connect(ui->actionVoice, SIGNAL(triggered()), this, SLOT(voicePressed()));
    connect(ui->actiondeVoice, SIGNAL(triggered()), this, SLOT(devoicePressed()));
    connect(ui->pushButtonNick, SIGNAL(clicked()), this, SLOT(nickButtonPressed()));
    connect(ui->actionList_of_channels, SIGNAL(triggered()), irc, SLOT(getChannelsList()));
    connect(ui->actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
    connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabCloseRequested(int)));
    connect(ui->actionInsert_to_editor, SIGNAL(triggered()), this, SLOT(insertUserToEditorPressed()));
    connect(ui->actionShowHide, SIGNAL(triggered()), this, SLOT(trayIconActivated()));
    connect(ui->actionQuit_program, SIGNAL(triggered()), this, SLOT(quitProgram()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(aboutPressed()));
    connect(ui->actionSound, SIGNAL(toggled(bool)), this, SLOT(soundActionToogled(bool)));
}
Example #11
0
void TERMWINDOWMEMBER fkey(uint inkey)
    {
    int key = inkey >> 8;

    // this handles the keys for dialout mode
    if (DoWhat == DIALOUT)
        {
        dialout_fkey = key;
        return;
        }

    // let RLM take over keyboard if it wants
    if (!CitadelIsConfiguring && rlmEvent(LT_KEYSTROKE, key, inkey))
        {
        return;
        }

    if (cfg.FullConLock && ConsoleLock.IsLocked() && ScreenSaver.IsOn() &&
            key != ALT_L)
        {
        return;
        }

    if (!LockMessages(MSG_CONSOLE))
        {
        cOutOfMemory(49);
        }

    if (key == CTL_F2)      // CTRL_F2 is never locked.
        {
#ifndef WINCIT
        if (allWindows)
            {
            setFocus(allWindows->wnd);
            }
#endif
        }
    else if (key != ALT_F1 && ConsoleLock.IsLocked(key == F6 || key == ALT_F6 || key == SFT_F6 || key == CTL_F6))
        {
#ifndef WINCIT
        if (key == ALT_L && ConsoleLock.MayUnlock())
            {
            GetStringFromConsole(getmsg(MSG_CONSOLE, 0), LABELSIZE, ns, GetSysPWHandler, TRUE);
            }
        else
            {
            if (cfg.VerboseConsole)
                {
                CitWindowsNote(NULL, (key == ALT_L) ? getmsg(MSG_CONSOLE, 1) : getmsg(MSG_CONSOLE, 2));
                }
            }
#endif
        }
    else
        {
        // Console is not locked

        if (CitadelIsConfiguring)
            {
            // Only let certain keystrokes through if configuring
            if (key != CTL_F6 && key != F7 && key != F8 && key != ALT_D && key != ALT_L && key != ALT_M &&
                    key != ALT_S && key != ALT_U)
                {
                WaitUntilDoneConfiguring();
                key = 0;
                }
            }

        ScreenSaver.Update();
        switch (key)
            {
            case F1:
                {
                CITWINDOW *w = CitWindowsMsg(NULL, getmsg(MSG_CONSOLE, 3));

#ifndef WINCIT
                CommPort->DropDtr();
#endif

                if (w)
                    {
                    destroyCitWindow(w, FALSE);
                    }

                break;
                }

#ifndef WINCIT
            case CTL_F1:
                {
                if (say_ascii != (int (cdecl *)(const char *, int)) nullFunc)
                    {
                    cfg.speechOn = !cfg.speechOn;

                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 4), cfg.speechOn ? getmsg(317) : getmsg(316));
                        }
                    }
                else
                    {
                    cfg.speechOn = FALSE;

                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 5));
                        }
                    }

                break;
                }
#endif

            case ALT_F1:
                {
                cls(SCROLL_SAVE);
                break;
                }

            case F2:
                {
                CITWINDOW *w = CitWindowsMsg(NULL, getmsg(19));

                Initport();

                if (w)
                    {
                    destroyCitWindow(w, FALSE);
                    }

                break;
                }

            case F3:
                {
                sysReq = !sysReq;

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 6), sysReq ? getmsg(317) : getmsg(316));
                    }

                break;
                }

            case ALT_F3:
                {
                if (sysReq)
                    {
                    altF3Timeout = 0;
                    sysReq = FALSE;

                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 6), getmsg(316));
                        }
                    }
                else
                    {
                    altF3Timeout = time(NULL) + cfg.altF3Time;
                    sysReq = TRUE;

                    if (cfg.VerboseConsole)
                        {
                        long tme = time(NULL);

                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 7), (altF3Timeout - tme) / 60, (altF3Timeout - tme) % 60);
                        }
                    }

                break;
                }

            case F4:
                {
                if (!StatusLine.ToggleFullScreen(WC_TWp))
                    {
                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 8));
                        }
                    }

                break;
                }

            case F5:
                {
                if (onConsole)
                    {
                    OC.whichIO = MODEM;
                    OC.setio();

                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 9), getmsg(MSG_CONSOLE, 10));
                        }
                    }
                else
                    {
                    OC.whichIO = CONSOLE;
                    OC.setio();

                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 9), getmsg(MSG_CONSOLE, 11));
                        }
                    }

                break;
                }

            case F6:
                {
                sysopkey = TRUE;
                break;
                }

#ifndef WINCIT
            case CTL_F6:
                {
                doConsoleSysop();
                break;
                }
#endif

            case ALT_F6:
                {
                CurrentUser->SetAide(!CurrentUser->IsAide());

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 12),
							CurrentUser->IsAide() ? getmsg(MSG_CONSOLE, 13) : getmsg(MSG_CONSOLE, 14), getmsg(385));
                    }

                break;
                }

            case SFT_F6:
                {
                CurrentUser->SetSysop(!CurrentUser->IsSysop());

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 12),
                            CurrentUser->IsSysop() ? getmsg(MSG_CONSOLE, 13) : getmsg(MSG_CONSOLE, 14), getmsg(386));
                    }

                break;
                }

            case F7:
                {
                cfg.noBells++;

                if (cfg.noBells == 3)
                    {
                    cfg.noBells = 0;
                    }

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 15), getmsg(MSG_CONSOLE, 16 + cfg.noBells));
                    }

                break;
                }

            case ALT_C:
            case F8:
                {
                chatkey = !chatkey;
                break;
                }

            case F9:
                {
                cfg.noChat = !cfg.noChat;
                chatReq = FALSE;

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 19), cfg.noChat ? getmsg(316) : getmsg(317));
                    }

                break;
                }

            case F10:
            case ALT_H:
                {
                StatusLine.ToggleHelp(WC_TWp);
                break;
                }

            case ALT_F10:
                {
                StatusLine.ToggleSecond(WC_TWp);
                break;
                }

            case SFT_F10:
                {
                StatusLine.Toggle(WC_TWp);
                break;
                }

#ifdef WINCIT
            case F11:
                {
				TermWindowCollection.FocusPrev();
                break;
                }

            case F12:
                {
				TermWindowCollection.FocusNext();
                break;
                }
#endif

            case ALT_A:
                {
                CurrentUser->SetAccounting(!CurrentUser->IsAccounting());

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 20), CurrentUser->IsAccounting() ? getmsg(317) : getmsg(316));
                    }

                break;
                }

            case ALT_D:
                {
                if (debug)
                    {
                    TurnDebugOff();

                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 21), getmsg(316));
                        }
                    }
                else
                    {
                    if (TurnDebugOn())
                        {
                        if (cfg.VerboseConsole)
                            {
                            CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 21), getmsg(317));
                            }
                        }
                    else
                        {
                        if (cfg.VerboseConsole)
                            {
                            CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 22));
                            }
                        }
                    }

                break;
                }

#ifndef WINCIT
            case ALT_K:
                {
                if (!allWindows)
                    {
                    if (cfg.scrollSize)
                        {
                        DisplayScrollBackBuffer();
                        time(&LastActiveTime);
                        }
                    else
                        {
                        if (cfg.VerboseConsole)
                            {
                            CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 23), citfiles[C_CONFIG_CIT]);
                            }
                        }
                    }
                else
                    {
                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 24));
                        }
                    }

                break;
                }
#endif

            case ALT_L:
                {
                if (*cfg.f6pass)
                    {
                    if (!SameString(cfg.f6pass, getmsg(670)))
                        {
                        ConsoleLock.Lock();

                        if (cfg.VerboseConsole)
                            {
                            CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 32));
                            }
                        }
                    }
                else
                    {
                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 33), citfiles[C_CONFIG_CIT]);
                        }
                    }

                break;
                }

            case ALT_M:
                {
                memoryDump();
                break;
                }

            case ALT_P:
                {
                if (OC.Printing)
                    {
                    OC.Printing = FALSE;
                    fclose(OC.PrintFile);

                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 25));
                        }
                    }
                else
                    {
#ifndef WINCIT
                    if (cfg.printerprompt)
                        {
                        GetStringFromConsole(getmsg(289), 63, cfg.printer, StartPrinting, FALSE);
                        }
                    else
#endif
                        {
                        char Buffer[sizeof(cfg.homepath) + sizeof(cfg.printer)];
                        sprintf(Buffer, sbs, cfg.homepath, cfg.printer);

                        StartPrinting(Buffer);
                        }
                    }

                break;
                }

            case ALT_R:
                repeatevent = TRUE;
                // fall through

            case ALT_F:
                forceevent = TRUE;
                // fall through

            case ALT_E:
                eventkey = TRUE;
                break;


            case ALT_S:
                {
                if (ScreenSaver.TurnOn())
                    {
#ifndef WINCIT
                    while ((*sp_press)());
#endif
                    }
                else
                    {
                    if (cfg.VerboseConsole)
                        {
                        CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 26));
                        }
                    }

                break;
                }

            case ALT_T:
                {
                CurrentUser->SetProblem(!CurrentUser->IsProblem());

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 12),
                            CurrentUser->IsProblem() ? getmsg(MSG_CONSOLE, 13) : getmsg(MSG_CONSOLE, 14),
							getmsg(MSG_CONSOLE, 27));
                    }

                break;
                }

            case ALT_U:
                {
                cfg.ignore_uptime = !cfg.ignore_uptime;

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 28),
							citfiles[C_CONFIG_CIT], cfg.ignore_uptime ? getmsg(317) : getmsg(316));
                    }

                break;
                }

            case ALT_V:
                {
                CurrentUser->SetVerified(!CurrentUser->IsVerified());

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 12),
							CurrentUser->IsVerified() ? getmsg(MSG_CONSOLE, 13) : getmsg(MSG_CONSOLE, 14),
							getmsg(MSG_CONSOLE, 29));
                    }

                break;
                }

            case ALT_X:
            case ALT_F4:
                {
#ifndef WINCIT
                if (cfg.AltXPrompt)
                    {
                    GetYNFromConsole(getmsg(MSG_CONSOLE, 30), 0, ExitYNHandler);
                    }
                else
#endif
                    {
                    ExitToMsdos = TRUE;
                    }

                break;
                }

            case ALT_Z:
                {
                if (CommPort->HaveConnection() || debug)
                    {
                    sleepkey = TRUE;
                    }

                break;
                }

            case ALT_3:
                {
                CurrentUser->SetOut300(!CurrentUser->IsOut300());

                if (cfg.VerboseConsole)
                    {
                    CitWindowsNote(NULL, getmsg(MSG_CONSOLE, 12),
                            CurrentUser->IsOut300() ? getmsg(MSG_CONSOLE, 13) : getmsg(MSG_CONSOLE, 14),
                            getmsg(MSG_CONSOLE, 31));
                    }

                break;
                }

            case PGUP:
                {
                CurrentUser->SetCredits(CurrentUser->GetCredits() + 5 * 60);
                break;
                }

            case PGDN:
                {
                CurrentUser->SetCredits(CurrentUser->GetCredits() - 5 * 60);
                break;
                }
            }
        }

    UnlockMessages(MSG_CONSOLE);

    StatusLine.Update(WC_TWp);
    }
Example #12
0
//! posts an input event to the environment
bool Ui::handleEvent( const NEvent& event )
{  
  switch(event.EventType)
  {
    case sEventGui:
      // hey, why is the user sending gui events..?
    break;

    case sEventMouse:
        _d->cursorPos = event.mouse.pos();

//!!! android fix. update hovered element on every mouse event,
//!   that beforeDraw() function cannot do it correctly
#ifdef CAESARIA_PLATFORM_ANDROID
        _updateHovered( _d->cursorPos );
#endif
//!!! end android fix
        switch( event.mouse.type )
        {
        case mouseLbtnPressed:
        case mouseRbtnPressed:
        {
            if ( (_d->hovered.current.isValid() && _d->hovered.current != getFocus()) || !getFocus() )
            {
              setFocus( _d->hovered.current.object() );
            }

            // sending input to focus
            Widget* inFocus = getFocus();
            if( inFocus )
            {
              bool eventResolved = getFocus()->onEvent(event);
              if( eventResolved )
              {
                return true;
              }
            }

            // focus could have died in last call
            inFocus = getFocus();
            if( !inFocus && _d->hovered.current.isValid() )
            {                
              return _d->hovered.current->onEvent(event);
            }
        }
        break;

        case mouseLbtnRelease:
          if( getFocus() )
          {
            return getFocus()->onEvent( event );
          }
        break;

        default:
          if( _d->hovered.current.isValid() )
          {
            return _d->hovered.current->onEvent( event );
          }
        break;
        }
    break;

    case sTextInput:
    case sEventKeyboard:
        {
          if( _d->console )
          {
            if(  _d->console->initKey() == (int)event.keyboard.symbol )
            {
              if( _d->console && !event.keyboard.control && event.keyboard.pressed )
                  _d->console->toggleVisible();

              return true;
            }

            if( _d->console->visible() && !event.keyboard.control && event.keyboard.pressed )
            {
              _d->console->keyPress( event );
              return true;
            }
          }

          if( getFocus() && getFocus()->onEvent(event))
            return true;

          // For keys we handle the event before changing focus to give elements the chance for catching the TAB
          // Send focus changing event
          if( event.EventType == sEventKeyboard &&
              event.keyboard.pressed &&
              event.keyboard.key == KEY_TAB)
          {
            Widget *wdg = next(event.keyboard.shift, event.keyboard.control);
            if (wdg && wdg != getFocus())
            {
                if( setFocus(wdg) )
                    return true;
            }
          }
        }
        break;
    default:
        break;
  } // end switch

  return false;
}
Example #13
0
//------------------------------------------------------------------------------
// The user has 'finished editing' such as pressed return/enter or moved
// focus from the object.
// Note, it doesn't matter if the user presses return and both this function
// AND userReturnPressed() is called since setText is called in each to clear
// the 'isModified' flag. So, the first called will perform the write, the
// second (if any) will do nothing.
//
void QEGenericEdit::userEditingFinished()
{
    // If not connected, do nothing
    if( !isConnected )
    {
        return;
    }

    // Do nothing if the user is still effectivly working with the widget (just moved to a dialog box)
    // Any signals received while messageDialogPresent is true should be ignored.
    // A signal occurs after the 'write failed' dialog closes, so a it sets
    // writeFailMessageDialogPresent to allow this code to ignore the signal.
    if( messageDialogPresent || writeFailMessageDialogPresent )
    {
        if( !messageDialogPresent )
        {
            writeFailMessageDialogPresent = false;
            setFocus();
        }
        return;
    }

    // If no changes were made by the user, do nothing
    if( !isModified() || !writeOnFinish )
    {
        return;
    }

    // Get the variable to write to
    qcaobject::QCaObject *qca = getQcaItem(0);

    // If a QCa object is present (if there is a variable to write to)
    // and the object is set up to write when the user changes focus away from the object
    // and the text has actually changed
    // then write the value
    if( qca && writeOnLoseFocus )
    {
       // Note: getValue is a dispatching hook procedure.
       writeValue( qca, getValue () );
    }

    // If, for what ever reason, the value has been changed by the user but not but not written
    // check with the user what to do about it.
    else
    {
        messageDialogPresent = true;
        int confirm = QMessageBox::warning( this, "Value changed", "You altered a value but didn't write it.\nDo you want to write this value?",
                                            QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No );
        messageDialogPresent = false;

        switch( confirm )
        {
            // Write the value
            case QMessageBox::Yes:
                if( qca ) {
                   // Note: getValue is a dispatching hook procedure.
                   writeValue( qca, getValue () );
                }
                break;

            // Abort the write, revert to latest value
            case QMessageBox::No:
                setValue( lastValue );       // Note, also clears 'isModified' flag
                                             // setValue  is dispatching hook function
                break;

            // Don't write the value, move back to the field being edited
            case QMessageBox::Cancel:
                setFocus();
                break;
        }
    }
}
void QFormulatorEditWidget::mousePressEvent( QMouseEvent *e )
{
	if( e->button() == Qt::LeftButton )
	{
		PointFde ptf( e->x(), e->y() );
		RectFde rcf = clientRect();
		CFmlDrawEngineQt::DPtoLPEx( ptf, scale(), scale() );
		CFmlDrawEngineQt::DPtoLPEx( rcf, scale(), scale() );

		if( rootNode()->PtInSelection( rcf, ptf ) == 0 )
		{
			editCopy(); // to enable interoperating with Other Applications

			CFrameNode *pFrameNode = rootNode()->RemoveOrCopySelection( 0 );
			if( pFrameNode )
			{
				CRootNode *pRootNode = new CRootNode( this );
				// zero marginds when inserting from a server
				pRootNode->setIndents( 0, 0, 0, 0 );
				pRootNode->Insert( pFrameNode );
				QPixmap pixmap;
				if( ::isOption_Perfomance_CopyImage() )
					pixmap = drawSelection2QPixmap( true );
				QImage pixImg = pixmap.toImage();
				QMimeData *mimeData = CFormulatorDoc::copyToMimeData( pRootNode, pixmap.isNull() ? 0 : &pixImg );
				if( mimeData )
				{
					QDrag *drag = new QDrag( this );
					drag->setMimeData( mimeData );
					if( !pixmap.isNull() )
					{
						const int dragPixmapMaxSize = 256;
						if( qMax(pixmap.width(), pixmap.height()) > dragPixmapMaxSize )
							drag->setPixmap( pixmap.width() > pixmap.height() ? pixmap.scaledToWidth( dragPixmapMaxSize ) : pixmap.scaledToHeight( dragPixmapMaxSize ) );
						else
							drag->setPixmap( pixmap );
					}
					drag->setHotSpot( QPoint(0, 0) );

					clearRemovedSelection();
					Qt::DropAction dropAction = drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::MoveAction);
					if( dropAction == Qt::MoveAction && isRemovedSelection() == 0 )
					{
						CFrameNode *pRemovedFrame = rootNode()->RemoveOrCopySelection( 1 );
						if( pRemovedFrame )
						{
							delete pRemovedFrame;
							setRemovedSelection();
						}
						if( !hasFocus() ) setFocus();
						updateViewDocument();
					}
				}

				delete pRootNode;
				delete pFrameNode;
			}
		}
		else if( rootNode()->MoveCaret( rcf, ptf, e->modifiers() & Qt::ShiftModifier ) == 0 )
		{
			updateFormulatorWidget();
		}

		//cbFireEvent( FORMULIB_CALLBACK_LMOUSECLICK, nFlags, MAKEWPARAM( point.x(), point.y() ) );
	}
	else if( e->button() == Qt::RightButton )
	{
		//cbFireEvent( FORMULIB_CALLBACK_RMOUSECLICK, nFlags, MAKEWPARAM( point.x(), point.y() ) );
	}
}
// virtual
void LLPanelLandmarkInfo::setInfoType(EInfoType type)
{
	LLPanel* landmark_info_panel = getChild<LLPanel>("landmark_info_panel");

	bool is_info_type_create_landmark = type == CREATE_LANDMARK;

	landmark_info_panel->setVisible(type == LANDMARK);

	getChild<LLTextBox>("folder_label")->setVisible(is_info_type_create_landmark);
	mFolderCombo->setVisible(is_info_type_create_landmark);

	switch(type)
	{
		case CREATE_LANDMARK:
		{
			mCurrentTitle = getString("title_create_landmark");

			mLandmarkTitle->setVisible(FALSE);
			mLandmarkTitleEditor->setVisible(TRUE);
			mNotesEditor->setEnabled(TRUE);

			LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance();
			std::string name = parcel_mgr->getAgentParcelName();
			LLVector3 agent_pos = gAgent.getPositionAgent();

			if (name.empty())
			{
				S32 region_x = llround(agent_pos.mV[VX]);
				S32 region_y = llround(agent_pos.mV[VY]);
				S32 region_z = llround(agent_pos.mV[VZ]);

				std::string region_name;
				LLViewerRegion* region = parcel_mgr->getSelectionRegion();
				if (region)
				{
					region_name = region->getName();
				}
				else
				{
					region_name = getString("unknown");
				}

				mLandmarkTitleEditor->setText(llformat("%s (%d, %d, %d)",
									  region_name.c_str(), region_x, region_y, region_z));
			}
			else
			{
				mLandmarkTitleEditor->setText(name);
			}

			std::string desc;
			LLAgentUI::buildLocationString(desc, LLAgentUI::LOCATION_FORMAT_FULL, agent_pos);
			mNotesEditor->setText(desc);

			// Moved landmark creation here from LLPanelLandmarkInfo::processParcelInfo()
			// because we use only agent's current coordinates instead of waiting for
			// remote parcel request to complete.
			if (!LLLandmarkActions::landmarkAlreadyExists())
			{
				createLandmark(LLUUID());
			}
		}
		break;

		case LANDMARK:
		default:
			mCurrentTitle = getString("title_landmark");

			mLandmarkTitle->setVisible(TRUE);
			mLandmarkTitleEditor->setVisible(FALSE);
			mNotesEditor->setEnabled(FALSE);
		break;
	}

	populateFoldersList();

	// Prevent the floater from losing focus (if the sidepanel is undocked).
	setFocus(TRUE);

	LLPanelPlaceInfo::setInfoType(type);
}
BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
{
	BOOL	handled = FALSE;

	// let scrollbar have first dibs
	handled = LLView::childrenHandleDoubleClick(x, y, mask) != NULL;

	if( !handled && mTakesNonScrollClicks)
	{
		if( allowsEmbeddedItems() )
		{
			const LLTextSegment* cur_segment = getSegmentAtLocalPos( x, y );
			if( cur_segment && cur_segment->getStyle()->getIsEmbeddedItem() )
			{
				if( openEmbeddedItemAtPos( cur_segment->getStart() ) )
				{
					deselect();
					setFocus( FALSE );
					return TRUE;
				}
			}
		}

	
		setCursorAtLocalPos( x, y, FALSE );
		deselect();

		const LLWString &text = getWText();
		
		if( isPartOfWord( text[mCursorPos] ) )
		{
			// Select word the cursor is over
			while ((mCursorPos > 0) && isPartOfWord(text[mCursorPos-1]))
			{
				mCursorPos--;
			}
			startSelection();

			while ((mCursorPos < (S32)text.length()) && isPartOfWord( text[mCursorPos] ) )
			{
				mCursorPos++;
			}
		
			mSelectionEnd = mCursorPos;
		}
		else if ((mCursorPos < (S32)text.length()) && !iswspace( text[mCursorPos]) )
		{
			// Select the character the cursor is over
			startSelection();
			mCursorPos++;
			mSelectionEnd = mCursorPos;
		}

		// We don't want handleMouseUp() to "finish" the selection (and thereby
		// set mSelectionEnd to where the mouse is), so we finish the selection here.
		mIsSelecting = FALSE;  

		// delay cursor flashing
		resetKeystrokeTimer();

		// take selection to 'primary' clipboard
		updatePrimary();

		handled = TRUE;
	}
	return handled;
}
Example #17
0
helpDialog::helpDialog(const QString &path, const QString &page, QWidget *parent)
{
    this->setWindowFlags( Qt::WindowStaysOnTopHint | Qt::SubWindow);
    this ->setWindowIcon(QIcon(":images/icon.png"));//:images/icon.png
    setFixedSize(565,540);
    setFocus();
    setAttribute(Qt::WA_DeleteOnClose);
    setAttribute(Qt::WA_GroupLeader);
    textBrowser=new QTextBrowser;
    textBrowser->setOpenLinks(true);

    homeButton=new QToolButton();
    QPixmap homeButtonpix(":/images/home.png");
    homeButton->setIcon(homeButtonpix);
    homeButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    homeButton->setIconSize(homeButtonpix.size());
    homeButton->setText(" 首  页 ");
    homeButton->setShortcut(tr("Home"));


    upSection=new QToolButton();
    QPixmap upSectionpix(":/images/up.png");
    upSection->setIcon(upSectionpix);
    upSection->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    upSection->setIconSize(upSectionpix.size());
    upSection->setText("上一节");
    upSection->setToolTip("已经是首页了◕‿◕");
    upSection->setShortcut(tr("Left"));

    downSection=new QToolButton();
    QPixmap downSectionpix(":/images/down.png");
    downSection->setIcon(downSectionpix);
    downSection->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    downSection->setIconSize(downSectionpix.size());
    downSection->setText("下一节");
    downSection->setShortcut(tr("Right"));

    //backButton=new QToolButton(tr("&Back"));
    closeButton=new QToolButton();
    QPixmap closeButtonpix(":/images/out.png");
    closeButton->setIcon(closeButtonpix);
    closeButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    closeButton->setIconSize(closeButtonpix.size());
    closeButton->setText(" 退  出 ");
    closeButton->setShortcut(tr("Esc"));

    QHBoxLayout *buttonlayout=new QHBoxLayout;
    buttonlayout->addWidget(homeButton);
    buttonlayout->addWidget(upSection);
    buttonlayout->addWidget(downSection);

    //buttonlayout->addStretch();
    buttonlayout->addWidget(closeButton);
    buttonlayout->setSpacing(70);
    QVBoxLayout *mainLayout =new QVBoxLayout;
    mainLayout->addLayout(buttonlayout);
    mainLayout->addWidget(textBrowser);
    setLayout(mainLayout);

    connect(homeButton,SIGNAL(clicked()),textBrowser,SLOT(home()));
    //connect(backButton,SIGNAL(clicked()),textBrowser,SLOT(backward()));
    connect(closeButton,SIGNAL(clicked()),this,SLOT(close()));

    connect(upSection,SIGNAL(clicked()),this,SLOT(forwardSection()));
    connect(downSection,SIGNAL(clicked()),this,SLOT(backwardSection()));
    connect(textBrowser,SIGNAL(sourceChanged(const QUrl &)),this,SLOT(updateWindowTitle()));
    textBrowser->setSearchPaths(QStringList()<< path <<":/images");
    textBrowser->setSource(page);
    setMouseTracking(true);
}
BOOL LLViewerTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
{
	BOOL	handled = FALSE;

	// Let scrollbar have first dibs
	handled = LLView::childrenHandleMouseDown(x, y, mask) != NULL;

	// enable I Agree checkbox if the user scrolled through entire text
	BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax());
	if (mOnScrollEndCallback && was_scrolled_to_bottom)
	{
		mOnScrollEndCallback(mOnScrollEndData);
	}

	if( !handled && mTakesNonScrollClicks)
	{
		if (!(mask & MASK_SHIFT))
		{
			deselect();
		}

		BOOL start_select = TRUE;
		if( allowsEmbeddedItems() )
		{
			setCursorAtLocalPos( x, y, FALSE );
			llwchar wc = 0;
			if (mCursorPos < getLength())
			{
				wc = getWChar(mCursorPos);
			}
			LLInventoryItem* item_at_pos = LLEmbeddedItems::getEmbeddedItem(wc);
			if (item_at_pos)
			{
				mDragItem = item_at_pos;
				mDragItemChar = wc;
				mDragItemSaved = LLEmbeddedItems::getEmbeddedItemSaved(wc);
				gFocusMgr.setMouseCapture( this );
				mMouseDownX = x;
				mMouseDownY = y;
				S32 screen_x;
				S32 screen_y;
				localPointToScreen(x, y, &screen_x, &screen_y );
				LLToolDragAndDrop::getInstance()->setDragStart( screen_x, screen_y );

				start_select = FALSE;
			}
			else
			{
				mDragItem = NULL;
			}
		}

		if( start_select )
		{
			// If we're not scrolling (handled by child), then we're selecting
			if (mask & MASK_SHIFT)
			{
				S32 old_cursor_pos = mCursorPos;
				setCursorAtLocalPos( x, y, TRUE );

				if (hasSelection())
				{
					/* Mac-like behavior - extend selection towards the cursor
					if (mCursorPos < mSelectionStart
						&& mCursorPos < mSelectionEnd)
					{
						// ...left of selection
						mSelectionStart = llmax(mSelectionStart, mSelectionEnd);
						mSelectionEnd = mCursorPos;
					}
					else if (mCursorPos > mSelectionStart
						&& mCursorPos > mSelectionEnd)
					{
						// ...right of selection
						mSelectionStart = llmin(mSelectionStart, mSelectionEnd);
						mSelectionEnd = mCursorPos;
					}
					else
					{
						mSelectionEnd = mCursorPos;
					}
					*/
					// Windows behavior
					mSelectionEnd = mCursorPos;
				}
				else
				{
					mSelectionStart = old_cursor_pos;
					mSelectionEnd = mCursorPos;
				}
				// assume we're starting a drag select
				mIsSelecting = TRUE;

			}
			else
			{
				setCursorAtLocalPos( x, y, TRUE );
				startSelection();
			}
			gFocusMgr.setMouseCapture( this );
		}

		handled = TRUE;
	}

	if (hasTabStop())
	{
		setFocus(TRUE);
		handled = TRUE;
	}

	// Delay cursor flashing
	resetKeystrokeTimer();

	return handled;
}
Example #19
0
void SessionView::showEvent(QShowEvent *event)
{
    Utils::TreeView::showEvent(event);
    selectActiveSession();
    setFocus();
}
bool QCompletionEdit::eventFilter( QObject *o, QEvent *e )
{
    if ( o == popup || o == listbox || o == listbox->viewport() ) {
	if ( e->type() == QEvent::KeyPress ) {
	    QKeyEvent *ke = (QKeyEvent*)e;
	    if ( ke->key() == Key_Enter || ke->key() == Key_Return || ke->key() == Key_Tab ) {
		if ( ke->key() == Key_Tab && listbox->count() > 1 &&
		     listbox->currentItem() < (int)listbox->count() - 1 ) {
		    listbox->setCurrentItem( listbox->currentItem() + 1 );
		    return TRUE;
		}
		popup->close();
		setFocus();
		blockSignals( TRUE );
		setText( listbox->currentText() );
		blockSignals( FALSE );
		emit chosen( text() );
		return TRUE;
	    } else if ( ke->key() == Key_Left || ke->key() == Key_Right ||
			ke->key() == Key_Up || ke->key() == Key_Down ||
			ke->key() == Key_Home || ke->key() == Key_End ||
			ke->key() == Key_Prior || ke->key() == Key_Next ) {
		return FALSE;
	    } else if ( ke->key() == Key_Escape ) {
		popup->close();
		setFocus();
	    } else if ( ke->key() != Key_Shift && ke->key() != Key_Control &&
			ke->key() != Key_Alt ) {
		updateListBox();
		if ( listbox->count() == 0 || text().length() == 0 ) {
		    popup->close();
		    setFocus();
		}
		QApplication::sendEvent( this, e );
		return TRUE;
	    }
	} else if ( e->type() == QEvent::MouseButtonDblClick ) {
	    popup->close();
	    setFocus();
	    blockSignals( TRUE );
	    setText( listbox->currentText() );
	    blockSignals( FALSE );
	    emit chosen( text() );
	    return TRUE;
	}
    } else if ( o == this ) {
	if ( e->type() == QEvent::KeyPress ) {
	    QKeyEvent *ke = (QKeyEvent*)e;
	    if ( ke->key() == Key_Up ||
		 ke->key() == Key_Down ||
		 ke->key() == Key_Prior ||
		 ke->key() == Key_Next ||
		 ke->key() == Key_Return ||
		 ke->key() == Key_Enter ||
		 ke->key() == Key_Tab ||
		 ke->key() ==  Key_Escape ) {
		QApplication::sendEvent( listbox, e );
		return TRUE;
	    }
	}
    }
    return QLineEdit::eventFilter( o, e );
}
Example #21
0
void
wField::on_selected( qulonglong uid )
{
	setValue( QString::number( uid ) );
	setFocus();
}
Example #22
0
MainWindow::MainWindow()
    : QMainWindow(0)
    , ui(new Ui::MainWindow)
    , m_isKKeyPressed(false)
{
    // Create the UI.
    ui->setupUi(this);
#ifndef Q_WS_X11
    ui->mainToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
#endif
    setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
    setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
    setDockNestingEnabled(true);

    // These use the icon theme on Linux, with fallbacks to the icons specified in QtDesigner for other platforms.
    ui->actionOpen->setIcon(QIcon::fromTheme("document-open", ui->actionOpen->icon()));
    ui->actionSave->setIcon(QIcon::fromTheme("document-save", ui->actionSave->icon()));
    ui->actionEncode->setIcon(QIcon::fromTheme("media-record", ui->actionEncode->icon()));

    // Connect UI signals.
    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openVideo()));
    connect(ui->actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

    // Accept drag-n-drop of files.
    this->setAcceptDrops(true);

    // Add the player widget.
    QLayout* layout = new QVBoxLayout(ui->playerPage);
    layout->setObjectName("centralWidgetLayout");
    layout->setMargin(0);
    m_player = new Player(this);
    layout->addWidget(m_player);
    connect(this, SIGNAL(producerOpened()), m_player, SLOT(onProducerOpened()));
    connect(m_player, SIGNAL(showStatusMessage(QString)), this, SLOT(showStatusMessage(QString)));
    connect(m_player, SIGNAL(inChanged(int)), this, SLOT(onCutModified()));
    connect(m_player, SIGNAL(outChanged(int)), this, SLOT(onCutModified()));

    // Add the docks.
    m_propertiesDock = new QDockWidget(tr("Properties"));
    m_propertiesDock->hide();
    m_propertiesDock->setObjectName("propertiesDock");
    m_propertiesDock->setWindowIcon(QIcon((":/icons/icons/view-form.png")));
    m_propertiesDock->toggleViewAction()->setIcon(QIcon::fromTheme("view-form", m_propertiesDock->windowIcon()));
    addDockWidget(Qt::LeftDockWidgetArea, m_propertiesDock);
    ui->menuView->addAction(m_propertiesDock->toggleViewAction());
    ui->mainToolBar->addAction(m_propertiesDock->toggleViewAction());
    connect(m_propertiesDock->toggleViewAction(), SIGNAL(triggered(bool)), this, SLOT(onPropertiesDockTriggered(bool)));

    m_recentDock = new RecentDock(this);
    m_recentDock->hide();
    addDockWidget(Qt::LeftDockWidgetArea, m_recentDock);
    ui->menuView->addAction(m_recentDock->toggleViewAction());
    ui->mainToolBar->addAction(m_recentDock->toggleViewAction());
    connect(m_recentDock, SIGNAL(itemActivated(QString)), this, SLOT(open(QString)));
    connect(m_recentDock->toggleViewAction(), SIGNAL(triggered(bool)), this, SLOT(onRecentDockTriggered(bool)));

    m_playlistDock = new PlaylistDock(this);
    m_playlistDock->hide();
    addDockWidget(Qt::LeftDockWidgetArea, m_playlistDock);
    ui->menuView->addAction(m_playlistDock->toggleViewAction());
    ui->mainToolBar->addAction(m_playlistDock->toggleViewAction());
    connect(m_playlistDock->toggleViewAction(), SIGNAL(triggered(bool)), this, SLOT(onPlaylistDockTriggered(bool)));
    connect(m_playlistDock, SIGNAL(clipOpened(void*,int,int)), this, SLOT(openCut(void*, int, int)));
    connect(m_playlistDock, SIGNAL(itemActivated(int)), this, SLOT(seekPlaylist(int)));
    connect(m_playlistDock, SIGNAL(showStatusMessage(QString)), this, SLOT(showStatusMessage(QString)));
    connect(m_playlistDock->model(), SIGNAL(created()), this, SLOT(onPlaylistCreated()));
    connect(m_playlistDock->model(), SIGNAL(cleared()), this, SLOT(onPlaylistCleared()));
    connect(m_playlistDock->model(), SIGNAL(closed()), this, SLOT(onPlaylistClosed()));
    connect(m_playlistDock->model(), SIGNAL(modified()), this, SLOT(onPlaylistModified()));
    connect(m_playlistDock->model(), SIGNAL(loaded()), this, SLOT(updateMarkers()));
    connect(m_playlistDock->model(), SIGNAL(modified()), this, SLOT(updateMarkers()));

    tabifyDockWidget(m_recentDock, m_propertiesDock);
    tabifyDockWidget(m_propertiesDock, m_playlistDock);
    m_recentDock->raise();

    m_encodeDock = new EncodeDock(this);
    m_encodeDock->hide();
    addDockWidget(Qt::RightDockWidgetArea, m_encodeDock);
    ui->menuView->addAction(m_encodeDock->toggleViewAction());
    ui->mainToolBar->addAction(ui->actionEncode);
    connect(this, SIGNAL(producerOpened()), m_encodeDock, SLOT(onProducerOpened()));
    connect(m_encodeDock, SIGNAL(visibilityChanged(bool)), ui->actionEncode, SLOT(setChecked(bool)));
    connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), m_player, SLOT(onCaptureStateChanged(bool)));
    connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), m_propertiesDock, SLOT(setDisabled(bool)));
    connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), m_recentDock, SLOT(setDisabled(bool)));
    connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), ui->actionOpen, SLOT(setDisabled(bool)));
    connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), ui->actionOpenOther, SLOT(setDisabled(bool)));
    connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), ui->actionExit, SLOT(setDisabled(bool)));
    connect(m_encodeDock, SIGNAL(captureStateChanged(bool)), this, SLOT(onCaptureStateChanged(bool)));

    m_jobsDock = new JobsDock(this);
    m_jobsDock->hide();
    addDockWidget(Qt::RightDockWidgetArea, m_jobsDock);
    tabifyDockWidget(m_encodeDock, m_jobsDock);
    ui->menuView->addAction(m_jobsDock->toggleViewAction());
    connect(&JOBS, SIGNAL(jobAdded()), m_jobsDock, SLOT(show()));
    connect(&JOBS, SIGNAL(jobAdded()), m_jobsDock, SLOT(raise()));
    connect(m_jobsDock, SIGNAL(visibilityChanged(bool)), this, SLOT(onJobsVisibilityChanged(bool)));

    // Connect signals.
    connect(this, SIGNAL(producerOpened()), this, SLOT(onProducerOpened()));

    // connect video widget signals
#if defined(Q_WS_MAC) || defined(Q_WS_WIN)
    Mlt::GLWidget* videoWidget = (Mlt::GLWidget*) &(MLT);
    connect(videoWidget, SIGNAL(dragStarted()), m_playlistDock, SLOT(onPlayerDragStarted()));
    connect(videoWidget, SIGNAL(seekTo(int)), m_player, SLOT(seek(int)));
#else
    if (m_settings.value("player/opengl", true).toBool()) {
        Mlt::GLWidget* videoWidget = (Mlt::GLWidget*) &(MLT);
        connect(videoWidget, SIGNAL(dragStarted()), m_playlistDock, SLOT(onPlayerDragStarted()));
        connect(videoWidget, SIGNAL(seekTo(int)), m_player, SLOT(seek(int)));
    }
    else {
        Mlt::SDLWidget* videoWidget = (Mlt::SDLWidget*) &(MLT);
        connect(videoWidget, SIGNAL(dragStarted()), m_playlistDock, SLOT(onPlayerDragStarted()));
        connect(videoWidget, SIGNAL(seekTo(int)), m_player, SLOT(seek(int)));
    }
#endif

    readSettings();
    setFocus();
    setCurrentFile("");
}
Example #23
0
void SimpleWithRectangleLabel::editLabel() {
    setFocus();
    label_->setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable);
    label_->setTextInteractionFlags(Qt::TextEditorInteraction);
    label_->setFocus();
}
Example #24
0
InputWidget::InputWidget(QWidget *parent)
    : AbstractItemView(parent),
    _networkId(0)
{
    ui.setupUi(this);
    connect(ui.ownNick, SIGNAL(activated(QString)), this, SLOT(changeNick(QString)));

    layout()->setAlignment(ui.ownNick, Qt::AlignBottom);
    layout()->setAlignment(ui.inputEdit, Qt::AlignBottom);
    layout()->setAlignment(ui.showStyleButton, Qt::AlignBottom);
    layout()->setAlignment(ui.styleFrame, Qt::AlignBottom);

    ui.styleFrame->setVisible(false);

    setFocusProxy(ui.inputEdit);
    ui.ownNick->setFocusProxy(ui.inputEdit);

    ui.ownNick->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    ui.ownNick->installEventFilter(new MouseWheelFilter(this));
    ui.inputEdit->installEventFilter(this);

    ui.inputEdit->setMinHeight(1);
    ui.inputEdit->setMaxHeight(5);
    ui.inputEdit->setMode(MultiLineEdit::MultiLine);
    ui.inputEdit->setPasteProtectionEnabled(true);

    ui.boldButton->setIcon(QIcon::fromTheme("format-text-bold"));
    ui.italicButton->setIcon(QIcon::fromTheme("format-text-italic"));
    ui.underlineButton->setIcon(QIcon::fromTheme("format-text-underline"));
    ui.textcolorButton->setIcon(QIcon::fromTheme("format-text-color"));
    ui.highlightcolorButton->setIcon(QIcon::fromTheme("format-fill-color"));
    ui.encryptionIconLabel->hide();

    _colorMenu = new QMenu();
    _colorFillMenu = new QMenu();

    QStringList names;
    names << tr("White") << tr("Black") << tr("Dark blue") << tr("Dark green") << tr("Red") << tr("Dark red") << tr("Dark magenta")  << tr("Orange")
          << tr("Yellow") << tr("Green") << tr("Dark cyan") << tr("Cyan") << tr("Blue") << tr("Magenta") << tr("Dark gray") << tr("Light gray");

    QPixmap pix(16, 16);
    for (int i = 0; i < inputLine()->mircColorMap().count(); i++) {
        pix.fill(inputLine()->mircColorMap().values()[i]);
        _colorMenu->addAction(pix, names[i])->setData(inputLine()->mircColorMap().keys()[i]);
        _colorFillMenu->addAction(pix, names[i])->setData(inputLine()->mircColorMap().keys()[i]);
    }

    pix.fill(Qt::transparent);
    _colorMenu->addAction(pix, tr("Clear Color"))->setData("");
    _colorFillMenu->addAction(pix, tr("Clear Color"))->setData("");

    ui.textcolorButton->setMenu(_colorMenu);
    connect(_colorMenu, SIGNAL(triggered(QAction *)), this, SLOT(colorChosen(QAction *)));
    ui.highlightcolorButton->setMenu(_colorFillMenu);
    connect(_colorFillMenu, SIGNAL(triggered(QAction *)), this, SLOT(colorHighlightChosen(QAction *)));

    new TabCompleter(ui.inputEdit);

    UiStyleSettings fs("Fonts");
    fs.notify("UseCustomInputWidgetFont", this, SLOT(setUseCustomFont(QVariant)));
    fs.notify("InputWidget", this, SLOT(setCustomFont(QVariant)));
    if (fs.value("UseCustomInputWidgetFont", false).toBool())
        setCustomFont(fs.value("InputWidget", QFont()));

    UiSettings s("InputWidget");

#ifdef HAVE_KDE4
    s.notify("EnableSpellCheck", this, SLOT(setEnableSpellCheck(QVariant)));
    setEnableSpellCheck(s.value("EnableSpellCheck", false));
#endif

    s.notify("EnableEmacsMode", this, SLOT(setEnableEmacsMode(QVariant)));
    setEnableEmacsMode(s.value("EnableEmacsMode", false));

    s.notify("ShowNickSelector", this, SLOT(setShowNickSelector(QVariant)));
    setShowNickSelector(s.value("ShowNickSelector", true));

    s.notify("ShowStyleButtons", this, SLOT(setShowStyleButtons(QVariant)));
    setShowStyleButtons(s.value("ShowStyleButtons", true));

    s.notify("EnablePerChatHistory", this, SLOT(setEnablePerChatHistory(QVariant)));
    setEnablePerChatHistory(s.value("EnablePerChatHistory", true));

    s.notify("MaxNumLines", this, SLOT(setMaxLines(QVariant)));
    setMaxLines(s.value("MaxNumLines", 5));

    s.notify("EnableScrollBars", this, SLOT(setScrollBarsEnabled(QVariant)));
    setScrollBarsEnabled(s.value("EnableScrollBars", true));

    s.notify("EnableLineWrap", this, SLOT(setLineWrapEnabled(QVariant)));
    setLineWrapEnabled(s.value("EnableLineWrap", true));

    s.notify("EnableMultiLine", this, SLOT(setMultiLineEnabled(QVariant)));
    setMultiLineEnabled(s.value("EnableMultiLine", true));

    ActionCollection *coll = QtUi::actionCollection();

    Action *activateInputline = coll->add<Action>("FocusInputLine");
    connect(activateInputline, SIGNAL(triggered()), SLOT(setFocus()));
    activateInputline->setText(tr("Focus Input Line"));
    activateInputline->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));

    connect(inputLine(), SIGNAL(textEntered(QString)), SLOT(onTextEntered(QString)), Qt::QueuedConnection); // make sure the line is already reset, bug #984
    connect(inputLine(), SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(currentCharFormatChanged(QTextCharFormat)));
}
Example #25
0
/*!

*/
void ColorPickerItem::mousePressEvent(QMouseEvent *)
{
    setFocus();
    update();
}
Example #26
0
void TextEdit::showFromWidget(const QRect& r, const QString& caption) {

    qDebug("...showFromWidget....(1)...caption: |%s|",qPrintable(caption));

    if (l && l->isVisible()) { 
        setFocus();
        QString updatetitle = l->caption();
        QString updatecaption = l->text();
        l->hide();
        if (!l->isPassword()) {
            insertPlainText(l->text().trimmed());
        }
        else {
            QString text = l->text().trimmed();
            QByteArray textsha1 = QCryptographicHash::hash(QByteArray(qPrintable(text)),
                                                           QCryptographicHash::Sha1);
            insertPlainText(textsha1.toHex().data());
        }


        //insertPlainText("\n");
        insertTextRegToModify(updatetitle, updatecaption);
        if (l != NULL ) {
            l->close();
            l = NULL;
        }
     
        return;
    }


    DomModel *dommodel = ((QCmdCompleter*) c)->domModel();
    if ( dommodel == NULL ) {
        return;
    }

    QString command = searchCommand();
    QString newcaption = caption;
    qDebug("...showFromWidget....(4)...newcaption: |%s|",qPrintable(newcaption));
    if ( dommodel->prefix().length() > 0  && newcaption.endsWith(dommodel->suffix()) )  {
        newcaption.remove(0,1);
    }
    if ( dommodel->suffix().length() > 0  && newcaption.endsWith(dommodel->suffix()) )  {
        newcaption.chop(1);
    }

    qDebug("...showFromWidget....(5)...newcaption: |%s|",qPrintable(newcaption));

    l = dommodel->selWidgetFromField(command, newcaption, this);

    if ( l == NULL ) {
        SafetYAWL::streamlog << SafetLog::Warning << tr("El Widget para la etiqueta \"%1\" no pudo ser mostrado").arg(caption);
        return;
    }

    if (QString(l->metaObject()->className()) == "ListWidget") {
        l->setGeometry(cursorRect().topLeft().x(), cursorRect().topLeft().y()-cursorRect().height()/2,
                       l->getGeoParams().width(), l->getGeoParams().height()+100);

    }
    else {
    l->setGeometry(cursorRect().topLeft().x(), cursorRect().topLeft().y()-cursorRect().height()/2,
                   l->getGeoParams().width(), l->getGeoParams().height());
    }

//    Chequear

//    l->setPrevValue(newcaption);

    if (!l->isVisible()) {
        l->setPrevCursor(textCursor());
        l->show();
        l->setFocus(Qt::PopupFocusReason);
        updateDockSbMenu();
    }


}
void QgsConfigureShortcutsDialog::changeShortcut()
{
    setFocus(); // make sure we have focus
    setGettingShortcut( true );
}
Example #28
0
//**************************************************************************
//                         1                   2                   3       *
// Col-> 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2   *
// Row                                                                     *
//  1    -----------------   Appointment                                   *
//  2    |               |              ---------------------              *
//  3    |               |   Phone :   |                    |              *
//  4    |               |              ---------------------              *
//  5    |               |              ---------------------              *
//  6    |               |   Location: |                    |              *
//  7    |               |              ---------------------              *
//  8    |               |             ----------------------              *
//  9    |               |   Subject:  |                    |              *
// 10    |               |             |                    |              *
// 11    |               |             |                    |              *
// 12    -----------------             |                    |              *
// 13                                  ----------------------              *
// 14    Users:       ��������������������������������������������Ŀ       *
// 15                 �                                            �       *
// 16                 �                                            �       *
// 17                 �                                            �       *
// 18                 �                                            �       *
// 19                 �                                            �       *
// 20                 ����������������������������������������������       *
// 21   ������������Ŀ  ������������Ŀ  ������������Ŀ                     *
// 22   �            �  �            �  �            �                     *
// 23   ��������������  ��������������  ��������������                     *
//**************************************************************************
// UpdlDialog :: UpdlDialog - Get a book name                              *
//**************************************************************************
UpdlDialog :: UpdlDialog(_IDL_SEQUENCE_Appointment apptList, long *index,
                         unsigned long windowId, IWindow * ownerWnd)
            : IFrameWindow(windowId,
                           desktopWindow(), // parent
                           ownerWnd,        // owner
                           IRectangle(500,  // width
                                      400), // height
                           IWindow::synchPaint
                            |IWindow::clipSiblings
                            |IWindow::saveBits
                            |systemMenu
                            |titleBar
                            |dialogBorder
                            |dialogBackground
                           ),
              clientCanvas(WND_CANVAS_UPDLDIALOG,this,this),
              buttons(WND_CANVAS_UPDLDIALOGBTN,this,this),
              listBox(LB_APPTS,&clientCanvas,&clientCanvas,IRectangle()),
              multicCanvas(WND_CANVAS_UPDLMCDIALOG,
                               &clientCanvas, &clientCanvas, IRectangle()),
              txtAppointment(STR_APPOINTMENT,&multicCanvas,&multicCanvas),
              txtPhone(STR_PHONE,&multicCanvas,&multicCanvas),
              txtLocation(STR_LOCATION,&multicCanvas,&multicCanvas),
              txtSubject(STR_SUBJECT,&multicCanvas,&multicCanvas),
              fldPhone(DDL_PHONE,&multicCanvas,&multicCanvas),
              fldLocation(DDL_LOCATION,&multicCanvas,&multicCanvas),
              fldSubject(DDL_SUBJECT,&multicCanvas,&multicCanvas),
//            UserCanvas(WND_CANVAS_UPDLUSERDIALOG, &clientCanvas, &clientCanvas),
//            lboxUsers(LB_USERS,&UserCanvas,&UserCanvas),
//            txtUsers(TXT_USERS,&UserCanvas,&UserCanvas),
              btnOk(DID_OK,&buttons,&buttons),
              btnCancel(DID_CANCEL,&buttons,&buttons),
              btnSelect(DID_SELECT,&buttons,&buttons),
              apptList(apptList),
              IDValue(index)
{
  string bp;
  strstream ss;
  Appointment *appt;

  Environment *ev = somGetGlobalEnvironment();

  setClient(&clientCanvas);
  clientCanvas.setOrientation(ISplitCanvas::verticalSplit);
  clientCanvas.setSplitWindowPercentage(&multicCanvas, 60);
  clientCanvas.setSplitWindowPercentage(&listBox, 40);

//UserCanvas.setOrientation(ISplitCanvas::horizontalSplit);

  IWindow::enable(1);
  IHandler::enable(1);
  listBox.enable(1);
  ICommandHandler::handleEventsFor(this); // Set self as command event handler

  if (sequenceLength(apptList)>0) {
     for (int i=0; sequenceLength(apptList)>i; i++) {
        appt = sequenceElement(apptList,i);
        ss << ITime(appt->_get_start(ev)) << " to " << ITime(appt->_get_end(ev)) << endl;
        listBox.addAsLast(bp=ss.str());
        ss.rdbuf()->seekoff(0, ios::beg, ios::in|ios::out);
     }
     ss.rdbuf()->freeze(0); // release string buffer
  }

  txtAppointment.setText(STR_APPOINTMENT);
  txtPhone.setText(STR_PHONE);
  txtLocation.setText(STR_LOCATION);
  txtSubject.setText(STR_SUBJECT);

                                  // Disable until the appointment is selected
  fldLocation.disable();
  fldPhone.disable();
  fldSubject.disable();
  *IDValue = -1;  // Initialize the IDValue

//txtUsers.setText(STR_USERS);

  btnOk.setText(STR_OK);
  btnOk.disable();    // disable until a selection is made
  btnCancel.setText(STR_CANCEL);
  btnSelect.setText(STR_SELECT);
  if (windowId == WND_DELAPPTDIALOG) {     // Set everything to read only
    fldPhone.enableDataUpdate(false);
    fldLocation.enableDataUpdate(false);
    fldSubject.enableDataUpdate(false);
  }

  //                      Field              Col  Row  #Col  #Row
  multicCanvas.addToCell(&txtAppointment  ,    2,   2,   12,   1);

  multicCanvas.addToCell(&txtPhone        ,    2,   3,    2,   1);
  multicCanvas.addToCell(&txtLocation     ,    2,   6,    2,   1);
  multicCanvas.addToCell(&txtSubject      ,    2,   9,    2,   1);

  multicCanvas.addToCell(&fldPhone        ,    6,   3,   10,   1);
  multicCanvas.addToCell(&fldLocation     ,    6,   6,   10,   1);
  multicCanvas.addToCell(&fldSubject      ,    6,   9,   10,   1);

  setFocus();
  buttons.setMargin(ISize());            // Set Canvas Margins to zero
  buttons.setPad(ISize());               // Set Button Canvas Pad to zero
  addExtension(&buttons, IFrameWindow::belowClient,
               (unsigned long)buttons.minimumSize().height()+10);
  listBox.setFocus();
}
Example #29
0
DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
    : QStackedWidget(parent)
    , m_db(db)
    , m_searchUi(new Ui::SearchWidget())
    , m_searchWidget(new QWidget())
    , m_newGroup(Q_NULLPTR)
    , m_newEntry(Q_NULLPTR)
    , m_newParent(Q_NULLPTR)
{
    m_searchUi->setupUi(m_searchWidget);

    m_searchTimer = new QTimer(this);
    m_searchTimer->setSingleShot(true);

    m_mainWidget = new QWidget(this);
    QLayout* layout = new QHBoxLayout(m_mainWidget);
    m_splitter = new QSplitter(m_mainWidget);
    m_splitter->setChildrenCollapsible(false);

    QWidget* rightHandSideWidget = new QWidget(m_splitter);
    m_searchWidget->setParent(rightHandSideWidget);

    m_groupView = new GroupView(db, m_splitter);
    m_groupView->setObjectName("groupView");
    m_groupView->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(m_groupView, SIGNAL(customContextMenuRequested(QPoint)),
            SLOT(emitGroupContextMenuRequested(QPoint)));

    m_entryView = new EntryView(rightHandSideWidget);
    m_entryView->setObjectName("entryView");
    m_entryView->setContextMenuPolicy(Qt::CustomContextMenu);
    m_entryView->setGroup(db->rootGroup());
    connect(m_entryView, SIGNAL(customContextMenuRequested(QPoint)),
            SLOT(emitEntryContextMenuRequested(QPoint)));

    QAction* closeAction = new QAction(m_searchWidget);
    QIcon closeIcon = filePath()->icon("actions", "dialog-close");
    closeAction->setIcon(closeIcon);
    m_searchUi->closeSearchButton->setDefaultAction(closeAction);
    m_searchUi->closeSearchButton->setShortcut(Qt::Key_Escape);
    m_searchWidget->hide();
    m_searchUi->caseSensitiveCheckBox->setVisible(false);

    QVBoxLayout* vLayout = new QVBoxLayout(rightHandSideWidget);
    vLayout->setMargin(0);
    vLayout->addWidget(m_searchWidget);
    vLayout->addWidget(m_entryView);

    rightHandSideWidget->setLayout(vLayout);

    setTabOrder(m_searchUi->searchRootRadioButton, m_entryView);
    setTabOrder(m_entryView, m_groupView);
    setTabOrder(m_groupView, m_searchWidget);

    m_splitter->addWidget(m_groupView);
    m_splitter->addWidget(rightHandSideWidget);

    m_splitter->setStretchFactor(0, 30);
    m_splitter->setStretchFactor(1, 70);

    layout->addWidget(m_splitter);
    m_mainWidget->setLayout(layout);

    m_editEntryWidget = new EditEntryWidget();
    m_editEntryWidget->setObjectName("editEntryWidget");
    m_historyEditEntryWidget = new EditEntryWidget();
    m_editGroupWidget = new EditGroupWidget();
    m_editGroupWidget->setObjectName("editGroupWidget");
    m_changeMasterKeyWidget = new ChangeMasterKeyWidget();
    m_changeMasterKeyWidget->headlineLabel()->setText(tr("Change master key"));
    QFont headlineLabelFont = m_changeMasterKeyWidget->headlineLabel()->font();
    headlineLabelFont.setBold(true);
    headlineLabelFont.setPointSize(headlineLabelFont.pointSize() + 2);
    m_changeMasterKeyWidget->headlineLabel()->setFont(headlineLabelFont);
    m_databaseSettingsWidget = new DatabaseSettingsWidget();
    m_databaseSettingsWidget->setObjectName("databaseSettingsWidget");
    m_databaseOpenWidget = new DatabaseOpenWidget();
    m_databaseOpenWidget->setObjectName("databaseOpenWidget");
    m_keepass1OpenWidget = new KeePass1OpenWidget();
    m_keepass1OpenWidget->setObjectName("keepass1OpenWidget");
    m_unlockDatabaseWidget = new UnlockDatabaseWidget();
    m_unlockDatabaseWidget->setObjectName("unlockDatabaseWidget");
    addWidget(m_mainWidget);
    addWidget(m_editEntryWidget);
    addWidget(m_editGroupWidget);
    addWidget(m_changeMasterKeyWidget);
    addWidget(m_databaseSettingsWidget);
    addWidget(m_historyEditEntryWidget);
    addWidget(m_databaseOpenWidget);
    addWidget(m_keepass1OpenWidget);
    addWidget(m_unlockDatabaseWidget);

    connect(m_splitter, SIGNAL(splitterMoved(int,int)), SIGNAL(splitterSizesChanged()));
    connect(m_entryView->header(), SIGNAL(sectionResized(int,int,int)), SIGNAL(entryColumnSizesChanged()));
    connect(m_groupView, SIGNAL(groupChanged(Group*)), this, SLOT(clearLastGroup(Group*)));
    connect(m_groupView, SIGNAL(groupChanged(Group*)), SIGNAL(groupChanged()));
    connect(m_groupView, SIGNAL(groupChanged(Group*)), m_entryView, SLOT(setGroup(Group*)));
    connect(m_entryView, SIGNAL(entryActivated(Entry*, EntryModel::ModelColumn)),
            SLOT(entryActivationSignalReceived(Entry*, EntryModel::ModelColumn)));
    connect(m_entryView, SIGNAL(entrySelectionChanged()), SIGNAL(entrySelectionChanged()));
    connect(m_editEntryWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
    connect(m_editEntryWidget, SIGNAL(historyEntryActivated(Entry*)), SLOT(switchToHistoryView(Entry*)));
    connect(m_historyEditEntryWidget, SIGNAL(editFinished(bool)), SLOT(switchBackToEntryEdit()));
    connect(m_editGroupWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
    connect(m_changeMasterKeyWidget, SIGNAL(editFinished(bool)), SLOT(updateMasterKey(bool)));
    connect(m_databaseSettingsWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
    connect(m_databaseOpenWidget, SIGNAL(editFinished(bool)), SLOT(openDatabase(bool)));
    connect(m_keepass1OpenWidget, SIGNAL(editFinished(bool)), SLOT(openDatabase(bool)));
    connect(m_unlockDatabaseWidget, SIGNAL(editFinished(bool)), SLOT(unlockDatabase(bool)));
    connect(this, SIGNAL(currentChanged(int)), this, SLOT(emitCurrentModeChanged()));
    connect(m_searchUi->searchEdit, SIGNAL(textChanged(QString)), this, SLOT(startSearchTimer()));
    connect(m_searchUi->caseSensitiveCheckBox, SIGNAL(toggled(bool)), this, SLOT(startSearch()));
    connect(m_searchUi->searchCurrentRadioButton, SIGNAL(toggled(bool)), this, SLOT(startSearch()));
    connect(m_searchUi->searchRootRadioButton, SIGNAL(toggled(bool)), this, SLOT(startSearch()));
    connect(m_searchUi->searchEdit, SIGNAL(returnPressed()), m_entryView, SLOT(setFocus()));
    connect(m_searchTimer, SIGNAL(timeout()), this, SLOT(search()));
    connect(closeAction, SIGNAL(triggered()), this, SLOT(closeSearch()));

    setCurrentWidget(m_mainWidget);
}
void scene_view::mouseMoveEvent(QMouseEvent *event)
{
    int x = event->localPos().x();
    int y = event->localPos().y();

    const bool shift = event->modifiers().testFlag(Qt::ShiftModifier);
    const bool alt = event->modifiers().testFlag(Qt::AltModifier);

    bool lock_mouse = false;

    auto btns = event->buttons();
    if (btns.testFlag(Qt::RightButton))
    {
        if (shift)
        {
            m_camera_yaw += x - m_mouse_x;
            m_camera_pitch += y - m_mouse_y;
            m_camera_yaw.normalize();
            m_camera_pitch.clamp(-90, 90);
        }
        else if (alt)
        {
            m_camera_pos.y -= (y - m_mouse_y) * 10.0f;
            m_camera_pos.y = nya_math::clamp(m_camera_pos.y, 20.0f, 5000.0f);
        }
        else
        {
            nya_math::vec2 dpos(x - m_mouse_x, y - m_mouse_y);
            dpos.rotate(m_camera_yaw);
            dpos *= m_camera_pos.y / 30.0f;
            m_camera_pos.x += dpos.x, m_camera_pos.z += dpos.y;
            m_camera_pos.x = nya_math::clamp(m_camera_pos.x, -location_size, location_size);
            m_camera_pos.z = nya_math::clamp(m_camera_pos.z, -location_size, location_size);
        }
    }
    else if (btns.testFlag(Qt::LeftButton))
    {
        nya_math::vec2 dpos(x - m_mouse_x, y - m_mouse_y);
        dpos.rotate(m_camera_yaw);
        dpos *= m_camera_pos.y / 300.0f;
        if (shift)
            dpos *= 10.0f;

        if (m_mode == mode_edit)
        {
            for (auto &o: m_selection["objects"])
            {
                if (o >= m_objects.size())
                    continue;

                auto &obj = m_objects[o];
                obj.pos.x += dpos.x, obj.pos.z += dpos.y;
                obj.pos.y = m_location_phys.get_height(obj.pos.x, obj.pos.z, true);
            }

            for (auto &o: m_selection["paths"])
            {
                if (o >= m_paths.size())
                    continue;

                auto &pth = m_paths[o];
                for (auto &p: pth.points)
                {
                    p.x += dpos.x, p.z += dpos.y;
                    p.y = m_location_phys.get_height(p.x, p.z, true);
                }
            }

            if (!m_selection["player spawn"].empty())
            {
                m_player.pos.x += dpos.x, m_player.pos.z += dpos.y;
                m_player.pos.y = m_location_phys.get_height(m_player.pos.x, m_player.pos.z, true);
            }
        }
    }
    else if (alt)
    {
        const float add = -(y - m_mouse_y) * (shift ? 10.0f : 1.0f);
        lock_mouse = true;

        if (m_mode == mode_add || m_mode == mode_path)
            m_selected_add.y = nya_math::clamp(m_selected_add.y + add, 0.0f, 10000.0f);

        if (m_mode == mode_zone)
            m_zone_add.radius = nya_math::clamp(m_zone_add.radius + add, 1.0f, 10000.0f);

        if (m_mode == mode_edit)
        {
            for (auto &o: m_selection["objects"])
            {
                if (o < m_objects.size())
                    m_objects[o].y = nya_math::clamp(m_objects[o].y + add, 0.0f, 10000.0f);
            }

            if (!m_selection["player spawn"].empty())
                m_player.y = nya_math::clamp(m_player.y + add, 0.0f, 10000.0f);
        }
    }
    else if (shift)
    {
        const nya_math::angle_deg add = (y - m_mouse_y) * 4.0f;
        lock_mouse = true;

        if (m_mode == mode_add)
            m_selected_add.yaw = (m_selected_add.yaw + add).normalize();

        if (m_mode == mode_edit)
        {
            const float far_dist = 100000.0f;
            nya_math::vec3 vmin(far_dist, far_dist, far_dist), vmax(-far_dist, -far_dist, -far_dist);

            for (auto &o: m_selection["objects"])
            {
                if (o >= m_objects.size())
                    continue;

                m_objects[o].yaw = (m_objects[o].yaw + add).normalize();
                vmin = nya_math::vec3::min(vmin, m_objects[o].pos);
                vmax = nya_math::vec3::max(vmax, m_objects[o].pos);
            }

            for (auto &o: m_selection["paths"])
            {
                if (o >= m_paths.size())
                    continue;

                for (auto &p: m_paths[o].points)
                {
                    vmin = nya_math::vec3::min(vmin, p.xyz());
                    vmax = nya_math::vec3::max(vmax, p.xyz());
                }
            }

            if (!m_selection["player spawn"].empty())
            {
                m_player.yaw = (m_player.yaw + add).normalize();
                vmin = nya_math::vec3::min(vmin, m_player.pos);
                vmax = nya_math::vec3::max(vmax, m_player.pos);
            }

            auto c = vmin + (vmax - vmin) * 0.5;

            const nya_math::quat rot(nya_math::angle_deg(), add, 0);

            for (auto &o: m_selection["objects"])
            {
                if (o >= m_objects.size())
                    continue;

                m_objects[o].pos = c + rot.rotate(m_objects[o].pos - c);
            }

            for (auto &o: m_selection["paths"])
            {
                if (o >= m_paths.size())
                    continue;

                for (auto &p: m_paths[o].points)
                    p.xyz() = c + rot.rotate(p.xyz() - c);
            }

            if (!m_selection["player spawn"].empty())
                m_player.pos = c + rot.rotate(m_player.pos - c);
        }
    }

    if (lock_mouse)
    {
        QPoint glob = mapToGlobal(QPoint(m_mouse_x, m_mouse_y));
        clearFocus();
        QCursor::setPos(glob);
        setFocus();
    }
    else
        m_mouse_x = x, m_mouse_y = y;

    update();
}