Esempio n. 1
0
SearchToolBar::SearchToolBar(QupZilla* mainClass, QWidget* parent)
    : AnimatedWidget(AnimatedWidget::Up, 300, parent)
    , ui(new Ui::SearchToolbar)
    , p_QupZilla(mainClass)
    , m_findFlags(0)
{
    setAttribute(Qt::WA_DeleteOnClose);
    ui->setupUi(widget());
    ui->closeButton->setIcon(IconProvider::standardIcon(QStyle::SP_DialogCloseButton));

    ui->next->setIcon(IconProvider::standardIcon(QStyle::SP_ArrowForward));

    ui->previous->setIcon(IconProvider::standardIcon(QStyle::SP_ArrowBack));

    connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide()));
    connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(findNext()));
    connect(ui->next, SIGNAL(clicked()), this, SLOT(findNext()));
    connect(ui->previous, SIGNAL(clicked()), this, SLOT(findPrevious()));
    connect(ui->highligh, SIGNAL(clicked()), this, SLOT(highlightChanged()));
    connect(ui->caseSensitive, SIGNAL(clicked()), this, SLOT(caseSensitivityChanged()));
    startAnimation();

    QShortcut* findNextAction = new QShortcut(QKeySequence("F3"), this);
    connect(findNextAction, SIGNAL(activated()), this, SLOT(findNext()));

    QShortcut* findPreviousAction = new QShortcut(QKeySequence("Shift+F3"), this);
    connect(findPreviousAction, SIGNAL(activated()), this, SLOT(findPrevious()));

    p_QupZilla->actionStop()->setEnabled(false);
    qApp->installEventFilter(this);
}
Esempio n. 2
0
void List<Object>::remove( const Object& data ) {
	ListIterator<Object> iter = findPrevious( data );
	if (iter.isValid()) {
		ListNode<Object>* node = findPrevious( data ).current;
		if (node->getNext() != NULL) {
			ListNode<Object> *oldNode = node->getNext();
			node->setNext( node->getNext()->getNext() );  // Skip oldNode
			delete oldNode;
		}
	}
}
Esempio n. 3
0
SCgWindow::SCgWindow(const QString& _windowTitle, QWidget *parent)
    : QWidget(parent)
    , mView(0)
    , mScene(0)
    , mZoomFactorLine(0)
    , mMinimap(0)
    , mUndoView(0)
    , mFindWidget(0)
    , mToolBar(0)
    , mUndoStack(0)
    , mEditMenu(0)
    , mActionUndo(0)
    , mActionRedo(0)
    , mActionFind(0)
    , mActionPrinterGrid(0)
    , mPrinterGridDialog(0)
{
    Q_UNUSED(_windowTitle);

    mUndoStack = new QUndoStack(this);
    /////////////////////////////////////////////////
    //Creating main environment
    mView = new SCgView(0, this);
    mScene = new SCgScene(mUndoStack, mView);
    mView->setScene(mScene);
    mView->setSceneRect(0, 0, 1000, 1000);

    mFindWidget = new SCgFindWidget(this);
    connect(mFindWidget, SIGNAL(findNext()), this, SLOT(findNext()));
    connect(mFindWidget, SIGNAL(findPrevious()), this, SLOT(findPrevious()));
    connect(mFindWidget, SIGNAL(find(QString)), this, SLOT(findTextChanged(QString)));

    mPrinterGridDialog = new SCgPrinterGridDialog(this);

    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(mView);
    layout->addWidget(mFindWidget);

    setLayout(layout);

    setAttribute(Qt::WA_DeleteOnClose);
    connect(mUndoStack, SIGNAL(cleanChanged(bool)), this, SLOT(stackCleanStateChanged(bool)));

    /////////////////////////////////////////////////

    // Create widgets, which will be added into dock area of main window.
    createWidgetsForDocks();

    createActions();

    createToolBar();
}
Esempio n. 4
0
void MainWindow::on_actionFind_triggered()
{
    if(!findDialog){
        findDialog = new FindDialog(this);
        connect(findDialog, SIGNAL(findNext(QString,Qt::CaseSensitivity)),
                spreadsheet, SLOT(findNext(QString, Qt::CaseSensitivity)));
        connect(findDialog, SIGNAL(findPrevious(QString,Qt::CaseSensitivity)),
                spreadsheet, SLOT(findPrevious(QString, Qt::CaseSensitivity)));
    }

    findDialog->show();
    findDialog->raise();
    findDialog->activateWindow();
}
Esempio n. 5
0
SearchBar::SearchBar(QWidget *parent, bool ibs)
    : QWidget(parent)
    , m_object(0)
    , m_widget(0)
    , m_timeLine(new QTimeLine(150, this))
    , mIsBrowserSearch( ibs )
{
    initializeSearchWidget();

    // we start off hidden
    setMaximumHeight(0);
    m_widget->setGeometry(0, -1 * m_widget->height(),
                          m_widget->width(), m_widget->height());
    hide();

    if ( !mIsBrowserSearch )
    {
        connect(ui.nextButton, SIGNAL(clicked()),
                this, SLOT(findNext()));
        connect(ui.previousButton, SIGNAL(clicked()),
                this, SLOT(findPrevious()));
        connect(ui.searchLineEdit, SIGNAL(returnPressed()),
                this, SLOT(findNext()));
        connect(ui.searchLineEdit, SIGNAL(textEdited(const QString &)),
                this, SLOT(findNext()));
    }
Esempio n. 6
0
SearchBar::SearchBar(QWidget *parent)
    :QWidget(parent)
{

    // Get the widget that currently has the focus so we can properly
    // restore it when the filter bar is closed.
    QWidget* widgetWindow = (parent ? parent->window() : 0);
    m_focusWidget = (widgetWindow ? widgetWindow->focusWidget() : 0);

    // Initialize the user interface...
    m_ui.setupUi(this);
    m_ui.optionsButton->addAction(m_ui.actionMatchCase);
    m_ui.optionsButton->addAction(m_ui.actionHighlightMatch);
    m_ui.optionsButton->addAction(m_ui.actionSearchAutomatically);
    m_ui.closeButton->setIcon(KIcon("dialog-close"));
    m_ui.previousButton->setIcon(KIcon("go-up-search"));
    m_ui.nextButton->setIcon(KIcon("go-down-search"));
    m_ui.previousButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    m_ui.nextButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    m_ui.searchInfo->setText(i18nc("label for input line to find text", "&Find:"));

    setFocusProxy(m_ui.searchComboBox);
    
    connect(m_ui.nextButton, SIGNAL(clicked()),
            this, SLOT(findNext()));
    connect(m_ui.previousButton, SIGNAL(clicked()),
            this, SLOT(findPrevious()));
    connect(m_ui.searchComboBox, SIGNAL(returnPressed()),
            this, SLOT(findNext()));
    connect(m_ui.searchComboBox, SIGNAL(editTextChanged(QString)),
            this, SLOT(textChanged(QString)));

    // Start off hidden by default...
    setVisible(false);
}
Esempio n. 7
0
void FindBar::setVisible(bool visible)
{
    QWidget::setVisible(visible);

    if (!m_associatedWebView)
        return;

    if (visible) {
        const QString selectedText = m_associatedWebView->page()->selectedText();
        if (!hasFocus() && !selectedText.isEmpty()) {
            const QString previousText = m_lineEdit->text();
            m_lineEdit->setText(selectedText);

            if (m_lineEdit->text() != previousText) {
                findPrevious();
            } else {
                updateHighlight();
            }
        } else if (selectedText.isEmpty()) {
            emit searchString(m_lineEdit->text());
        }

        m_lineEdit->setFocus();
        m_lineEdit->selectAll();
    } else {
        updateHighlight();

        // Clear the selection
        m_associatedWebView->page()->findText(QString());
    }
}
int Spreadsheet::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QTableWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: modified(); break;
        case 1: cut(); break;
        case 2: copy(); break;
        case 3: paste(); break;
        case 4: del(); break;
        case 5: selectCurrentRow(); break;
        case 6: selectCurrentColumn(); break;
        case 7: recalculate(); break;
        case 8: setAutoRecalculate((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 9: findNext((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< Qt::CaseSensitivity(*)>(_a[2]))); break;
        case 10: findPrevious((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< Qt::CaseSensitivity(*)>(_a[2]))); break;
        case 11: somethingChanged(); break;
        default: ;
        }
        _id -= 12;
    }
    return _id;
}
Esempio n. 9
0
/* =============================================================================
 * Plist_insert
 * -- Return TRUE on success, else FALSE
 * =============================================================================
 */
