void SearchWidgetPrivate::search( const QString &searchTerm, SearchMode searchMode ) { if( searchTerm.isEmpty() ) { clearSearch(); } else { if ( searchMode == AreaSearch ) { m_runnerManager->findPlacemarks( searchTerm, m_widget->viewport()->viewLatLonAltBox() ); } else { m_runnerManager->findPlacemarks( searchTerm ); } } }
bool QSpotifySearch::event(QEvent *e) { if (e->type() == QEvent::User) { auto ev = static_cast<SearchResultEvent*>(e); if (ev) { if (auto search = ev->getSearch()) { g_mutex.lock(); bool is_current = (m_sp_search == search); g_mutex.unlock(); if (sp_search_error(search) == SP_ERROR_OK && is_current) { if(ev->getPtr()) { switch(ev->getPtr()->mType) { case Albums: populateAlbums(search); break; case Artists: populateArtists(search); break; case Playlists: populatePlaylists(search); break; case Tracks: populateTracks(search); break; default: populateResults(search); break; } } else populateResults(search); } clearSearch(search); } } setBusy(false); emit resultsChanged(); e->accept(); return true; } return QObject::event(e); }
//Function for printing the main screen (everything on the main screne) void lifeTracker() { setup(); for(i = 0; i < 20; i++){ xt_par2(XT_SET_ROW_COL_POS, row = i+7, col = 1); printf("|"); xt_par2(XT_SET_ROW_COL_POS, row = i+7, col = 16); printf("|"); xt_par2(XT_SET_ROW_COL_POS, row = i+7, col = 19); printf("|"); xt_par2(XT_SET_ROW_COL_POS, row = i+7, col = 91); printf("|"); xt_par2(XT_SET_ROW_COL_POS, row = i+7, col = 94); printf("|"); xt_par2(XT_SET_ROW_COL_POS, row = i+7, col = 120); printf("|"); } xt_par2(XT_SET_ROW_COL_POS, row = 7, col = 2); fillCategory(); xt_par0(XT_CH_GREEN); printf("--Categories--"); xt_par0(XT_CH_WHITE); if(sort == 0) bubbleSortTime(); else if (sort == 1) bubbleSort(); xt_par2(XT_SET_ROW_COL_POS, row = 26, col = 2); xt_par0(XT_CH_BLUE); printf("---F6-Sort----"); updateRecords(0); xt_par2(XT_SET_ROW_COL_POS, row = 26, col = 20); xt_par0(XT_CH_BLUE); printf("-----------------------F2-Add F3-Delete F4-Edit------------------------"); xt_par0(XT_CH_GREEN); xt_par2(XT_SET_ROW_COL_POS, row = 7, col = 95); printf("---------Search----------"); clearSearch(); //also delete the code in between these lines xt_par0(XT_CH_BLUE); xt_par2(XT_SET_ROW_COL_POS, row = 26, col = 95); printf("--------F7-Search--------"); xt_par2(XT_SET_ROW_COL_POS, row = 28, col = 1); xt_par0(XT_CH_BLUE); printf("---------------------------------------------------------F9-EXIT--------------------------------------------------------"); xt_par0(XT_CH_WHITE); xt_par2(XT_SET_ROW_COL_POS,row=CATEGORY,col=2); }
void LogDialog::handleAllLogsButton() { _logger->setExtraDebugging(false); _extraDebuggingBox->setCheckState(Qt::Unchecked); _logger->setDebugPrint(true); _debugPrintBox->setCheckState(Qt::Checked); _logger->setInfoPrint(true); _infoPrintBox->setCheckState(Qt::Checked); _logger->setCriticalPrint(true); _criticalPrintBox->setCheckState(Qt::Checked); _logger->setWarningPrint(true); _warningPrintBox->setCheckState(Qt::Checked); _logger->setSuppressPrint(true); _suppressPrintBox->setCheckState(Qt::Checked); _logger->setFatalPrint(true); _fatalPrintBox->setCheckState(Qt::Checked); _logger->setUnknownPrint(true); _unknownPrintBox->setCheckState(Qt::Checked); clearSearch(); _filterDropdown->setCurrentIndex(0); printLogFile(); }
// The SearchLineEdit class is adapted from code presented by Girish // Ramakrishnan in a Qt Labs post: // // http://labs.qt.nokia.com/2007/06/06/lineedit-with-a-clear-button SearchLineEdit::SearchLineEdit(QWidget *parent): QLineEdit(parent) { previousResultButton = new QToolButton(this); previousResultButton->setIcon(style()->standardIcon(QStyle::SP_ArrowLeft)); previousResultButton->setCursor(Qt::ArrowCursor); previousResultButton->setStyleSheet(QString::fromUtf8("QToolButton { border: none; padding: 0px; }")); connect(previousResultButton, SIGNAL(clicked()), this, SLOT(handlePreviousResult())); nextResultButton = new QToolButton(this); nextResultButton->setIcon(style()->standardIcon(QStyle::SP_ArrowRight)); nextResultButton->setCursor(Qt::ArrowCursor); nextResultButton->setStyleSheet(QString::fromUtf8("QToolButton { border: none; padding: 0px; }")); connect(nextResultButton, SIGNAL(clicked()), this, SLOT(handleNextResult())); clearButton = new QToolButton(this); clearButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton)); clearButton->setCursor(Qt::ArrowCursor); clearButton->setStyleSheet(QString::fromUtf8("QToolButton { border: none; padding: 0px; }")); connect(clearButton, SIGNAL(clicked()), this, SLOT(clearSearch())); int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth); setStyleSheet(QString::fromUtf8("QLineEdit { padding-right: %1px; } ").arg( nextResultButton->sizeHint().width() + previousResultButton->sizeHint().width() + clearButton->sizeHint().width() + frameWidth + 1)); QSize msz = minimumSizeHint(); setMinimumSize(qMax(msz.width(), nextResultButton->sizeHint().width() + previousResultButton->sizeHint().width() + clearButton->sizeHint().width() + frameWidth * 2 + 2), qMax(msz.height(), clearButton->sizeHint().height() + frameWidth * 2 + 2)); connect(this, SIGNAL(returnPressed()), this, SLOT(prepareSearch())); setPlaceholderText(QString::fromUtf8("Search")); }
TitlebarWidget::TitlebarWidget(QWidget *parent) : QFrame(parent), d_ptr(new TitlebarWidgetPrivate(this)) { Q_D(TitlebarWidget); setFocusPolicy(Qt::NoFocus); setObjectName("TitlebarWidget"); DThemeManager::instance()->registerWidget(this, QStringList({"viewname"})); auto layout = new QHBoxLayout(this); layout->setContentsMargins(5, 5, 10, 5); auto leftWidget = new QFrame; leftWidget->setObjectName("TitleLeft"); leftWidget->setFixedWidth(148); auto leftLayout = new QHBoxLayout(leftWidget); leftLayout->setSpacing(10); leftLayout->setMargin(0); auto iconLabel = new QLabel; iconLabel->setObjectName("TitleIcon"); iconLabel->setFixedSize(24, 24); d->btBack = new QPushButton; d->btBack->setObjectName("TitleBack"); d->btBack->setFixedSize(24, 24); d->btBack->hide(); leftLayout->addWidget(iconLabel, 0, Qt::AlignCenter); leftLayout->addWidget(d->btBack, 0, Qt::AlignCenter); leftLayout->addStretch(); d->search = new SearchEdit(this); d->search->setObjectName("TitleSearch"); d->search->setFixedSize(278, 26); d->search->setPlaceHolder(tr("Search")); d->search->clear(); auto rightWidget = new QFrame; rightWidget->setObjectName("TitleLeft"); rightWidget->setFixedWidth(1); layout->addWidget(leftWidget, 0, Qt::AlignCenter); layout->addStretch(); layout->addWidget(d->search, 0, Qt::AlignCenter); layout->addStretch(); layout->addWidget(rightWidget, 0, Qt::AlignCenter); connect(d->search, &SearchEdit::locateMusic, this, &TitlebarWidget::locateMusicInAllMusiclist); connect(d->search, &SearchEdit::searchText, this, &TitlebarWidget::search); connect(d->btBack, &QPushButton::clicked, this, &TitlebarWidget::searchExited); connect(this, &TitlebarWidget::search, this, [ = ]() { d->btBack->show(); // d->fixSearchPosition(); }); connect(this, &TitlebarWidget::searchExited, this, [ = ]() { d->btBack->hide(); clearSearch(); // d->fixSearchPosition(); }); }
void TitlebarWidget::exitSearch() { Q_D(TitlebarWidget); d->btBack->hide(); clearSearch(); }
CustomerSearch::CustomerSearch(QWidget *parent, const char *name, Qt::WFlags f) : TAAWidget(parent, f) { // A simple (in appearance) widget that will allow the user to // search for, and select, a customer. // // The layout will look like so: // // Query: [ Search Box ] [Search] [Clear] // +---------+----------+-----------------------+ // + Cust ID | Login ID | Account Name | // + | | | // +---------+----------+-----------------------+ // // When the user types something in the search box and presses enter // or clicks the search button, the widget will do a search on the // customer database against the search text and fill in the list. // When the user clicks or scrolls onto an entry, itemHighlighted() // will be emitted with the customer ID. When the user double clicks // or presses enter on an entry itemSelected() will be emitted with // the customer ID. searchText = new QLineEdit(this, "SearchText"); searchText->setMaxLength(80); connect(searchText, SIGNAL(returnPressed()), this, SLOT(startSearch())); QLabel *queryLabel = new QLabel(this, "Query Label"); queryLabel->setText("&Query:"); queryLabel->setAlignment(Qt::AlignRight|Qt::AlignVCenter); queryLabel->setBuddy(searchText); searchButton = new QPushButton(this, "SearchButton"); searchButton->setText("Search"); connect(searchButton, SIGNAL(clicked()), this, SLOT(startSearch())); QPushButton *clearButton = new QPushButton(this, "Clear Button"); clearButton->setText("C&lear"); connect(clearButton, SIGNAL(clicked()), this, SLOT(clearSearch())); custList = new Q3ListView(this, "SearchResults"); custList->setMargin(2); custList->setAllColumnsShowFocus(true); custList->setRootIsDecorated(true); custList->addColumn("Account Name"); custList->addColumn("LoginID"); custList->addColumn("Cust ID"); connect(custList, SIGNAL(currentChanged(Q3ListViewItem *)), this, SLOT(itemHighlighted(Q3ListViewItem *))); connect(custList, SIGNAL(doubleClicked(Q3ListViewItem *)), this, SLOT(itemSelected(Q3ListViewItem *))); connect(custList, SIGNAL(returnPressed(Q3ListViewItem *)), this, SLOT(itemSelected(Q3ListViewItem *))); Q3BoxLayout *ml = new Q3BoxLayout(this, Q3BoxLayout::TopToBottom, 0, 0); Q3BoxLayout *sl = new Q3BoxLayout(Q3BoxLayout::LeftToRight, 0); sl->addSpacing(3); sl->addWidget(queryLabel, 0); sl->addSpacing(3); sl->addWidget(searchText, 1); sl->addSpacing(3); sl->addWidget(searchButton, 0); sl->addWidget(clearButton, 0); ml->addLayout(sl, 0); ml->addSpacing(3); ml->addWidget(custList, 1); }
void MainWindow::createActions() { qaHome = new QAction( IconLoader::Load( "go-home" ), tr( "Home" ), this ); qaHome->setShortcut( Qt::ControlModifier + Qt::Key_H ); qaHome->setStatusTip( tr( "Click to go home" )); qaExit = new QAction( IconLoader::Load( "system-shutdown" ), tr( "&Exit" ), this); qaExit->setShortcut( QKeySequence::Quit ); qaExit->setStatusTip( tr( "Exit the application" )); connect( qaExit, SIGNAL( triggered()), qApp, SLOT( quit())); qaBack = new QAction( IconLoader::Load( "go-previous" ), tr( "Back" ), this); qaBack->setShortcut( Qt::ControlModifier + Qt::Key_Left ); qaBack->setStatusTip( tr( "Click to go back" )); qaForward = new QAction( IconLoader::Load( "go-next" ), tr( "Forward" ), this ); qaForward->setShortcut( Qt::ControlModifier + Qt::Key_Right ); qaForward->setStatusTip( tr( "Click to go forward" )); qaStop = new QAction( IconLoader::Load( "process-stop" ), tr( "Stop" ), this); qaStop->setShortcut( Qt::Key_Escape ); qaStop->setStatusTip( tr( "Click to go stop" )); qaReload = new QAction( IconLoader::Load( "view-refresh" ), tr( "Reload" ), this ); qaReload->setShortcut( QKeySequence::Refresh ); qaReload->setStatusTip( tr( "Click to go reload" )); qaAbout = new QAction( IconLoader::Load( "help-about" ), tr( "&About" ), this ); qaAbout->setStatusTip( tr( "About the application" )); connect( qaAbout, SIGNAL( triggered()), this, SLOT( about())); qaAboutQt = new QAction( tr( "About &Qt" ), this); qaAboutQt->setStatusTip( tr( "About the Qt version" )); connect( qaAboutQt, SIGNAL( triggered()), qApp, SLOT( aboutQt())); qagNavigation = new QActionGroup ( this ); qagNavigation->addAction ( qaHome ); qagNavigation->addAction ( qaBack ); qagNavigation->addAction ( qaReload ); qagNavigation->addAction ( qaForward ); qagNavigation->addAction ( qaStop ); connect ( qagNavigation, SIGNAL( triggered( QAction* )), this, SLOT( navigationActionTriggered( QAction* ))); qaSearch = new QAction ( IconLoader::Load ( "edit-find" ), tr ( "Search" ), this ); qaSearch->setShortcut ( QKeySequence::Find ); qaSearch->setStatusTip ( tr( "Search words" )); connect( qaSearch, SIGNAL( triggered()), this, SLOT( search())); qaClearSearch = new QAction ( IconLoader::Load ( "edit-find" ), "", this ); qaClearSearch->setStatusTip( tr ( "Clear search words" )); connect( qaClearSearch, SIGNAL( triggered()), this, SLOT( clearSearch ())); qaPrintDialog = new QAction( IconLoader::Load ( "document-print-preview" ), tr ( "Print" ), this ); qaPrintDialog->setShortcut( QKeySequence::Print ); qaPrintDialog->setStatusTip( tr ( "Print Preview" )); connect( qaPrintDialog, SIGNAL( triggered ()), this, SLOT( printpreview ())); qaZoomIn = new QAction( IconLoader::Load ( "zoom-in" ), tr ( "Zoom &In" ), this ); qaZoomIn->setShortcut( QKeySequence::ZoomIn ); qaZoomIn->setStatusTip( tr ( "Zoom in of the page" )); qaZoomOut = new QAction( IconLoader::Load( "zoom-out" ), tr ( "Zoom &Out" ), this ); qaZoomOut->setShortcut( QKeySequence::ZoomOut ); qaZoomOut->setStatusTip( tr( "Zoom out of the page" )); qaZoomNormal = new QAction( IconLoader::Load( "zoom-original" ), tr ( "Zoom &Normal" ), this ); qaZoomNormal->setShortcut( QKeySequence( "CTRL+0" )); qaZoomNormal->setStatusTip( tr ( "Zoom normal of the page" )); qagZoom = new QActionGroup( this ); qagZoom->addAction ( qaZoomIn ); qagZoom->addAction ( qaZoomNormal ); qagZoom->addAction ( qaZoomOut ); connect ( qagZoom, SIGNAL( triggered( QAction* )), this, SLOT( zoomActionTriggered( QAction* ))); qaEnglish = new QAction( QIcon( ":/flags/en.svg" ), tr( "English" ), this ); qaEnglish->setCheckable( true ); qaSpanish = new QAction( QIcon( ":/flags/es.svg" ), tr( "Spanish" ), this ); qaSpanish->setCheckable( true ); qaFrench = new QAction( QIcon( ":/flags/fr.svg" ), tr( "French" ), this ); qaFrench->setCheckable( true ); qaItalian = new QAction( QIcon( ":/flags/it.svg" ), tr( "Italian" ), this ); qaItalian->setCheckable( true ); qaChinese = new QAction( QIcon( ":/flags/cn.svg" ), tr( "Chinese" ), this ); qaChinese->setCheckable( true ); qaRussian = new QAction( QIcon( ":/flags/ru.svg" ), tr( "Russian" ), this ); qaRussian->setCheckable( true ); qagLanguages = new QActionGroup( this ); qagLanguages->addAction ( qaEnglish ); qagLanguages->addAction ( qaSpanish ); qagLanguages->addAction ( qaFrench ); qagLanguages->addAction ( qaItalian ); qagLanguages->addAction ( qaChinese ); qagLanguages->addAction ( qaRussian ); connect( qagLanguages, SIGNAL( triggered( QAction* )), this, SLOT( languageActionTriggered( QAction* ))); }
//Huge main function. int main(int argc, char *argv[]) { if (argc < 3){ //if you don't type enough arguments printf("Sockets client, usage:\n"); printf("sockets_client {IP-address} {port} \n"); return 0; } else { free(server); server = malloc((strlen(argv[1] + 1) * sizeof(char))); strcpy(server, argv[1]); portno = atoi(argv[2]); } int c; while(1){ if(screen == 0){ CATEGORY = 8; currentRecord = 0; recordView = 0; xt_par0(XT_CLEAR_SCREEN); lifeTracker(); xt_par2(XT_SET_ROW_COL_POS,row = 8, col = 2); } while(screen == 0) { while((c = getkey()) == KEY_NOTHING); if(c == KEY_F9) screen = 3; else if(c == KEY_F3 && maxRecord > 0 && col == 20) screen = 4; else if(c == KEY_DOWN) { if(col == 2 && row >= 8 && row < catCounter + 7){ xt_par2(XT_SET_ROW_COL_POS,CATEGORY = ++row,col); updateRecords(recordView); } if(col == 20 && row >= 7 && row <= tempCounter * 5 + 1){ if(row < 22){ xt_par2(XT_SET_ROW_COL_POS,row+=5,col); ++currentRecord; } else if(recordView < tempCounter-4){ ++recordView; if(search == 1) searchResults(recordView); else updateRecords(recordView); xt_par2(XT_SET_ROW_COL_POS,row=22,col); ++currentRecord; } } if(col > 94 && col < 120){ if(row == 9) xt_par2(XT_SET_ROW_COL_POS,row = 12,col = 95); else if(row == 12) xt_par2(XT_SET_ROW_COL_POS,row = 13,col = 95); else if(row == 13) xt_par2(XT_SET_ROW_COL_POS,row = 16,col); else if(row < 20) xt_par2(XT_SET_ROW_COL_POS,++row,col); else if(row == 20 && col < 110) xt_par2(XT_SET_ROW_COL_POS,++row,col); else if(row == 20 && col > 110) xt_par2(XT_SET_ROW_COL_POS,++row,col = 109); } } else if(c == KEY_UP){ if(col == 2 && row > 8 && row <= 18){ xt_par2(XT_SET_ROW_COL_POS,CATEGORY = --row,col); updateRecords(recordView); } if(col == 20 && row >= 7 && row < 24){ if(row <= 24 && row > 7){ xt_par2(XT_SET_ROW_COL_POS,row-=5,col); --currentRecord; } else if(recordView > 0){ --recordView; if(search == 1) searchResults(recordView); else updateRecords(recordView); xt_par2(XT_SET_ROW_COL_POS,row=7,col); --currentRecord; } } if(row > 9 && col > 94 && col < 120){ if(row == 12) xt_par2(XT_SET_ROW_COL_POS,row = 9,col = 95); else if(row == 13) xt_par2(XT_SET_ROW_COL_POS,row = 12,col = 95); else if(row == 16) xt_par2(XT_SET_ROW_COL_POS, row = 13, col = 95); else if(row < 22) xt_par2(XT_SET_ROW_COL_POS, --row, col); } } else if(c == KEY_ENTER && col > 94 && col < 120 && row > 12 && row < 18) xt_par2(XT_SET_ROW_COL_POS,++row,col=95); else if((c == KEY_LEFT || c == KEY_RIGHT) && col == 2) { CATEGORY = row; updateRecords(recordView); xt_par2(XT_SET_ROW_COL_POS,row=7,col=20); } else if((c == KEY_LEFT || c == KEY_RIGHT) && col == 20) { xt_par2(XT_SET_ROW_COL_POS,row=CATEGORY,col=2); if (search == 1) clearSearch(); currentRecord = recordView = search = 0; updateRecords(recordView); } else if(c == KEY_LEFT && col >= 95) { if(col > 95) xt_par2(XT_SET_ROW_COL_POS,row,--col); else if(row == 13 && col == 95) xt_par2(XT_SET_ROW_COL_POS,--row,col = 101); else if(row >= 17 && row <= 21 && col == 95) xt_par2(XT_SET_ROW_COL_POS,--row, col = 119); } else if(c == KEY_RIGHT && col > 94) { if(row == 9 && col < 112) xt_par2(XT_SET_ROW_COL_POS,row,++col); else if(row == 12 && col < 101) xt_par2(XT_SET_ROW_COL_POS,row,++col); else if(row == 12 && col == 101) xt_par2(XT_SET_ROW_COL_POS,++row,col = 95); else if(row == 13 && col < 112) xt_par2(XT_SET_ROW_COL_POS,row,++col); else if(row >= 16 && row < 21 && col < 119) xt_par2(XT_SET_ROW_COL_POS,row,++col); else if(row == 21 && col < 109) xt_par2(XT_SET_ROW_COL_POS,row,++col); else if(row >= 16 && row <= 21 && col == 119) xt_par2(XT_SET_ROW_COL_POS,++row,col = 95); } else if(c == KEY_DELETE) { putchar(' '); if(row == 9) Category[col - 95] = ' '; else if(row == 12) Title[col - 95] = ' '; else if(row == 13) Title[col - 88] = ' '; else if(row >= 16 && row < 22) Body[(row - 16) * 25 + col - 95] = ' '; } else if(c == KEY_BACKSPACE && col >= 95) { if((row == 9 || row == 12) && col > 95) { xt_par2(XT_SET_ROW_COL_POS,row,--col); putchar(' '); Category[col - 95] = ' '; xt_par2(XT_SET_ROW_COL_POS,row,col); } else if((row == 9 || row == 12) && col == 95) { putchar(' '); Title[col - 95] = ' '; xt_par2(XT_SET_ROW_COL_POS,row,col); } else if(row == 13 && col > 95) { xt_par2(XT_SET_ROW_COL_POS,row,--col); putchar(' '); Title[col - 88] = ' '; xt_par2(XT_SET_ROW_COL_POS,row,col); } else if(row == 13 && col == 95) { xt_par2(XT_SET_ROW_COL_POS,--row,col = 101); putchar(' '); Title[col - 88] = ' '; xt_par2(XT_SET_ROW_COL_POS,row,col); } else if(row >= 16 && row < 22 && col > 95) { xt_par2(XT_SET_ROW_COL_POS,row,--col); putchar(' '); Body[(row - 16) * 25 + col - 95] = ' '; xt_par2(XT_SET_ROW_COL_POS,row,col); } else if(row == 16 && col == 95) { putchar(' '); Body[(row - 16) * 25 + col - 95] = ' '; xt_par2(XT_SET_ROW_COL_POS,row,col); } else if(row > 16 && row < 22 && col == 95) { xt_par2(XT_SET_ROW_COL_POS,--row,col = 119); putchar(' '); Body[(row - 16) * 25 + col - 95] = ' '; xt_par2(XT_SET_ROW_COL_POS,row,col); } } else if((c >= ' ' && c <= '~') && col >= 95 && col < 120){ if(row == 9 && col < 112) { putchar(c); Category[col - 95] = c; xt_par2(XT_SET_ROW_COL_POS,row,++col); } else if(row == 9 && col == 112) { putchar(c); Category[col - 95] = c; xt_par2(XT_SET_ROW_COL_POS,row,col); } else if(row == 12 && col < 101) { putchar(c); Title[col - 95] = c; xt_par2(XT_SET_ROW_COL_POS,row,++col); } else if(row == 12 && col == 101) { putchar(c); Title[col - 95] = c; xt_par2(XT_SET_ROW_COL_POS,++row,col=95); } else if(row == 13 && col < 112) { putchar(c); Title[col - 88] = c; xt_par2(XT_SET_ROW_COL_POS,row,++col); } else if(row == 13 && col == 112) { putchar(c); Title[col - 88] = c; xt_par2(XT_SET_ROW_COL_POS,row,col); } else if(row >= 16 && row < 21 && col < 119) { putchar(c); Body[(row - 16) * 25 + col - 95] = c; xt_par2(XT_SET_ROW_COL_POS,row,++col); } else if(row >= 16 && row < 21 && col == 119) { putchar(c); Body[(row - 16) * 25 + col - 95] = c; xt_par2(XT_SET_ROW_COL_POS,++row,col = 95); } else if(row == 21 && col < 109) { putchar(c); Body[(row - 16) * 25 + col - 95] = c; xt_par2(XT_SET_ROW_COL_POS,row,++col); } else if(row == 21 && col == 109) { putchar(c); Body[(row - 16) * 25 + col - 95] = c; xt_par2(XT_SET_ROW_COL_POS,row,col); } } else if(c == KEY_F2) screen = 1; else if(c == KEY_F4 && col == 20 && maxRecord != 0) screen = 2; else if(c == KEY_F6) { if(sort == 0){ bubbleSort(); sort = 1; } else if (sort == 1){ bubbleSortTime(); sort = 0; } } else if (c == KEY_F7){ if(col < 95) { xt_par2(XT_SET_ROW_COL_POS,row = 9,col = 95); for(reset = 0; reset < 29; reset++) Title[reset] = ' '; for(reset = 0; reset < 140; reset++) Body[reset] = ' '; for(reset = 0; reset < 16; reset++) Category[reset] = ' '; } else if(Title[0] == ' ' && Body[0] == ' ' && Category[0] == ' ') { xt_par2(XT_SET_ROW_COL_POS,row = CATEGORY,col = 2); clearSearch(); updateRecords(0); } else if(Title[0] != ' ' || Body[0] != ' ' || Category[0] != ' ') { clearSearch(); search = 1; searchResults(0); xt_par2(XT_SET_ROW_COL_POS,row = 7, col = 20); } } } if (screen == 1 || screen == 2){ for(reset = 0; reset < 29; reset++) Title[reset] = ' '; for(reset = 0; reset < 140; reset++) Body[reset] = ' '; for(reset = 0; reset < 16; reset++) Category[reset] = ' '; addScreen(); if (screen == 2){ char TempBodyA[71]; char TempBodyB[71]; int k = 0; while(k != 70) { TempBodyA[k] = ' '; TempBodyB[k] = ' '; k++; } k = 0; xt_par2(XT_SET_ROW_COL_POS, row = 12, col = 25); xt_par0(XT_CH_GREEN); printf("Record %d (%s)", currentRecord+1, catStorage[currentRecord].timedate); //get the time using myui1 xt_par0(XT_CH_WHITE); xt_par2(XT_SET_ROW_COL_POS, row = 14, col = 25); printf("%s", catStorage[currentRecord].category); int j = 0; while(catStorage[currentRecord].body[j] != '\0'){ if (j < 70) TempBodyA[j] = catStorage[currentRecord].body[j]; else if (j < 140) TempBodyB[j%70] = catStorage[currentRecord].body[j]; j++; } TempBodyA[70] = '\0'; TempBodyB[70] = '\0'; xt_par2(XT_SET_ROW_COL_POS, row = 16, col = 25); printf("%s", catStorage[currentRecord].subject); xt_par0(XT_CH_WHITE); xt_par2(XT_SET_ROW_COL_POS, row = 19, col = 25); printf("%s", TempBodyA); xt_par2(XT_SET_ROW_COL_POS, row = 20, col = 25); printf("%s", TempBodyB); xt_par2(XT_SET_ROW_COL_POS, row = 14, col = 25); strncpy(Title, catStorage[currentRecord].subject, sizeof(Title)); strncpy(Body, catStorage[currentRecord].body, sizeof(Body)); strncpy(Category, catStorage[currentRecord].category, sizeof(Category)); } } while(screen == 1 || screen == 2) { while((c = getkey()) == KEY_NOTHING); if (c == KEY_F9){ screen = 0; xt_par0(XT_CLEAR_SCREEN); } else if (c == KEY_DOWN){ if(row == 14) xt_par2(XT_SET_ROW_COL_POS, row = 16, col = 25); else if(row == 16) xt_par2(XT_SET_ROW_COL_POS,row = 19,col = 25); else if(row < 20) xt_par2(XT_SET_ROW_COL_POS,++row,col); } else if (c == KEY_UP){ if(row == 16) xt_par2(XT_SET_ROW_COL_POS, row = 14, col = 25); if(row == 19) xt_par2(XT_SET_ROW_COL_POS,row = 16,col = 25); else if(row == 20) xt_par2(XT_SET_ROW_COL_POS,--row,col); } else if(c == KEY_LEFT && col > 25 && col < 95) xt_par2(XT_SET_ROW_COL_POS,row,--col); else if(c == KEY_LEFT && col == 25 && row == 20) xt_par2(XT_SET_ROW_COL_POS,--row,col=94); else if(c == KEY_RIGHT && col > 24 && col < 37 && row == 14) xt_par2(XT_SET_ROW_COL_POS,row,++col); else if(c == KEY_RIGHT && col > 24 && col < 53 && row == 16) xt_par2(XT_SET_ROW_COL_POS,row,++col); else if(c == KEY_RIGHT && col > 24 && col < 94 && row > 18) xt_par2(XT_SET_ROW_COL_POS,row,++col); else if(c == KEY_RIGHT && col == 94 && row == 19) xt_par2(XT_SET_ROW_COL_POS,++row,col=25); else if (c == KEY_ENTER && row > 18 && row < 20) xt_par2(XT_SET_ROW_COL_POS,++row,col=25); else if (c == KEY_BACKSPACE && col >= 25 && col < 95 && ((row > 18 && row < 21) || row == 16 || row == 14)){ if(row == 14 && col > 25 && col < 39) { xt_par2(XT_SET_ROW_COL_POS,row,--col); putchar(' '); Category[col - 25] = ' '; } else if(row == 16 && col > 25 && col <= 54) { xt_par2(XT_SET_ROW_COL_POS,row,--col); putchar(' '); Title[col - 25] = ' '; } else if(row == 19 && col > 25 && col <= 95) { xt_par2(XT_SET_ROW_COL_POS,row,--col); putchar(' '); Body[col - 25] = ' '; } else if(row == 20 && col > 25 && col <= 95) { xt_par2(XT_SET_ROW_COL_POS,row,--col); putchar(' '); Body[col + 45] = ' '; } else if(row == 20){ xt_par2(XT_SET_ROW_COL_POS,--row,col=94); putchar(' '); Body[69] = ' '; } xt_par2(XT_SET_ROW_COL_POS,row,col); } else if (c == KEY_DELETE) { if(row == 14 && col >= 25 && col < 38) { putchar(' '); Category[col - 25] = ' '; } else if(row == 16 && col >= 25 && col < 54) { putchar(' '); Title[col - 25] = ' '; } else if(row == 19 && col >= 25 && col <= 95) { putchar(' '); Body[col - 25] = ' '; } else if(row == 20 && col >= 25 && col <= 95) { putchar(' '); Body[col + 45] = ' '; } xt_par2(XT_SET_ROW_COL_POS,row,col); } else if((c >= ' ' && c <= '~') && col >= 25 && col < 95) { if(row == 14 && col >= 25 && col < 40) { putchar(c); Category[col - 25] = c; } else if(row == 16 && col >= 25 && col < 54) { putchar(c); Title[col - 25] = c; } else if(row == 19 && col >= 25 && col <= 95) { putchar(c); Body[col - 25] = c; } else if(row == 20 && col >= 25 && col <= 95) { putchar(c); Body[col + 45] = c; } if (col < 94 && !(row == 16 && col > 52) && !(row == 14 && col > 36)){ ++col; } else{ if (row == 19) xt_par2(XT_SET_ROW_COL_POS,++row,col=25); else xt_par2(XT_SET_ROW_COL_POS,row,col); } } else if(c == KEY_F2 && screen == 1 /* && there is a valid title and description */){ //save record to corresponding subject if(Title[0] != ' ' || Body[0] != ' ' || Category[0] != ' ') { removeBlanks(); readmyStoreFromChildSOCKETS("add", Title, Body, Category, NULL); } int k = 0; while(k != 29) Title[k++] = ' '; k = 0; while(k != 140) Body[k++] = ' '; k = 0; while(k != 15) Category[k++] = ' '; maxRecord++; screen = 0; } else if(c == KEY_F2 && screen == 2 /* && there has been a valid change in the record */){ //update record removeBlanks(); char str[80]; for(i = 0; i < maxRecord; i++){ if(strcmp(catStorage[currentRecord].subject, dataStorage[i].subject) == 0 && strcmp(catStorage[currentRecord].body, dataStorage[i].body) == 0 && strcmp(catStorage[currentRecord].category, dataStorage[i].category) == 0 && strcmp(catStorage[currentRecord].timedate, dataStorage[i].timedate) == 0){//looks for corresponding record in the actual record list sprintf(str, "%d", i+1); break; } } readmyStoreFromChildSOCKETS("edit", str, Title, Body, Category); int k = 0; while(k != 29) Title[k++] = ' '; k = 0; while(k != 140) Body[k++] = ' '; k = 0; while(k != 15) Category[k++] = ' '; screen = 0; } } if (screen == 4){ for(reset = 0; reset < 29; reset++) Title[reset] = ' '; for(reset = 0; reset < 140; reset++) Body[reset] = ' '; for(reset = 0; reset < 16; reset++) Category[reset] = ' '; deleteScreen(); if (screen == 4){ char TempBodyA[71]; char TempBodyB[71]; int k = 0; while(k != 70) { TempBodyA[k] = ' '; TempBodyB[k] = ' '; k++; } k = 0; xt_par2(XT_SET_ROW_COL_POS, row = 12, col = 25); xt_par0(XT_CH_GREEN); printf("Record %d (%s)", currentRecord+1, catStorage[currentRecord].timedate); //get the time using myui1 xt_par0(XT_CH_WHITE); xt_par2(XT_SET_ROW_COL_POS, row = 14, col = 25); printf("%s", catStorage[currentRecord].category); int j = 0; while(catStorage[currentRecord].body[j] != '\0'){ if (j < 70) TempBodyA[j] = catStorage[currentRecord].body[j]; else if (j < 140) TempBodyB[j%70] = catStorage[currentRecord].body[j]; j++; } TempBodyA[70] = '\0'; TempBodyB[70] = '\0'; xt_par2(XT_SET_ROW_COL_POS, row = 16, col = 25); printf("%s", catStorage[currentRecord].subject); xt_par0(XT_CH_WHITE); xt_par2(XT_SET_ROW_COL_POS, row = 19, col = 25); printf("%s", TempBodyA); xt_par2(XT_SET_ROW_COL_POS, row = 20, col = 25); printf("%s", TempBodyB); xt_par2(XT_SET_ROW_COL_POS, row = 14, col = 25); strncpy(Title, catStorage[currentRecord].subject, sizeof(Title)); strncpy(Body, catStorage[currentRecord].body, sizeof(Body)); strncpy(Category, catStorage[currentRecord].category, sizeof(Category)); //print corresponding record in correct locations using myui1 } } while(screen == 4) { while((c = getkey()) == KEY_NOTHING); if (c == KEY_F9){ screen = 0; xt_par0(XT_CLEAR_SCREEN); } else if (c == KEY_F3){ char str[80]; for(i = 0; i < maxRecord; i++){ if(strcmp(catStorage[currentRecord].subject, dataStorage[i].subject) == 0 && strcmp(catStorage[currentRecord].body, dataStorage[i].body) == 0 && strcmp(catStorage[currentRecord].category, dataStorage[i].category) == 0 && strcmp(catStorage[currentRecord].timedate, dataStorage[i].timedate) == 0){ //looks for corresponding record in the actual record list sprintf(str, "%d", i+1); break; } } readmyStoreFromChildSOCKETS("delete", str, NULL, NULL, NULL); maxRecord--; screen = 0; } } if (screen == 3) break; } getkey_terminate(); xt_par0(XT_CLEAR_SCREEN); xt_par0(XT_BG_DEFAULT); xt_par2(XT_SET_ROW_COL_POS,row=1,col=1); getkey_terminate(); return 0; }
PlaylistWindow::PlaylistWindow(QMediaPlaylist *playList, QWidget *parent, int playModel) : QWidget(parent) { this->setWindowTitle("Playlist"); this->setWindowIcon(QIcon(":/image/playlist.ico")); playBackMode = playModel; playlist = playList; playlist->setPlaybackMode((QMediaPlaylist::PlaybackMode)playBackMode); listWidget = new QListWidget(this); loadPlaylist(); this->doubleClicked = false; //----布局--------------------------------------- QHBoxLayout *topLayout = new QHBoxLayout; topLayout->addWidget(listWidget); QHBoxLayout *bottomLayout = new QHBoxLayout; playType = new QPushButton(QIcon(":image/seq.png"),""); playType->setToolTip("点击切换播放模式"); search_edit = new QLineEdit(); search_btn = new QPushButton(QIcon(":image/search.ico"),""); search_btn->setToolTip("搜索"); addBtn = new QPushButton(QIcon(":image/openfile.ico"),""); addBtn->setToolTip("添加"); delBtn = new QPushButton(QIcon(":image/rmfile.ico"), ""); delBtn->setToolTip("移除"); clearBtn = new QPushButton(QIcon(":image/clear.ico"),""); clearBtn->setToolTip("清空"); bottomLayout->addWidget(playType); bottomLayout->addWidget(search_edit); bottomLayout->addWidget(search_btn); bottomLayout->addWidget(addBtn); bottomLayout->addWidget(delBtn); bottomLayout->addWidget(clearBtn); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(topLayout); mainLayout->addLayout(bottomLayout); this->setLayout(mainLayout); //-----signal-start------------ connect(listWidget,SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),this,SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*))); connect(listWidget,SIGNAL(currentRowChanged(int)),this,SIGNAL(currentRowChanged(int))); connect(listWidget,SIGNAL(currentTextChanged(QString)),this,SIGNAL(currentTextChanged(QString))); connect(listWidget,SIGNAL(itemActivated(QListWidgetItem*)),this,SIGNAL(itemActivated(QListWidgetItem*))); connect(listWidget,SIGNAL(itemChanged(QListWidgetItem*)),this,SIGNAL(itemChanged(QListWidgetItem*))); connect(listWidget,SIGNAL(itemClicked(QListWidgetItem*)),this,SIGNAL(itemClicked(QListWidgetItem*))); //connect(listWidget,SIGNAL(itemDoubleClicked(QListWidgetItem*)),this,SIGNAL(itemDoubleClicked(QListWidgetItem*))); connect(listWidget,SIGNAL(itemEntered(QListWidgetItem*)),this,SIGNAL(itemEntered(QListWidgetItem*))); connect(listWidget,SIGNAL(itemPressed(QListWidgetItem*)),this,SIGNAL(itemPressed(QListWidgetItem*))); connect(listWidget,SIGNAL(itemSelectionChanged()),this,SIGNAL(itemSelectionChanged())); connect(delBtn,SIGNAL(clicked(bool)),this,SLOT(removeItems())); connect(clearBtn,SIGNAL(clicked(bool)),this,SLOT(clear())); connect(search_btn,SIGNAL(clicked(bool)),this,SLOT(searchItem())); connect(listWidget,SIGNAL(clicked(QModelIndex)),this,SLOT(clearSearch())); connect(listWidget,SIGNAL(itemDoubleClicked(QListWidgetItem*)),this,SLOT(setPlaylistIndex(QListWidgetItem*))); connect(playlist,SIGNAL(currentIndexChanged(int)),this,SLOT(setItemPlay(int))); connect(playType,SIGNAL(clicked(bool)),this,SLOT(setPlayMode())); connect(addBtn,SIGNAL(clicked(bool)),this,SLOT(openfiles())); //------signal-end------------ }
void SearchTab::createGui() { QVBoxLayout *layout = new QVBoxLayout(this); layout->setMargin(2); layout->setSpacing(0); Splitter = new QSplitter(Qt::Horizontal, this); layout->addWidget(Splitter); QWidget *queryWidget = new QWidget(Splitter); QVBoxLayout *queryLayout = new QVBoxLayout(queryWidget); queryLayout->setMargin(3); QWidget *queryFormWidget = new QWidget(queryWidget); queryLayout->addWidget(queryFormWidget); QFormLayout *queryFormLayout = new QFormLayout(queryFormWidget); queryFormLayout->setLabelAlignment(Qt::AlignLeft | Qt::AlignHCenter); queryFormLayout->setRowWrapPolicy(QFormLayout::WrapAllRows); queryFormLayout->setMargin(0); Query = new QLineEdit(queryFormWidget); Query->setMinimumWidth(200); queryFormLayout->addRow(tr("Search for:"), Query); connect(Query, SIGNAL(returnPressed()), this, SLOT(performSearch())); SearchInChats = new QRadioButton(tr("Chats"), queryFormWidget); SearchInChats->setChecked(true); SelectChat = m_pluginInjectedFactory->makeInjected<HistoryTalkableComboBox>(queryFormWidget); SelectChat->setAllLabel(tr(" - All chats - ")); SelectChat->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); queryFormLayout->addRow(SearchInChats, SelectChat); SearchInStatuses = new QRadioButton(tr("Statuses"), queryFormWidget); SelectStatusBuddy = m_pluginInjectedFactory->makeInjected<HistoryTalkableComboBox>(queryFormWidget); SelectStatusBuddy->setAllLabel(tr(" - All buddies - ")); SelectStatusBuddy->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); SelectStatusBuddy->setEnabled(false); queryFormLayout->addRow(SearchInStatuses, SelectStatusBuddy); SearchInSmses = new QRadioButton(tr("Smses"), queryFormWidget); SelectSmsRecipient = m_pluginInjectedFactory->makeInjected<HistoryTalkableComboBox>(queryFormWidget); SelectSmsRecipient->setAllLabel(tr(" - All recipients - ")); SelectSmsRecipient->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); SelectSmsRecipient->setEnabled(false); queryFormLayout->addRow(SearchInSmses, SelectSmsRecipient); QButtonGroup *kindRadioGroup = new QButtonGroup(queryFormWidget); kindRadioGroup->addButton(SearchInChats); kindRadioGroup->addButton(SearchInStatuses); kindRadioGroup->addButton(SearchInSmses); connect(kindRadioGroup, SIGNAL(buttonReleased(QAbstractButton*)), this, SLOT(kindChanged(QAbstractButton*))); SearchByDate = new QCheckBox(tr("By date"), queryFormWidget); SearchByDate->setCheckState(Qt::Unchecked); QWidget *dateWidget = new QWidget(queryFormWidget); QHBoxLayout *dateLayout = new QHBoxLayout(dateWidget); FromDate = new QDateEdit(dateWidget); FromDate->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); FromDate->setCalendarPopup(true); FromDate->setDate(QDate::currentDate().addDays(-7)); dateLayout->addWidget(FromDate); dateLayout->addWidget(new QLabel(tr("to"), dateWidget)); ToDate = new QDateEdit(dateWidget); ToDate->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); ToDate->setCalendarPopup(true); ToDate->setDate(QDate::currentDate()); dateLayout->addWidget(ToDate); connect(FromDate, SIGNAL(dateChanged(QDate)), this, SLOT(fromDateChanged(QDate))); connect(ToDate, SIGNAL(dateChanged(QDate)), this, SLOT(toDateChanged(QDate))); connect(SearchByDate, SIGNAL(toggled(bool)), dateWidget, SLOT(setEnabled(bool))); dateWidget->setEnabled(false); queryFormLayout->addRow(SearchByDate, dateWidget); QPushButton *searchButton = new QPushButton(tr("Search"), queryFormWidget); searchButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); queryFormLayout->addRow(0, searchButton); connect(searchButton, SIGNAL(clicked()), this, SLOT(performSearch())); TimelineView = m_pluginInjectedFactory->makeInjected<TimelineChatMessagesView>(Splitter); TimelineView->setTalkableVisible(true); TimelineView->setTitleVisible(true); TimelineView->setLengthHeader(tr("Found")); connect(TimelineView, SIGNAL(currentDateChanged()), this, SLOT(currentDateChanged())); connect(TimelineView, SIGNAL(messagesDisplayed()), this, SLOT(messagesDisplayed())); TimelineView->searchBar()->setAutoVisibility(false); TimelineView->searchBar()->setSearchWidget(this); connect(TimelineView->searchBar(), SIGNAL(clearSearch()), this, SLOT(clearSelect())); setFocusProxy(Query); }