SearchFilter::SearchFilter(QWidget *parent, const char *name) : QWidget(parent) { setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QHBoxLayout *box = new QHBoxLayout(this); mRegExp = new QComboBox(this); box->addWidget(mRegExp); mRegExp->setLineEdit(new MyLineEdit(mRegExp)); mRegExp->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); mRegExp->setEditable(true); connect(mRegExp->lineEdit(), SIGNAL(enterPressed()), SLOT(updateFilter())); box->addWidget(new QLabel(tr("Size:"))); mSize = new QComboBox(this); box->addWidget(mSize); mSize->setLineEdit(new MyLineEdit(mSize)); mSize->setEditable(true); connect(mSize->lineEdit(), SIGNAL(enterPressed()), SLOT(updateFilter())); box->addWidget(new QLabel(tr("Bitrate:"))); mBitrate = new QComboBox(this); box->addWidget(mBitrate); mBitrate->setLineEdit(new MyLineEdit(mBitrate)); mBitrate->setEditable(true); connect(mBitrate->lineEdit(), SIGNAL(enterPressed()), SLOT(updateFilter())); mFreeSlot = new QCheckBox(tr("Free slot"), this); box->addWidget(mFreeSlot); connect(mFreeSlot, SIGNAL(toggled(bool)), SLOT(updateFilter())); updateFilter(); }
CDialogFindInFiles::CDialogFindInFiles(QWidget *parent) : QWidget(parent) { m_labelFiles = new QLabel(STRING_FIND_FROM, this); m_comboboxFiles = new CDialogFindCompobox(this); m_buttonOpenFolderDialog = new QPushButton("...", this); m_labelFileTypes = new QLabel(STRING_FIND_FILE_TYPES, this); m_comboboxFileTypes = new CDialogFindCompobox(this); connect(m_comboboxFiles, SIGNAL(enterPressed()), parent, SLOT(onSearchClicked())); connect(m_comboboxFileTypes, SIGNAL(enterPressed()), parent, SLOT(onSearchClicked())); m_comboboxFiles->setEditable(true); m_comboboxFileTypes->setEditable(true); m_labelFiles->setGeometry(0, 0, DIALOG_FIND_FIRST_COLUMN_WIDTH, m_labelFiles->height() ); const int iButtonOpenFolderDialogWidth = 20; m_comboboxFiles->setGeometry(DIALOG_FIND_FIRST_COLUMN_WIDTH, 0, DIALOG_FIND_SECOND_COLUMN_WIDTH - iButtonOpenFolderDialogWidth - 5, m_comboboxFiles->height() ); m_buttonOpenFolderDialog->setGeometry(m_comboboxFiles->x()+m_comboboxFiles->width()+5, 0, iButtonOpenFolderDialogWidth, m_comboboxFiles->height() ); m_labelFileTypes->setGeometry(0, DIALOG_FIND_ROW_HEIGHT, DIALOG_FIND_FIRST_COLUMN_WIDTH, m_labelFileTypes->height() ); m_comboboxFileTypes->setGeometry(DIALOG_FIND_FIRST_COLUMN_WIDTH, DIALOG_FIND_ROW_HEIGHT, DIALOG_FIND_SECOND_COLUMN_WIDTH, m_comboboxFileTypes->height() ); connect(m_buttonOpenFolderDialog, SIGNAL(clicked()), this, SLOT(onOpenFolderDialog())); }
void QInputBox::keyReleaseEvent(QKeyEvent* e) { if(e->key() == Qt::Key_Enter) { emit enterPressed(); } }
LoadCoreWindow::LoadCoreWindow(QWidget *parent) : QMainWindow(parent) ,m_layout() ,m_table(new LoadCoreTableWidget()) ,m_statusLabel(new QLabel()) { QHBoxLayout *hbox = new QHBoxLayout(); QPushButton *customCoreButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_LOAD_CUSTOM_CORE)); connect(customCoreButton, SIGNAL(clicked()), this, SLOT(onLoadCustomCoreClicked())); connect(m_table, SIGNAL(enterPressed()), this, SLOT(onCoreEnterPressed())); connect(m_table, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(onCellDoubleClicked(int,int))); setWindowTitle(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_LOAD_CORE)); setCentralWidget(new QWidget()); centralWidget()->setLayout(&m_layout); hbox->addWidget(customCoreButton); hbox->addItem(new QSpacerItem(width(), 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); m_layout.addWidget(m_table); m_layout.addLayout(hbox); statusBar()->addPermanentWidget(m_statusLabel); }
void ChatTextEdit::keyPressEvent(QKeyEvent * event) { int key = event->key(); if ((key == Qt::Key_Enter || key == Qt::Key_Return) && !(event->modifiers() & Qt::ShiftModifier)) emit enterPressed(); else if (key == Qt::Key_Tab) { if (event->modifiers()) event->ignore(); else { emit tabPressed(); event->ignore(); } } else if (key == Qt::Key_Up && this->toPlainText().isEmpty()) { this->setText(lastMessage); this->setFocus(); this->moveCursor(QTextCursor::MoveOperation::End,QTextCursor::MoveMode::MoveAnchor); } else { emit keyPressed(); QTextEdit::keyPressEvent(event); } }
void Console::setUpConnections(MainWindow* parent) { this->parent = parent; /* set it up so that console can pass input to main window */ connect(this, SIGNAL(enterPressed(QString)), parent, SLOT(receiveInput(QString))); }
GroupChatForm::GroupChatForm(Group* chatGroup) : group(chatGroup), inCall{false} { nusersLabel = new QLabel(); tabber = new TabCompleter(msgEdit, group); fileButton->setEnabled(false); if (group->isAvGroupchat()) { videoButton->setEnabled(false); videoButton->setObjectName("grey"); } else { videoButton->setVisible(false); callButton->setVisible(false); volButton->setVisible(false); micButton->setVisible(false); } nameLabel->setText(group->getGroupWidget()->getName()); nusersLabel->setFont(Style::getFont(Style::Medium)); nusersLabel->setText(GroupChatForm::tr("%1 users in chat","Number of users in chat").arg(group->getPeersCount())); nusersLabel->setObjectName("statusLabel"); avatar->setPixmap(Style::scaleSvgImage(":/img/group_dark.svg", avatar->width(), avatar->height()), Qt::transparent); msgEdit->setObjectName("group"); namesListLayout = new FlowLayout(0,5,0); QStringList names(group->getPeerList()); for (const QString& name : names) { QLabel *l = new QLabel(name); l->setTextFormat(Qt::PlainText); namesListLayout->addWidget(l); } headTextLayout->addWidget(nusersLabel); headTextLayout->addLayout(namesListLayout); headTextLayout->addStretch(); nameLabel->setMinimumHeight(12); nusersLabel->setMinimumHeight(12); connect(sendButton, SIGNAL(clicked()), this, SLOT(onSendTriggered())); connect(msgEdit, SIGNAL(enterPressed()), this, SLOT(onSendTriggered())); connect(msgEdit, &ChatTextEdit::tabPressed, tabber, &TabCompleter::complete); connect(msgEdit, &ChatTextEdit::keyPressed, tabber, &TabCompleter::reset); connect(callButton, &QPushButton::clicked, this, &GroupChatForm::onCallClicked); connect(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle())); connect(volButton, SIGNAL(clicked()), this, SLOT(onVolMuteToggle())); connect(nameLabel, &CroppingLabel::textChanged, this, [=](QString text, QString orig) {if (text != orig) emit groupTitleChanged(group->getGroupId(), text.left(128));} ); setAcceptDrops(true); }
bool ezQtSearchWidget::eventFilter(QObject* obj, QEvent* e) { if (obj == m_pLineEdit) { if (e->type() == QEvent::KeyPress) { QKeyEvent* pEvent = static_cast<QKeyEvent*>(e); if (pEvent->key() == Qt::Key_Escape && !text().isEmpty()) { setText(""); return true; } if (pEvent->key() == Qt::Key_Return || pEvent->key() == Qt::Key_Enter) { Q_EMIT enterPressed(); return true; } if (pEvent->key() == Qt::Key_Up || pEvent->key() == Qt::Key_Down || pEvent->key() == Qt::Key_Tab || pEvent->key() == Qt::Key_Backtab) { Q_EMIT specialKeyPressed((Qt::Key)pEvent->key()); return true; } } } return false; }
//**************************************************** //* Constructor //**************************************************** TagEditorNewTag::TagEditorNewTag(QWidget *parent) : QLineEdit(parent) { QLOG_TRACE_IN() << typeid(*this).name(); account = 0; this->setCursor(Qt::PointingHandCursor); // Setup the note title editor QPalette pal; pal.setColor(backgroundRole(), QPalette::Base); setPalette(pal); this->setFont(global.getGuiFont(font())); inactiveColor = "QLineEdit {background-color: transparent; border-radius: 0px;} "; activeColor = "QLineEdit {border: 1px solid #808080; background-color: white; border-radius: 4px;} "; this->setStyleSheet(inactiveColor); this->setPlaceholderText(tr("Click to add tag...")); connect(this, SIGNAL(textChanged(QString)), this, SLOT(textModified(QString))); // connect(this, SIGNAL(focussed(bool)), this, SLOT(gainedFocus(bool))); completer = new QCompleter(this); connect(completer, SIGNAL(activated(QString)), this, SLOT(mouseCompleterSelection(QString))); loadCompleter(); connect(this, SIGNAL(returnPressed()), this, SLOT(enterPressed())); hide(); QLOG_TRACE_OUT() << typeid(*this).name(); }
void LoadCoreTableWidget::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) { event->accept(); emit enterPressed(); } else QTableWidget::keyPressEvent(event); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->inputBox->installEventFilter(this); ui->outputBox->setReadOnly(true); saveFile = false; connected = false; connect(ui->chatButton, SIGNAL(clicked()), this, SLOT(startChat())); connect(this, SIGNAL(enterPressed()), this, SLOT(sendData())); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); connect(ui->Button0,SIGNAL(clicked()),this,SLOT(num0Pressed())); connect(ui->Button1,SIGNAL(clicked()),this,SLOT(num1Pressed())); connect(ui->Button2,SIGNAL(clicked()),this,SLOT(num2Pressed())); connect(ui->Button3,SIGNAL(clicked()),this,SLOT(num3Pressed())); connect(ui->Button4,SIGNAL(clicked()),this,SLOT(num4Pressed())); connect(ui->Button5,SIGNAL(clicked()),this,SLOT(num5Pressed())); connect(ui->Button6,SIGNAL(clicked()),this,SLOT(num6Pressed())); connect(ui->Button7,SIGNAL(clicked()),this,SLOT(num7Pressed())); connect(ui->Button8,SIGNAL(clicked()),this,SLOT(num8Pressed())); connect(ui->Button9,SIGNAL(clicked()),this,SLOT(num9Pressed())); connect(ui->Buttonegale,SIGNAL(clicked()),this,SLOT(enterPressed())); }
ResidentTab::ResidentTab(QWidget *parent) : QWidget(parent), mStartTimeEdit(0), mEndTimeEdit(0), mLinesLayout(0), mStatusLabel(0), mHadErrorDuringCalculations(false) { QBoxLayout* mainLayout = new QBoxLayout(QBoxLayout::TopToBottom, this); //HowTo label QLabel* howToLabel = new QLabel(tr("Date's format: d/m/yy"), this); mainLayout->addWidget(howToLabel); // Add lines layout QBoxLayout* addLinelayout = new QBoxLayout(QBoxLayout::LeftToRight, this); addLinelayout->setAlignment(Qt::AlignTop); QWidget* lineWidget = new QWidget(this); lineWidget->setLayout(addLinelayout); mainLayout->addWidget(lineWidget); QLabel* addLineLabel = new QLabel(tr("add new entry"), this); addLinelayout->addWidget(addLineLabel, 0, Qt::AlignLeft | Qt::AlignVCenter); mStartTimeEdit = new OneLineEdit(this); mStartTimeEdit->setEnterKeyResponseType(OneLineEdit::EmitJumpToNext); connect(mStartTimeEdit, SIGNAL(jumpToNext()), this, SLOT(onJumpToNextTimeEdit())); addLinelayout->addWidget(mStartTimeEdit); mEndTimeEdit = new OneLineEdit(this); mEndTimeEdit->setEnterKeyResponseType(OneLineEdit::EmitEnterPressed); connect(mEndTimeEdit, SIGNAL(enterPressed()), this, SLOT(onAddNewEntry())); addLinelayout->addWidget(mEndTimeEdit); QPushButton* addEntryButton = new QPushButton(tr("add"), this); connect(addEntryButton, SIGNAL(clicked()), this, SLOT(onAddNewEntry())); addLinelayout->addWidget(addEntryButton); // Lines layout mLinesLayout = new QBoxLayout(QBoxLayout::TopToBottom, this); QWidget* linesWidget = new QWidget(this); linesWidget->setLayout(mLinesLayout); mainLayout->addWidget(linesWidget); // Status label that contains result mStatusLabel = new QLabel(tr("no entries"), this); mainLayout->addWidget(mStatusLabel); setLayout(mainLayout); QTimer::singleShot(0, mStartTimeEdit, SLOT(setFocus())); }
InputDialog::InputDialog(String const &name) : MessageDialog(name), d(new Instance) { // Create the editor. area().add(d->editor = new LineEditWidget); d->editor->setSignalOnEnter(true); connect(d->editor, SIGNAL(enterPressed(QString)), this, SLOT(accept())); buttons() << new DialogButtonItem(Default | Accept) << new DialogButtonItem(Reject); updateLayout(); }
void TextEditor::keyPressEvent (QKeyEvent * event) { if (m_commaTyped && event->key() != Qt::Key_Space) { m_commaTyped = false; } switch(event->key()) { case Qt::Key_Tab: if (m_parameterMode) { emit tabPressed(); } else if(m_tabIndents) { emit requestIndent(); } else { QTextEdit::keyPressEvent(event); } return; case Qt::Key_Backtab: if (m_parameterMode) { emit backtabPressed(); } else if(m_tabIndents) { emit requestUnindent(); } return; case Qt::Key_Return: case Qt::Key_Enter: emit enterPressed(); break; case Qt::Key_Space: if (m_commaTyped) { emit showParameterInfo(); } m_commaTyped = false; break; case Qt::Key_Comma: m_commaTyped = true; break; } QTextEdit::keyPressEvent(event); // Process key events in the rest of the application if (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down || event->key() == Qt::Key_Left || event->key() == Qt::Key_Right) { emit arrowPressed(); } if (event->key() == Qt::Key_Escape) { emit escapePressed(); } else if(event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) { emit newLine(); } return; }
void SpinBoxEntry::keyPressEvent (QKeyEvent *event) { // If Enter or Return are pressed, emit the enterPressed // signal, or else defer to the parent class. switch(event->key()) { case Qt::Key_Enter: case Qt::Key_Return: emit enterPressed(); break; default: QDoubleSpinBox::keyPressEvent (event); } }
void TypingBox::keyPressEvent(QKeyEvent *event) { if(event->key()==Qt::Key_Return){ emit enterPressed(); } else if(event->key()==Qt::Key_Escape) { emit escapePressed(); } else if(event->key()==Qt::Key_Tab) { emit switchMode(); } else if(event->key()==Qt::Key_Period && (event->modifiers() & Qt::ControlModifier)) { emit showPreferences(); } else if(event->key()==Qt::Key_Z && (event->modifiers() & Qt::ControlModifier)) { emit switchColoringMode(); } else { QTextBrowser::keyPressEvent(event); } }
///Interception de la frappe au clavier void RzxTextEdit::keyPressEvent(QKeyEvent *e) { QKeyEvent *eMapped = e; bool down=false; //Saut de ligne - Envoie du message switch(eMapped->key()) { case Qt::Key_Enter: case Qt::Key_Return: if(eMapped->modifiers() != Qt::SHIFT) { emit enterPressed(); break; } QTextEdit::keyPressEvent(eMapped); break; //Autocompletion case Qt::Key_Tab: //Pour que quand on appuie sur tab ça fasse la complétion du nick if(!nickAutocompletion()) { QTextEdit::keyPressEvent(eMapped); onTextEdited(); } break; //Parcours de l'historique case Qt::Key_Down: down=true; case Qt::Key_Up: //Et op, parcours de l'historique si les conditions sont réunies if((eMapped->modifiers() & Qt::ShiftModifier) || (eMapped->modifiers() & Qt::ControlModifier) || (down && atEnd()) || (!down && atBeginning())) { onArrowPressed(down); break; } eMapped = new QKeyEvent(QEvent::KeyRelease, e->key(), e->modifiers(), e->text()); //Texte normal default: QTextEdit::keyPressEvent(eMapped); onTextEdited(); } }
TwitPicView::TwitPicView(QWidget *parent) : QDialog(parent), pixmap( 0 ), m_ui(new Ui::TwitPicView) { m_ui->setupUi( this ); m_ui->uploadProgressBar->setVisible( false ); m_ui->statusEdit->setAllowEnters( false ); connect( m_ui->uploadButton, SIGNAL(clicked()), this, SLOT(sendUploadRequest()) ); connect( m_ui->statusEdit, SIGNAL(enterPressed()), this, SLOT(sendUploadRequest()) ); connect( m_ui->imagePathEdit, SIGNAL(textChanged(QString)), this, SLOT(setImagePreview(QString)) ); connect( m_ui->browseButton, SIGNAL(pressed()), this, SLOT(setImagePath()) ); #if QT_VERSION < 0x040500 m_ui->statusEdit->setMaximumWidth( 150 ); #endif }
bool StatusFilter::eventFilter( QObject *dist, QEvent *event ) { if ( event->type() == QEvent::KeyPress ) { QKeyEvent *keyEvent = static_cast<QKeyEvent*>( event ); if ( keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return ) { emit enterPressed(); return true; } if ( keyEvent->key() == Qt::Key_Escape ) { emit escPressed(); return true; } } return QObject::eventFilter(dist, event); }
/* when keys are pressed in the widget */ void Console::keyPressEvent(QKeyEvent* e) { /* if we push left or backspace, we can only handle it if there is room */ if (e->key() == Qt::Key_Left || e->key() == Qt::Key_Backspace) { if (textCursor().positionInBlock() > inputStart) { QPlainTextEdit::keyPressEvent(e); } } /* if we push home, then we go to the original start */ else if (e->key() == Qt::Key_Home) { QTextCursor cursor = textCursor(); cursor.movePosition(QTextCursor::StartOfLine, QTextCursor::MoveAnchor, 1); cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, inputStart); setTextCursor(cursor); } /* enter returns the input back to the main window which passes to the program */ else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) { /* get the last line of text */ QString text = textCursor().block().text(); /* remove what was there at start */ text.remove(0, inputStart); /* handle the enter so the line break is put in */ QPlainTextEdit::keyPressEvent(e); /* return this back to the program */ emit enterPressed(text); } /* we ignore all of these keys altogether */ else if (e->key() == Qt::Key_Up || e->key() == Qt::Key_Down || e->key() == Qt::Key_Insert || e->key() == Qt::Key_PageUp || e->key() == Qt::Key_PageDown) { } /* else, just pass it */ else { QPlainTextEdit::keyPressEvent(e); } }
GroupChatForm::GroupChatForm(Group* chatGroup) : group(chatGroup) { nusersLabel = new QLabel(); namesList = new QLabel(); fileButton->setEnabled(false); callButton->setVisible(false); videoButton->setVisible(false); volButton->setVisible(false); micButton->setVisible(false); QFont small; small.setPixelSize(10); nameLabel->setText(group->widget->getName()); nusersLabel->setFont(Style::getFont(Style::Medium)); nusersLabel->setText(GroupChatForm::tr("%1 users in chat","Number of users in chat").arg(group->peers.size())); QPalette pal; pal.setColor(QPalette::WindowText, Style::getColor(Style::MediumGrey)); nusersLabel->setPalette(pal); avatar->setPixmap(QPixmap(":/img/group_dark.png"), Qt::transparent); QString names; for (QString& s : group->peers) names.append(s+", "); names.chop(2); namesList->setText(names); namesList->setFont(small); msgEdit->setObjectName("group"); headTextLayout->addWidget(nusersLabel); headTextLayout->addWidget(namesList); headTextLayout->setMargin(0); headTextLayout->setSpacing(0); headTextLayout->addStretch(); connect(sendButton, SIGNAL(clicked()), this, SLOT(onSendTriggered())); connect(msgEdit, SIGNAL(enterPressed()), this, SLOT(onSendTriggered())); setAcceptDrops(true); }
bool KeyPressEater::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event); if (keyEvent->key() == Qt::Key_Return) { emit enterPressed(obj); return true; } else if (keyEvent->key() == Qt::Key_Tab) { emit tabPressed(); return true; } else { return QObject::eventFilter(obj, event); } } else { return QObject::eventFilter(obj, event); } }
bool LineEditWidget::handleControlKey(int qtKey, KeyModifiers const &mods) { if(AbstractLineEditor::handleControlKey(qtKey, mods)) { if(qtKey == Qt::Key_Enter) { if(d->signalOnEnter) { emit enterPressed(text()); } else { // The Enter will fall through to base class event processing. return false; } } return true; // Handled. } return false; }
bool MainWindow::eventFilter(QObject* obj,QEvent* event) { if(obj == ui->inputBox) { if(event->type() == QEvent::KeyPress) { QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event); if(keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return) { //The user has hit enter or return emit enterPressed(); return true; } else { //let the window pass it on to be handled return QMainWindow::eventFilter(obj,event); } } } return QMainWindow::eventFilter(obj,event); }
void WordTrainingMode::handleKeyPress(QChar letter) { if (runningMode() != RUNNING) return; if (letter == '\r') { enterPressed(); return; } if ((*(words[m_wordsNumber]))[m_wordnumber].length() == m_enteredWord.length()) // they already hit the length previously return; if ((*(words[m_wordsNumber]))[m_wordnumber][m_enteredWord.length()] == letter) { m_ui->letter->setText(m_ui->letter->text() + "<font color=\"green\">" + letter + "<font>"); m_rightCount++; } else { m_ui->letter->setText(m_ui->letter->text() + "<font color=\"red\">" + letter + "<font>"); m_wordWasGood = false; } m_enteredWord.append(letter); if ((*(words[m_wordsNumber]))[m_wordnumber].length() == m_enteredWord.length()) { if (m_wordWasGood) { m_ui->letter->setText(m_ui->letter->text() + " - <font color=\"green\">GOOD</font>"); if (m_maxWord < 10) m_maxWord += 2; else m_maxWord += 1; if (m_maxWord > (*(words[m_wordsNumber])).count()) m_maxWord = (*(words[m_wordsNumber])).count(); } else { m_ui->letter->setText(m_ui->letter->text() + " - <font color=\"red\">FAIL (" + (*(words[m_wordsNumber]))[m_wordnumber] + ")</font>"); if (m_maxWord > 1) m_maxWord--; } emit groupEntered(m_rightCount, m_enteredWord.length()); } }
FindWidget::FindWidget(edbee::TextEditorWidget* parent) : QWidget(parent) , editorRef_( parent ) , lineEditRef_(0) { constructUI(); /// when return is pressed we move to the given line connect(lineEditRef_,SIGNAL(returnPressed()), this, SLOT(enterPressed()) ); // delete when editing is done connect(lineEditRef_,SIGNAL(editingFinished()), this, SLOT(deactivate()) ); // create a close editor action QAction* closeAction = new QAction(lineEditRef_); closeAction->setShortcut( Qt::Key_Escape ); connect( closeAction,SIGNAL(triggered()), this, SLOT(close()) ); lineEditRef_->addAction(closeAction); // move the focus to the editor line lineEditRef_->setFocus(); setFocusProxy(lineEditRef_); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { // "([^"]+)"|(\S+) // ""([^""]+)""|(\\S+) //WavSound *w = new WavSound(":/resources/connected.wav", 0); //w->play(); //return; //PlaySound(); //return; ui->setupUi(this); QApplication::setWindowIcon(QIcon(":/resources/Icon/RunningIcon.png")); strangerPrefsWindow = new StrangerPrefsWindow(this); //QDockWidget *drawdock = new QDockWidget(this,Qt::Dialog); //this->addDockWidget(Qt::RightDockWidgetArea,drawdock); /*CometClient *c = new CometClient(this); c->get("http://gggoogle.ru", 6); c->get("http://gggoogle.ru", 7); c->get("http://google.ru", 8); c->get("http://googleq.ru", 9); c->cancelAllRequests(); return; */ /*QHBoxLayout *dockLayout = new QHBoxLayout(this); QComboBox *b = new QComboBox(this); QTextEdit *t = new QTextEdit(this); dockLayout->addWidget(b); dockLayout->addWidget(t); dockLayout->setSizeConstraint(QLayout::SetMinimumSize); ui->dockWidgetContents_2->setLayout(dockLayout); */ QWidget::setTabOrder(ui->typingBox, ui->chatlogBox); //do not allow Qt framework to intercept Tab keypress (we use it for switching modes) //ui->chatlogBox->setFocusPolicy(Qt::NoFocus); /*QFile stylesheetFile(":/resources/stylesheet.qss"); if(!stylesheetFile.open(QFile::ReadOnly)) { qDebug() << "Error opening file " << stylesheetFile.error(); } QString stylesheetString = QLatin1String(stylesheetFile.readAll()); setStyleSheet(stylesheetString); */ nightColoringMode = false; switchColoringMode(); //switch to night coloring mode, and apply it QStatusBar *sb = this->statusBar(); chatModeLabel = new QLabel(this); //chatModeLabel = new QPushButton(this); //chatModeLabel->setFlat(true); sb->addPermanentWidget(chatModeLabel); typingLabel = new QLabel(this); sb->addPermanentWidget(typingLabel); //center the window setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, size(), qApp->desktop()->availableGeometry())); receivedMessageSound = NULL; sentMessageSound = NULL; connectedSound = NULL; disconnectedSound = NULL; receivedMessageSound = new QSound(":/resources/sounds/shuffle.wav", this); //sentMessageSound = new QSound(":/resources/sounds/test.wav", this); connectedSound = new QSound(":/resources/sounds/click1.wav", this); disconnectedSound = new QSound(":/resources/sounds/phone_disc.wav", this); //receivedMessageSound->setObjectName(); //return; QObject::connect(ui->typingBox, SIGNAL(enterPressed()), this, SLOT(enterPressed())); QObject::connect(ui->typingBox, SIGNAL(escapePressed()), this, SLOT(escapePressed())); QObject::connect(ui->typingBox, SIGNAL(switchMode()), this, SLOT(SwitchMode())); QObject::connect(ui->typingBox, SIGNAL(typingStarted()), this, SLOT(TypingStarted())); QObject::connect(ui->typingBox, SIGNAL(typingStopped()), this, SLOT(TypingStopped())); QObject::connect(ui->typingBox, SIGNAL(showPreferences()), this, SLOT(displayStrangerPreferencesWindow())); QObject::connect(ui->typingBox, SIGNAL(switchColoringMode()), this, SLOT(switchColoringMode())); stranger = new Stranger(this); spy = new Spy(this); rusStranger = new RusStranger(this); //rusStranger->requestChatKey(); //rusStranger->requestUid(); QObject::connect(stranger, SIGNAL(ReceivedMessage(const QString &)), this, SLOT(ReceivedMessage(const QString &))); QObject::connect(stranger, SIGNAL(StrangerDisconnected()), this, SLOT(StrangerDisconnected())); QObject::connect(stranger, SIGNAL(ConversationStarted(QStringList, bool)), this, SLOT(StrangerConnected(QStringList, bool))); //QObject::connect(stranger, SIGNAL(ConversationStarted()), this, SLOT(StrangerConnected())); QObject::connect(stranger, SIGNAL(ConversationStartedWithQuestion(QString)), this, SLOT(StrangerConnectedWithQuestion(QString))); QObject::connect(stranger, SIGNAL(StrangerStartsTyping()), this, SLOT(StrangerStartsTyping())); QObject::connect(stranger, SIGNAL(StrangerStopsTyping()), this, SLOT(StrangerStopsTyping())); QObject::connect(stranger, SIGNAL(SystemMessage(const QString &)), this, SLOT(SystemMessage(const QString &))); QObject::connect(stranger, SIGNAL(WaitingForStranger()), this, SLOT(WaitingForStranger())); QObject::connect(spy, SIGNAL(ReceivedMessage(const QString &,const QString &)), this, SLOT(SpymodeReceivedMessage(const QString &,const QString &))); QObject::connect(spy, SIGNAL(StrangerDisconnected(const QString &)), this, SLOT(SpymodeStrangerDisconnected(const QString &))); QObject::connect(spy, SIGNAL(ConversationStarted()), this, SLOT(SpymodeStrangersConnected())); QObject::connect(spy, SIGNAL(ConversationStartedWithQuestion(QString)), this, SLOT(StrangerConnectedWithQuestion(QString))); QObject::connect(spy, SIGNAL(StrangerStartsTyping(QString)), this, SLOT(SpymodeStrangerStartsTyping(const QString &))); QObject::connect(spy, SIGNAL(StrangerStopsTyping()), this, SLOT(SpymodeStrangerStopsTyping(const QString &))); QObject::connect(spy, SIGNAL(SystemMessage(const QString &)), this, SLOT(SystemMessage(const QString &))); QObject::connect(spy, SIGNAL(WaitingForStranger()), this, SLOT(WaitingForStranger())); QObject::connect(rusStranger, SIGNAL(ReceivedMessage(const QString &)), this, SLOT(ReceivedMessage(const QString &))); QObject::connect(rusStranger, SIGNAL(StrangerDisconnected()), this, SLOT(StrangerDisconnected())); QObject::connect(rusStranger, SIGNAL(ConversationStarted()), this, SLOT(StrangerConnected())); QObject::connect(rusStranger, SIGNAL(StrangerStartsTyping()), this, SLOT(StrangerStartsTyping())); QObject::connect(rusStranger, SIGNAL(StrangerStopsTyping()), this, SLOT(StrangerStopsTyping())); QObject::connect(rusStranger, SIGNAL(WaitingForStranger()), this, SLOT(WaitingForStranger())); //chatMode = Russian; chatMode = AnsweringQuestions; SwitchMode(); //switch it to regular this->escapePressed(); //strangerPrefsWindow->setModal(true); //strangerPrefsWindow->show(); }
CKJVBrowser::CKJVBrowser(CVerseListModel *pModel, CBibleDatabasePtr pBibleDatabase, QWidget *parent) : QWidget(parent), m_pBibleDatabase(pBibleDatabase), m_ndxCurrent(0), m_SearchResultsHighlighter(pModel, false), m_ExcludedSearchResultsHighlighter(pModel, true), m_bShowExcludedSearchResults(CPersistentSettings::instance()->showExcludedSearchResultsInBrowser()), m_bDoingUpdate(false), #ifndef PLASTIQUE_STATIC m_pPlastiqueStyle(NULL), #endif m_bDoingPassageReference(false), m_pScriptureBrowser(NULL) { assert(!m_pBibleDatabase.isNull()); assert(!g_pUserNotesDatabase.isNull()); ui.setupUi(this); #ifndef PLASTIQUE_STATIC m_pPlastiqueStyle = new QProxyStyle(QStyleFactory::create("plastique")); #endif initialize(); assert(m_pScriptureBrowser != NULL); ui.lblBibleDatabaseName->setText(m_pBibleDatabase->description()); setNavigationActivationDelay(CPersistentSettings::instance()->navigationActivationDelay()); setPassageReferenceActivationDelay(CPersistentSettings::instance()->passageReferenceActivationDelay()); setBrowserNavigationPaneMode(CPersistentSettings::instance()->browserNavigationPaneMode()); connect(CPersistentSettings::instance(), SIGNAL(changedNavigationActivationDelay(int)), this, SLOT(setNavigationActivationDelay(int))); connect(CPersistentSettings::instance(), SIGNAL(changedPassageReferenceActivationDelay(int)), this, SLOT(setPassageReferenceActivationDelay(int))); connect(CPersistentSettings::instance(), SIGNAL(changedChapterScrollbarMode(CHAPTER_SCROLLBAR_MODE_ENUM)), this, SLOT(en_changedChapterScrollbarMode())); connect(CPersistentSettings::instance(), SIGNAL(changedBrowserNavigationPaneMode(BROWSER_NAVIGATION_PANE_MODE_ENUM)), this, SLOT(setBrowserNavigationPaneMode(BROWSER_NAVIGATION_PANE_MODE_ENUM))); // Data Connections: connect(pModel, SIGNAL(verseListAboutToChange()), this, SLOT(en_SearchResultsVerseListAboutToChange())); connect(pModel, SIGNAL(verseListChanged()), this, SLOT(en_SearchResultsVerseListChanged())); // UI Connections: connect(m_pScriptureBrowser, SIGNAL(gotoIndex(const TPhraseTag &)), &m_dlyGotoIndex, SLOT(trigger(const TPhraseTag &))); connect(&m_dlyGotoIndex, SIGNAL(triggered(const TPhraseTag &)), this, SLOT(gotoIndex(const TPhraseTag &))); connect(this, SIGNAL(en_gotoIndex(const TPhraseTag &)), m_pScriptureBrowser, SLOT(en_gotoIndex(const TPhraseTag &))); connect(m_pScriptureBrowser, SIGNAL(sourceChanged(const QUrl &)), this, SLOT(en_sourceChanged(const QUrl &))); connect(m_pScriptureBrowser, SIGNAL(cursorPositionChanged()), this, SLOT(en_selectionChanged())); connect(ui.btnHideNavigation, SIGNAL(clicked()), this, SLOT(en_clickedHideNavigationPane())); connect(ui.comboBk, SIGNAL(currentIndexChanged(int)), this, SLOT(delayBkComboIndexChanged(int))); connect(ui.comboBkChp, SIGNAL(currentIndexChanged(int)), this, SLOT(delayBkChpComboIndexChanged(int))); connect(ui.comboTstBk, SIGNAL(currentIndexChanged(int)), this, SLOT(delayTstBkComboIndexChanged(int))); connect(ui.comboTstChp, SIGNAL(currentIndexChanged(int)), this, SLOT(delayTstChpComboIndexChanged(int))); connect(ui.comboBibleBk, SIGNAL(currentIndexChanged(int)), this, SLOT(delayBibleBkComboIndexChanged(int))); connect(ui.comboBibleChp, SIGNAL(currentIndexChanged(int)), this, SLOT(delayBibleChpComboIndexChanged(int))); connect(ui.widgetPassageReference, SIGNAL(passageReferenceChanged(const TPhraseTag &)), this, SLOT(delayPassageReference(const TPhraseTag &))); connect(ui.widgetPassageReference, SIGNAL(enterPressed()), this, SLOT(PassageReferenceEnterPressed())); connect(&m_dlyBkCombo, SIGNAL(triggered(int)), this, SLOT(BkComboIndexChanged(int))); connect(&m_dlyBkChpCombo, SIGNAL(triggered(int)), this, SLOT(BkChpComboIndexChanged(int))); connect(&m_dlyTstBkCombo, SIGNAL(triggered(int)), this, SLOT(TstBkComboIndexChanged(int))); connect(&m_dlyTstChpCombo, SIGNAL(triggered(int)), this, SLOT(TstChpComboIndexChanged(int))); connect(&m_dlyBibleBkCombo, SIGNAL(triggered(int)), this, SLOT(BibleBkComboIndexChanged(int))); connect(&m_dlyBibleChpCombo, SIGNAL(triggered(int)), this, SLOT(BibleChpComboIndexChanged(int))); connect(&m_dlyPassageReference, SIGNAL(triggered(const TPhraseTag &)), this, SLOT(PassageReferenceChanged(const TPhraseTag &))); connect(m_pScriptureBrowser, SIGNAL(activatedScriptureText()), this, SLOT(en_activatedScriptureText())); connect(ui.widgetPassageReference, SIGNAL(activatedPassageReference()), this, SLOT(en_activatedPassageReference())); // Set Outgoing Pass-Through Signals: connect(m_pScriptureBrowser, SIGNAL(backwardAvailable(bool)), this, SIGNAL(backwardAvailable(bool))); connect(m_pScriptureBrowser, SIGNAL(forwardAvailable(bool)), this, SIGNAL(forwardAvailable(bool))); connect(m_pScriptureBrowser, SIGNAL(historyChanged()), this, SIGNAL(historyChanged())); // Set Incoming Pass-Through Signals: connect(this, SIGNAL(backward()), m_pScriptureBrowser, SLOT(backward())); connect(this, SIGNAL(forward()), m_pScriptureBrowser, SLOT(forward())); connect(this, SIGNAL(home()), m_pScriptureBrowser, SLOT(home())); connect(this, SIGNAL(reload()), m_pScriptureBrowser, SLOT(reload())); connect(this, SIGNAL(rerender()), m_pScriptureBrowser, SLOT(rerender())); // Highlighting colors changing: connect(CPersistentSettings::instance(), SIGNAL(changedColorSearchResults(const QColor &)), this, SLOT(en_SearchResultsColorChanged(const QColor &))); connect(CPersistentSettings::instance(), SIGNAL(changedColorWordsOfJesus(const QColor &)), this, SLOT(en_WordsOfJesusColorChanged(const QColor &))); connect(CPersistentSettings::instance(), SIGNAL(changedShowExcludedSearchResultsInBrowser(bool)), this, SLOT(en_ShowExcludedSearchResultsChanged(bool))); connect(g_pUserNotesDatabase.data(), SIGNAL(highlighterTagsAboutToChange(CBibleDatabasePtr, const QString &)), this, SLOT(en_highlighterTagsAboutToChange(CBibleDatabasePtr, const QString &))); connect(g_pUserNotesDatabase.data(), SIGNAL(highlighterTagsChanged(CBibleDatabasePtr, const QString &)), this, SLOT(en_highlighterTagsChanged(CBibleDatabasePtr, const QString &))); connect(g_pUserNotesDatabase.data(), SIGNAL(aboutToChangeHighlighters()), this, SLOT(en_highlightersAboutToChange())); connect(g_pUserNotesDatabase.data(), SIGNAL(changedHighlighters()), this, SLOT(en_highlightersChanged())); // User Notes changing: connect(g_pUserNotesDatabase.data(), SIGNAL(addedUserNote(const CRelIndex &)), this, SLOT(en_userNoteEvent(const CRelIndex &))); connect(g_pUserNotesDatabase.data(), SIGNAL(changedUserNote(const CRelIndex &)), this, SLOT(en_userNoteEvent(const CRelIndex &))); connect(g_pUserNotesDatabase.data(), SIGNAL(removedUserNote(const CRelIndex &)), this, SLOT(en_userNoteEvent(const CRelIndex &))); // Cross Refs changing: connect(g_pUserNotesDatabase.data(), SIGNAL(addedCrossRef(const CRelIndex &, const CRelIndex &)), this, SLOT(en_crossRefsEvent(const CRelIndex &, const CRelIndex &))); connect(g_pUserNotesDatabase.data(), SIGNAL(removedCrossRef(const CRelIndex &, const CRelIndex &)), this, SLOT(en_crossRefsEvent(const CRelIndex &, const CRelIndex &))); connect(g_pUserNotesDatabase.data(), SIGNAL(changedAllCrossRefs()), this, SLOT(en_allCrossRefsChanged())); }
void MyLineEdit::keyReleaseEvent(QKeyEvent *e) { if(e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) emit enterPressed(); else QLineEdit::keyReleaseEvent(e); }