bool_t
Plist_insert (list_t* listPtr, void* dataPtr)
{
    list_node_t* prevPtr;
    list_node_t* nodePtr;
    list_node_t* currPtr;

    prevPtr = findPrevious(listPtr, dataPtr);
    currPtr = prevPtr->nextPtr;

#ifdef LIST_NO_DUPLICATES
    if ((currPtr != NULL) &&
        listPtr->compare(currPtr->dataPtr, dataPtr) == 0) {
        return FALSE;
    }
#endif

    nodePtr = PallocNode(dataPtr);
    if (nodePtr == NULL) {
        return FALSE;
    }

    nodePtr->nextPtr = currPtr;
    prevPtr->nextPtr = nodePtr;
    listPtr->size++;

    return TRUE;
}
Esempio n. 10
0
/*
 * Let's build the main widgets...
 */
void OutputDialog::init()
{
  this->resize(650, 500);

  setWindowTitle(QCoreApplication::translate("MainWindow", "System upgrade"));
  setWindowIcon(IconHelper::getIconSystemUpgrade());
  m_mainLayout = new QVBoxLayout(this);
  m_textBrowser = new QTextBrowser(this);
  m_progressBar = new QProgressBar(this);

  m_textBrowser->setGeometry(QRect(0, 0, 650, 500));

  m_mainLayout->addWidget(m_textBrowser);

  m_searchBar = new SearchBar(this);
  connect(m_searchBar, SIGNAL(textChanged(QString)), this, SLOT(onSearchBarTextChanged(QString)));
  connect(m_searchBar, SIGNAL(closed()), this, SLOT(onSearchBarClosed()));
  connect(m_searchBar, SIGNAL(findNext()), this, SLOT(onSearchBarFindNext()));
  connect(m_searchBar, SIGNAL(findPrevious()), this, SLOT(onSearchBarFindPrevious()));
  m_mainLayout->addWidget(m_progressBar);
  m_mainLayout->addWidget(m_searchBar);
  m_mainLayout->setSpacing(0);
  m_mainLayout->setSizeConstraint(QLayout::SetMinimumSize);
  m_mainLayout->setContentsMargins(2, 2, 2, 2);

  m_progressBar->setMinimum(0);
  m_progressBar->setMaximum(100);
  m_progressBar->setValue(0);
  m_progressBar->close();
  m_searchBar->show();
}
Esempio n. 11
0
void FileDisplay::menuFind() {
   if (!m_findDialog) {
      m_findDialog = new FindDialog(this, m_searchText, m_caseSensitive);

      connect(this, SIGNAL(searchTextFound(bool)),
         m_findDialog, SLOT(found(bool)));

      connect(m_findDialog, SIGNAL(findNext()), 
         this, SLOT(findNext()));
      connect(m_findDialog, SIGNAL(findPrevious()), 
         this, SLOT(findPrevious()));
      connect(m_findDialog, SIGNAL(caseSensitivityChanged(int)), 
         this, SLOT(caseSensitivityChanged(int)));
      connect(m_findDialog, SIGNAL(searchTextChanged(QString const&)), 
         this, SLOT(searchTextChanged(QString const&)));
   }
Esempio n. 12
0
FindBar::FindBar(QWidget *parent)
    : QWidget(parent)
    , m_lineEdit(new KLineEdit(this))
    , m_matchCase(new QCheckBox(i18n("&Match case"), this))
    , m_highlightAll(new QCheckBox(i18n("&Highlight all"), this))
{
    QHBoxLayout *layout = new QHBoxLayout;

    // cosmetic
    layout->setContentsMargins(2, 0, 2, 0);

    // hide button
    QToolButton *hideButton = new QToolButton(this);
    hideButton->setAutoRaise(true);
    hideButton->setIcon(KIcon("dialog-close"));
    connect(hideButton, SIGNAL(clicked()), this, SLOT(hide()));
    layout->addWidget(hideButton);
    layout->setAlignment(hideButton, Qt::AlignLeft | Qt::AlignTop);

    // label
    QLabel *label = new QLabel(i18n("Find:"));
    layout->addWidget(label);

    // Find Bar signal
    connect(this, SIGNAL(searchString(QString)), this, SLOT(find(QString)));

    // lineEdit, focusProxy
    setFocusProxy(m_lineEdit);
    m_lineEdit->setMaximumWidth(250);
    connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(find(QString)));
    layout->addWidget(m_lineEdit);

    // buttons
    KPushButton *findNext = new KPushButton(KIcon("go-down"), i18n("&Next"), this);
    KPushButton *findPrev = new KPushButton(KIcon("go-up"), i18n("&Previous"), this);
    connect(findNext, SIGNAL(clicked()), this, SLOT(findNext()));
    connect(findPrev, SIGNAL(clicked()), this, SLOT(findPrevious()));
    layout->addWidget(findNext);
    layout->addWidget(findPrev);

    // Case sensitivity. Deliberately set so this is off by default.
    m_matchCase->setCheckState(Qt::Unchecked);
    m_matchCase->setTristate(false);
    connect(m_matchCase, SIGNAL(toggled(bool)), this, SLOT(matchCaseUpdate()));
    layout->addWidget(m_matchCase);

    // Hightlight All. On by default
    m_highlightAll->setCheckState(Qt::Checked);
    m_highlightAll->setTristate(false);
    connect(m_highlightAll, SIGNAL(toggled(bool)), this, SLOT(updateHighlight()));
    layout->addWidget(m_highlightAll);

    // stretching widget on the left
    layout->addStretch();

    setLayout(layout);

    // we start off hidden
    hide();
}
Esempio n. 13
0
void HelpBrowser::setupLocalUI()
{
	setWindowIcon(loadIcon("AppIcon.png"));
	//Add Menus
	fileMenu=menuBar()->addMenu("");
	editMenu=menuBar()->addMenu("");
	bookMenu=menuBar()->addMenu("");
	histMenu=new QMenu(this);

	//Add Menu items
	filePrint=fileMenu->addAction(loadIcon("16/document-print.png"), "", this, SLOT(print()), Qt::CTRL+Qt::Key_P);
	fileMenu->addSeparator();
	fileExit=fileMenu->addAction(loadIcon("exit.png"), "", this, SLOT(close()));
	editFind=editMenu->addAction(loadIcon("find.png"), "", this, SLOT(find()), Qt::CTRL+Qt::Key_F);
	editFindNext=editMenu->addAction( "", this, SLOT(findNext()), Qt::Key_F3);
	editFindPrev=editMenu->addAction( "", this, SLOT(findPrevious()), Qt::SHIFT+Qt::Key_F3);
	bookAdd=bookMenu->addAction( "", this, SLOT(bookmarkButton_clicked()), Qt::CTRL+Qt::Key_D);
	bookDel=bookMenu->addAction( "", this, SLOT(deleteBookmarkButton_clicked()));
	bookDelAll=bookMenu->addAction( "", this, SLOT(deleteAllBookmarkButton_clicked()));

	//Add Toolbar items
	goHome=toolBar->addAction(loadIcon("16/go-home.png"), "", textBrowser, SLOT(home()));
	goBack=toolBar->addAction(loadIcon("16/go-previous.png"), "", textBrowser, SLOT(back()));
	goFwd=toolBar->addAction(loadIcon("16/go-next.png"), "", textBrowser, SLOT(forward()));
	goBack->setMenu(histMenu);
	
	helpNav->listView->header()->hide();
	helpNav->searchingView->header()->hide();
	helpNav->bookmarksView->header()->hide();

//	splitter->setStretchFactor(splitter->indexOf(tabWidget), 0);
//	splitter->setStretchFactor(splitter->indexOf(textBrowser), 1);
	// reset previous size
	prefs = PrefsManager::instance()->prefsFile->getPluginContext("helpbrowser");
	int xsize = prefs->getUInt("xsize", 640);
	int ysize = prefs->getUInt("ysize", 480);
	resize(QSize(xsize, ysize).expandedTo(minimumSizeHint()) );

	//basic ui
	connect(histMenu, SIGNAL(triggered(QAction*)), this, SLOT(histChosen(QAction*)));
	// searching
	connect(helpNav->searchingEdit, SIGNAL(returnPressed()), this, SLOT(searchingButton_clicked()));
	connect(helpNav->searchingButton, SIGNAL(clicked()), this, SLOT(searchingButton_clicked()));
	connect(helpNav->searchingView, SIGNAL(itemClicked( QTreeWidgetItem *, int)), this, SLOT(itemSearchSelected(QTreeWidgetItem *, int)));
	// bookmarks
	connect(helpNav->bookmarkButton, SIGNAL(clicked()), this, SLOT(bookmarkButton_clicked()));
	connect(helpNav->deleteBookmarkButton, SIGNAL(clicked()), this, SLOT(deleteBookmarkButton_clicked()));
	connect(helpNav->deleteAllBookmarkButton, SIGNAL(clicked()), this, SLOT(deleteAllBookmarkButton_clicked()));
	connect(helpNav->bookmarksView, SIGNAL(itemClicked( QTreeWidgetItem *, int)), this, SLOT(itemBookmarkSelected(QTreeWidgetItem *, int)));
	// links hoover
//	connect(textBrowser, SIGNAL(overLink(const QString &)), this, SLOT(showLinkContents(const QString &)));

	// status bar
	connect( textBrowser, SIGNAL(statusBarMessage(QString)), this->statusBar(), SLOT(showMessage(QString)));
	connect(textBrowser,SIGNAL(loadStarted()), this, SLOT(loadStart()));
	connect(textBrowser,SIGNAL(loadProgress(int)), this, SLOT(loadProcess(int)));
	connect(textBrowser,SIGNAL(loadFinished(bool)), this, SLOT(loadEnd(bool)));
	
	languageChange();
}
Esempio n. 14
0
SearchBar::SearchBar(QWidget *parent) : QWidget(parent)
{
    widget.setupUi(this);
    connect(widget.closeButton, SIGNAL(clicked()), this, SLOT(hide()));
    connect(widget.searchTextEdit, SIGNAL(textChanged(QString)), this, SIGNAL(searchCriteriaChanged()));
    connect(widget.findPreviousButton, SIGNAL(clicked()), this, SIGNAL(findPrevious()));
    connect(widget.findNextButton, SIGNAL(clicked()), this, SIGNAL(findNext()));

    connect(this, SIGNAL(searchCriteriaChanged()), this, SLOT(clearBackgroundColor()));

    QMenu *optionsMenu = new QMenu(widget.optionsButton);
    widget.optionsButton->setMenu(optionsMenu);

    m_matchCaseMenuEntry = optionsMenu->addAction(tr("Match case"));
    m_matchCaseMenuEntry->setCheckable(true);
    m_matchCaseMenuEntry->setChecked(true);
    connect(m_matchCaseMenuEntry, SIGNAL(toggled(bool)), this, SIGNAL(searchCriteriaChanged()));


    m_useRegularExpressionMenuEntry = optionsMenu->addAction(tr("Regular expression"));
    m_useRegularExpressionMenuEntry->setCheckable(true);
    connect(m_useRegularExpressionMenuEntry, SIGNAL(toggled(bool)), this, SIGNAL(searchCriteriaChanged()));

    m_highlightMatchesMenuEntry = optionsMenu->addAction(tr("Higlight all matches"));
    m_highlightMatchesMenuEntry->setCheckable(true);
    m_highlightMatchesMenuEntry->setChecked(true);
    connect(m_highlightMatchesMenuEntry, SIGNAL(toggled(bool)), this, SIGNAL(highlightMatchesChanged(bool)));
}
Esempio n. 15
0
void FindDialog::findClicked()
{
	QString text = lineEdit->text();
	Qt::CaseSensitivity cs = caseCheckBox->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive;

	if (backwardCheckBox->isChecked())
	{
		emit findPrevious(text, cs);
	}
	else
	{
		emit findNext(text, cs);
	}

	int r = QMessageBox::warning(this, tr("result"), tr("ok or cancel?"), QMessageBox::Yes | QMessageBox::Default, QMessageBox::No);
	
	if (r == QMessageBox::No)
	{
		QMessageBox::about(this, tr("about"), tr("<p>I'll be closed and I'll save current settings</p>"));
		
		QSettings settings("find dialog settings");
		if (cs == Qt::CaseSensitive)
			settings.setValue("case selected", QString("CaseSensitive"));
		else
			settings.setValue("case selected", QString("CaseInsensitive"));

		close();	
	}
	
	return;
}
Esempio n. 16
0
// TODO: for docked widgets signal widgets if embedded or floating, if horizontal/vertical
SearchController::SearchController( KXMLGUIClient* guiClient, QWidget* parentWidget )
  : mParentWidget( parentWidget ),
    mSearchDialog( 0 )
{
    KActionCollection* actionCollection = guiClient->actionCollection();

    mFindAction     = KStandardAction::find(     this, SLOT(find()),         actionCollection );
    mFindNextAction = KStandardAction::findNext( this, SLOT(findNext()),     actionCollection );
    mFindPrevAction = KStandardAction::findPrev( this, SLOT(findPrevious()), actionCollection );

    mTool = new SearchTool();
    mTool->setUserQueryAgent( this );

    connect( mTool, &SearchTool::isApplyableChanged,
             mFindAction, &QAction::setEnabled );
    connect( mTool, &SearchTool::isApplyableChanged,
             mFindNextAction, &QAction::setEnabled );
    connect( mTool, &SearchTool::isApplyableChanged,
             mFindPrevAction, &QAction::setEnabled );

    connect( mTool, &SearchTool::dataNotFound, this, &SearchController::onDataNotFound );

    mFindAction->setEnabled( false );
    mFindNextAction->setEnabled( false );
    mFindPrevAction->setEnabled( false );
}
Esempio n. 17
0
FindReplaceDialog::FindReplaceDialog(QWidget *parent)
	: QDialog(parent)
{
	ui.setupUi(this);

	connect(ui.findNext, SIGNAL(clicked()), this, SIGNAL(findNext()));
	connect(ui.findPrevious, SIGNAL(clicked()), this, SIGNAL(findPrevious()));
}
Esempio n. 18
0
/*
 * Obligatory initialization code.
 */
void SearchBar::init()
{
    setVisible(false);
    setObjectName("searchbar");
    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->setSpacing(0);
    layout->setMargin(4);

    setStyleSheet("QWidget#searchbar{"
                  "border-top-width: .6px;"
                  "border-top-style: solid;"
                  "border-top-color: darkgray;}");

    m_searchLineEdit = new SearchLineEdit(this);
    m_searchLineEdit->setMinimumWidth(300);
    QToolButton *m_previousButton = new QToolButton(this);
    QToolButton *m_nextButton = new QToolButton(this);
    m_previousButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
    m_nextButton->setToolButtonStyle(Qt::ToolButtonTextOnly);

    QAction *m_previousAction = new QAction(this);
    QAction *m_nextAction = new QAction(this);

    m_previousAction->setText("< " + tr("Previous"));
    m_previousButton->setAutoRaise(true);
    m_previousAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F3));
    m_nextAction->setText(tr("Next") + " >");
    m_nextButton->setAutoRaise(true);
    m_nextAction->setShortcut(Qt::Key_F3);
    m_previousButton->setDefaultAction(m_previousAction);
    m_nextButton->setDefaultAction(m_nextAction);

    QToolButton *tbClose = new QToolButton();
    tbClose->setIcon(IconHelper::getIconClose());

    tbClose->setAutoRaise(true);
    tbClose->setStyleSheet("QToolButton{ font-size: 16px; font-family: verdana; border-radius: 4px; } "
                           "QToolButton:hover{ background-color: palette(light); }"
                           "QToolButton::pressed{ background-color: palette(mid); }");

    tbClose->setToolTip(tr("Close"));
    tbClose->setShortcut(Qt::Key_Escape);

    layout->addWidget(tbClose, 1, Qt::AlignLeft);
    layout->addSpacing(3);
    layout->addWidget(m_searchLineEdit, 0, Qt::AlignLeft);
    layout->addSpacing(2);
    layout->addWidget(m_previousButton, 1, Qt::AlignLeft);
    layout->addWidget(m_nextButton, 20, Qt::AlignLeft);

    setLayout(layout);
    m_searchLineEdit->setFocus();

    connect(tbClose, SIGNAL(clicked()), this, SLOT(close()));
    connect(m_searchLineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(textChanged(QString)));
    connect(m_previousAction, SIGNAL(triggered()), this, SIGNAL(findPrevious()));
    connect(m_nextAction, SIGNAL(triggered()), this, SIGNAL(findNext()));
}
Esempio n. 19
0
Dialogs::Dialogs(QWidget *parent) : QWidget(parent)
{
   login=new Login(this);
   emTest=new EmotionTest(this);
   data = new Database(this);
   QLabel a("Thanks for participating", this);
   QHBoxLayout lay;
   lay.addWidget(&a);
   setLayout(&lay);
   
   if(data->makeConnection()) {

     // initializing the quote to be displayed in the typing test
     connect(this, SIGNAL(getQuote(int)), data, SLOT(getQuote(int)));
     connect(data, SIGNAL(setQuote(const QString&)), this,
	     SLOT(setQuote(const QString&)));

     srand(time(NULL));
     emit getQuote(rand() % 42);
    

      // checks the username and password combination
      connect(login, SIGNAL(info(const QString&, const QString&)),
	      data, SLOT(login(const QString&, const QString&)));
      // if the username and password are valid then closes dialog
      connect(data, SIGNAL(acceptLogin(bool)), login, 
	      SLOT(acceptedInfo(bool)));

      // moves onto the EmotionTest
      connect(login, SIGNAL(accepted()), emTest, SLOT(exec()));
      // giving the emotionTest results to the database
      connect(emTest, SIGNAL(results(const QList<EmotionRank*>&)),
	      data, SLOT(Emotions(const QList<EmotionRank*>&)));
      // if test results are put into the database then closes dialog
      connect(data, SIGNAL(acceptEmotions(bool)), emTest,
	      SLOT(acceptedInfo(bool)));
   
      // moves onto the TypingTest
      connect(emTest, SIGNAL(accepted()), tyTest, SLOT(exec()));

      //getting previous TypingTest results
      connect(tyTest, SIGNAL(findPrevious()), data, SLOT(previousTyping()));
      connect(data, SIGNAL(previousTypingResults(const QList<KeyFeatures>&)),
	      tyTest, SLOT(inputKeyFeatures(const QList<KeyFeatures>&)));
      
      
      //giving the TypingTest results to the database
      connect(tyTest, SIGNAL(results(const KeyFeatures&)), data,
	      SLOT(Typing(const KeyFeatures&)));
      // if test results are put into the database then closes dialog
      connect(data, SIGNAL(acceptTyping(bool)), tyTest,
	      SLOT(acceptedInfo(bool)));
      // closes everything
      connect(tyTest, SIGNAL(accepted()), data, SLOT(makeTest()));

      login->exec();

     }
Esempio n. 20
0
void UIClass::findClicked() {
    auto text = lineEdit->text();
    auto cs = caseCheckBox->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive;
    if (backwardCheckBox->isChecked()) {
        emit findPrevious(text, cs);
    } else {
        emit findNext(text, cs);
    }
}
Esempio n. 21
0
QT_BEGIN_NAMESPACE

FindWidget::FindWidget(QWidget *parent)
    : QWidget(parent)
    , appPalette(qApp->palette())
{
    installEventFilter(this);
    QHBoxLayout *hboxLayout = new QHBoxLayout(this);

#ifndef Q_OS_MAC
    hboxLayout->setMargin(0);
    hboxLayout->setSpacing(6);
#endif

    toolClose = setupToolButton(QLatin1String(""),
        QLatin1String(":closetab.png"));
    hboxLayout->addWidget(toolClose);
    connect(toolClose, SIGNAL(clicked()), SLOT(hide()));

    editFind = new QLineEdit(this);
    hboxLayout->addWidget(editFind);
    editFind->setMinimumSize(QSize(150, 0));
    connect(editFind, SIGNAL(textChanged(QString)), this,
        SLOT(textChanged(QString)));
    connect(editFind, SIGNAL(returnPressed()), this, SIGNAL(findNext()));
    connect(editFind, SIGNAL(textChanged(QString)), this, SLOT(updateButtons()));

    toolPrevious = setupToolButton(tr(""), QLatin1String(":previous.png"));
    connect(toolPrevious, SIGNAL(clicked()), this, SIGNAL(findPrevious()));

    hboxLayout->addWidget(toolPrevious);

    toolNext = setupToolButton(tr(""), QLatin1String(":next.png"));
    hboxLayout->addWidget(toolNext);
    connect(toolNext, SIGNAL(clicked()), this, SIGNAL(findNext()));

    checkCase = new QCheckBox(tr("Case Sensitive"), this);
    hboxLayout->addWidget(checkCase);

    labelWrapped = new QLabel(this);
    labelWrapped->setScaledContents(true);
    labelWrapped->setTextFormat(Qt::RichText);
    labelWrapped->setMinimumSize(QSize(0, 20));
    labelWrapped->setMaximumSize(QSize(105, 20));
    labelWrapped->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
    labelWrapped->setText("<i>" +  tr("Search wrapped"));
    hboxLayout->addWidget(labelWrapped);

    QSpacerItem *spacerItem = new QSpacerItem(20, 20, QSizePolicy::Expanding,
        QSizePolicy::Minimum);
    hboxLayout->addItem(spacerItem);
    setMinimumWidth(minimumSizeHint().width());
    labelWrapped->hide();

    updateButtons();
}
Esempio n. 22
0
void FindDialog::findClicked() {
  QString text = lineEdit->text();
  Qt::CaseSensitivity cs = caseCheckBox->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive;

  if (backwardCheckBox->isChecked()) {
    emit findPrevious(text, cs);
  } else {
    emit findNext(text, cs);
  }
}
Esempio n. 23
0
BtFindWidget::BtFindWidget(QWidget* parent)
    : QWidget(parent) {
    createLayout();
    createToolButton(CResMgr::findWidget::icon_close(), "", SLOT(hide()));
    createTextEditor();
    createToolButton(CResMgr::findWidget::icon_previous(), tr("Previous"), SLOT(findPrevious()));
    createToolButton(CResMgr::findWidget::icon_next(), tr("Next"), SLOT(findNext()));
    createCaseCheckBox();
    createSpacer();
    setFocusProxy(m_textEditor);
}
Esempio n. 24
0
        void List<Object>::remove( const Object & x )
        {
            ListItr<Object> p = findPrevious( x );

            if( p.current->next != NULL )
            {
                ListNode<Object> *oldNode = p.current->next;
                p.current->next = p.current->next->next;  // Bypass deleted node
                delete oldNode;
            }
        }
Esempio n. 25
0
SCsFindWidget::SCsFindWidget(QWidget *parent/* =0 */):
    QWidget(parent)
{
	//installEventFilter(this);

    QFont font("Arial", 11);
    font.setStyleHint(QFont::Serif);
    this->setFont(font);
	setMaximumHeight(35);


	mSearchEdit = new QLineEdit(this);
	mSearchEdit->setMinimumWidth(80);
	
	connect(mSearchEdit, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
	connect(mSearchEdit, SIGNAL(returnPressed()), this, SIGNAL(findNext()));
	connect(mSearchEdit, SIGNAL(textChanged(QString)), this, SLOT(updateButtons()));


    mFindPreviousButton = setupToolButton(tr("Previous"), ":scs/media/icons/find-previous.png");
    connect(mFindPreviousButton, SIGNAL(clicked()), this, SIGNAL(findPrevious()));
    mFindNextButton = setupToolButton(tr("Next"), ":scs/media/icons/find-next.png");
    connect(mFindNextButton, SIGNAL(clicked()), this, SIGNAL(findNext()));

    mCaseSensitiveCheck = new QCheckBox(tr("Case sensitive"),this);
    mFindWholeWordCheck = new QCheckBox(tr("Whole word"),this);


	connect(mCaseSensitiveCheck, SIGNAL(stateChanged(int)), this, SLOT(caseSensitivityChanged(int)));
	connect(mFindWholeWordCheck, SIGNAL(stateChanged(int)), this, SLOT(wholeWordChanged(int)));

    mCloseButton = setupToolButton("", ":scs/media/icons/find-close.png");
    connect(mCloseButton, SIGNAL(clicked()), this, SLOT(hide()));
    mCloseButton->setFixedHeight(28);
    mCloseButton->setFixedWidth(28);

    QHBoxLayout *layout = new QHBoxLayout();
	layout->setContentsMargins(0,0,0,0);
    layout->addWidget(mCloseButton);
    layout->addWidget(mSearchEdit);
    layout->addWidget(mFindPreviousButton);
    layout->addWidget(mFindNextButton);
    layout->addWidget(mCaseSensitiveCheck);
    layout->addWidget(mFindWholeWordCheck);

    layout->setContentsMargins(QMargins(0,5,20,0));

	layout->addStretch();

    setLayout(layout);

	hide();
}
Esempio n. 26
0
void SwapWithNext(Position beforeP, List l)
{
	Position tempPre;
	/// 首先保证指针不是最后一个
	if (!isLast(beforeP, l))
	{
		tempPre = findPrevious(beforeP->Element, l);	///< 先找到beforeP的前一个元素
		tempPre->Next = beforeP->Next;
		beforeP->Next = beforeP->Next->Next;
		tempPre->Next->Next = beforeP;
	}
}
Esempio n. 27
0
        void CursorList<Object>::remove( const Object & x )
        {
            CursorListItr<Object> p = findPrevious( x );
            int pos = p.current;

            if( cursorSpace[ pos ].next != 0 )
            {
                int tmp = cursorSpace[ pos ].next;
                cursorSpace[ pos ].next = cursorSpace[ tmp ].next;
                free ( tmp );
            }
        }
Esempio n. 28
0
void FindBar::keyPressEvent(QKeyEvent *event)
{
    if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
        if (event->modifiers() == Qt::ShiftModifier) {
            findPrevious();
        } else {
            findNext();
        }
    }

    QWidget::keyPressEvent(event);
}
Esempio n. 29
0
SCgFindWidget::SCgFindWidget(QWidget *parent):
        QWidget(parent),
        mAppPalette(qApp->palette())
{
    installEventFilter(this);
    setFixedHeight(22);

    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->setContentsMargins(0,0,0,0);

    mCloseButton = setupToolButton("", "find-close.png");

    connect(mCloseButton, SIGNAL(clicked()), this, SLOT(hide()));
    layout->addWidget(mCloseButton);

    mFindLabel = new QLabel(tr("Find:"), this);
    layout->addWidget(mFindLabel);

    mFindLine = new QLineEdit(this);
    mFindLine->setFixedWidth(200);
    connect(mFindLine, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
    connect(mFindLine, SIGNAL(returnPressed()), this, SIGNAL(findNext()));
    connect(mFindLine, SIGNAL(textChanged(QString)), this, SLOT(updateButtons()));
    layout->addWidget(mFindLine);

    mFindPreviousButton = setupToolButton(tr("Previous"), "find-previous.png");
    connect(mFindPreviousButton, SIGNAL(clicked()), this, SIGNAL(findPrevious()));
    layout->addWidget(mFindPreviousButton);

    mFindNextButton = setupToolButton(tr("Next"), "find-next.png");
    layout->addWidget(mFindNextButton);
    connect(mFindNextButton, SIGNAL(clicked()), this, SIGNAL(findNext()));

    mCaseSensitivityChaeck = new QCheckBox(tr("Case Sensitive"), this);
    connect(mCaseSensitivityChaeck, SIGNAL(stateChanged(int)), this, SLOT(caseSensitivityChanged(int)));
    layout->addWidget(mCaseSensitivityChaeck);

    mWrappedLabel = new QLabel(this);
    mWrappedLabel->setScaledContents(true);
    mWrappedLabel->setTextFormat(Qt::RichText);
    mWrappedLabel->setMinimumSize(QSize(0, 20));
    mWrappedLabel->setMaximumSize(QSize(110, 20));
    mWrappedLabel->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
    mWrappedLabel->setText(tr("Search wrapped"));
    mWrappedLabel->hide();
    layout->addWidget(mWrappedLabel);

    layout->addStretch();

    hide();

    updateButtons();
}
Esempio n. 30
0
void TypingTest::calculate(const QVector<int> &key,
			   const QVector<int> &press,
			   const QVector<int> &release) {
  emit findPrevious();
  int latest = 0;   
  analysis.addKeyFeature(key, press, release);
  if(analysis.isTired(latest)) {
    std::cerr << "you are apparently tired" << std::endl;
  } else {
    std::cerr << "apparently you are not tired" << std::endl;
  }
  emit results(analysis.results(latest));
}