void MainWindow::ConnectNewDomain(Domain *newDomain) { if (testDomain) { disconnect(testDomain, SIGNAL(Message(QString)), this, SLOT(displayOutput(QString))); disconnect(testDomain, SIGNAL(Instructions(QString)), ui->statusBar, SLOT(showMessage(QString))); disconnect(testDomain, SIGNAL(ToolFinishedDrawing()), ui->statusBar, SLOT(clearMessage())); disconnect(testDomain, SIGNAL(MouseX(float)), this, SLOT(showMouseX(float))); disconnect(testDomain, SIGNAL(MouseY(float)), this, SLOT(showMouseY(float))); disconnect(testDomain, SIGNAL(CircleToolStatsSet(float,float,float)), this, SLOT(showCircleStats(float,float,float))); disconnect(testDomain, SIGNAL(NumNodesDomain(int)), this, SLOT(showNumNodes(int))); disconnect(testDomain, SIGNAL(NumElementsDomain(int)), this, SLOT(showNumElements(int))); disconnect(testDomain, SIGNAL(NumNodesSelected(int)), this, SLOT(showNumSelectedNodes(int))); disconnect(testDomain, SIGNAL(NumElementsSelected(int)), this, SLOT(showNumSelectedElements(int))); disconnect(testDomain, SIGNAL(ToolFinishedDrawing()), glStatusBar, SLOT(clearMessage())); disconnect(testDomain, SIGNAL(EmitMessage(QString)), this, SLOT(displayOutput(QString))); disconnect(testDomain, SIGNAL(UndoAvailable(bool)), ui->undoButton, SLOT(setEnabled(bool))); disconnect(testDomain, SIGNAL(RedoAvailable(bool)), ui->redoButton, SLOT(setEnabled(bool))); } connect(newDomain, SIGNAL(Message(QString)), this, SLOT(displayOutput(QString))); connect(newDomain, SIGNAL(Instructions(QString)), ui->statusBar, SLOT(showMessage(QString))); connect(newDomain, SIGNAL(ToolFinishedDrawing()), ui->statusBar, SLOT(clearMessage())); connect(newDomain, SIGNAL(MouseX(float)), this, SLOT(showMouseX(float))); connect(newDomain, SIGNAL(MouseY(float)), this, SLOT(showMouseY(float))); connect(newDomain, SIGNAL(CircleToolStatsSet(float,float,float)), this, SLOT(showCircleStats(float,float,float))); connect(newDomain, SIGNAL(NumNodesDomain(int)), this, SLOT(showNumNodes(int))); connect(newDomain, SIGNAL(NumElementsDomain(int)), this, SLOT(showNumElements(int))); connect(newDomain, SIGNAL(NumNodesSelected(int)), this, SLOT(showNumSelectedNodes(int))); connect(newDomain, SIGNAL(NumElementsSelected(int)), this, SLOT(showNumSelectedElements(int))); connect(newDomain, SIGNAL(ToolFinishedDrawing()), glStatusBar, SLOT(clearMessage())); connect(newDomain, SIGNAL(EmitMessage(QString)), this, SLOT(displayOutput(QString))); connect(newDomain, SIGNAL(UndoAvailable(bool)), ui->undoButton, SLOT(setEnabled(bool))); connect(newDomain, SIGNAL(RedoAvailable(bool)), ui->redoButton, SLOT(setEnabled(bool))); }
int UserTurn(MessageType *m, int incomeSd, int userID) { printf("\n\nHandling the turn\n"); fflush(stdout); int result_val; int gameID = userGame[userID]; char turn_str[MAX_MES_LEN]; char error[MAX_MES_LEN]; strcpy(turn_str, (char *)m->data); if(userGame[userID] == -1) { result_val = 2; printf("The game of %s is over, he will be disconnected", users[userID].name); fflush(stdout); MessageType mes = composeMessage(result, sizeof(int), &result_val); sendMessage(incomeSd, &mes); clearMessage(&mes); } else if (HandleTurn(turn_str, error, &games[gameID])) { result_val = 1; printf("Making turn\n"); MakeTurn(turn_str, gameID); printf("Color before: %d\n", games[gameID].current); games[gameID].current = (games[gameID].current + 1) % 2; printf("Color after: %d\n", games[gameID].current); fflush(stdout); MessageType mes = composeMessage(result, sizeof(int), &result_val); sendMessage(incomeSd, &mes); clearMessage(&mes); } else { result_val = 0; MessageType mes = composeMessage(result, sizeof(int), &result_val); sendMessage(incomeSd, &mes); mes = composeMessage(text, sizeof(error), error); sendMessage(incomeSd, &mes); clearMessage(&mes); } printf("Handling turn is finished\n"); fflush(stdout); return 1; }
void AlbumCoverManager::UpdateStatusText() { QString message = tr("Got %1 covers out of %2 (%3 failed)") .arg(fetch_statistics_.chosen_images_) .arg(jobs_) .arg(fetch_statistics_.missing_images_); if (fetch_statistics_.bytes_transferred_) { message += ", " + tr("%1 transferred") .arg(Utilities::PrettySize(fetch_statistics_.bytes_transferred_)); } statusBar()->showMessage(message); progress_bar_->setValue(fetch_statistics_.chosen_images_ + fetch_statistics_.missing_images_); if (cover_fetching_tasks_.isEmpty()) { QTimer::singleShot(2000, statusBar(), SLOT(clearMessage())); progress_bar_->hide(); CoverSearchStatisticsDialog* dialog = new CoverSearchStatisticsDialog(this); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->Show(fetch_statistics_); jobs_ = 0; } }
int UserLogout(int incomeSd, int userID) { printf("\n\nUser [%d] is logging out!\n", userID); fflush(stdout); users_available[userID] = 0; pthread_mutex_lock(&usnum_mutex); numberOfPlayers--; pthread_mutex_unlock(&usnum_mutex); if (userGame[userID] >= 0) { games_available[userGame[userID]] = 0; userGame[userID] = -1; userGame[userOp[userID]] = -1; userOp[userOp[userID]] = userOp[userID]; userOp[userID] = userID; } printf("Userdata cleared...\n"); fflush(stdout); char result_val = 'g'; MessageType m = composeMessage(result, sizeof(char), &result_val); sendMessage(incomeSd, &m); clearMessage(&m); printf("User %s was successfully logged out\n", users[userID].name); fflush(stdout); return 0; }
MainWindow::MainWindow( QWidget * parent ) : QMainWindow( parent ) { /* Setup counter */ mCounterLabel = new QLabel("", statusBar()); mCounterLabel->setAlignment( Qt::AlignCenter ); mCounterLabel->setMinimumWidth(350); mCounterLabel->setMaximumHeight(20); statusBar()->addPermanentWidget( mCounterLabel, 0 ); /* Set up MainWindow stuff */ setWindowTitle("Snafu - Version " + VERSION + ", build " + SVN_REVSTR); mSW = new SnafuWidget( this ); mSW->show(); setCentralWidget( mSW ); connect(mSW, SIGNAL(showStatusBarMessage(const QString &)), statusBar(), SLOT(showMessage( const QString & ))); connect(mSW, SIGNAL(clearStatusBar()), statusBar(), SLOT(clearMessage())); HostToolBar = new QToolBar( this ); HostToolBar->setIconSize(QSize(24,24)); addToolBar(HostToolBar); HostToolBar->addAction( mSW->findHostAct ); HostToolBar->addAction( mSW->refreshAct ); IniConfig & config = ::userConfig(); config.pushSection("SW_Display_Prefs" ); }
/*** PRIVATE SLOTS ***/ void br::Progress::checkProgress() { const int progress = 100 * br_progress(); const bool visible = progress >= 0; if (visible) { showMessage(br_most_recent_message()); pbProgress.setValue(progress); if (progress > 100) pbProgress.setMaximum(0); else pbProgress.setMaximum(100); int s = br_time_remaining(); if (s >= 0) { int h = s / (60*60); int m = (s - h*60*60) / 60; s = (s - h*60*60 - m*60); lTimeRemaining.setText(QString("%1:%2:%3").arg(h, 2, 10, QLatin1Char('0')).arg(m, 2, 10, QLatin1Char('0')).arg(s, 2, 10, QLatin1Char('0'))); } else { lTimeRemaining.clear(); } } else { clearMessage(); lTimeRemaining.clear(); } pbProgress.setVisible(visible); }
void loop(){ if(Serial.available()){ if(numReceivedMessageBytes == 0) { //Serial.println("MessageBytesIsZero"); if(Serial.read() == messageActivator) { //Serial.println("SerialIsActivator"); numReceivedMessageBytes = 1; } } else if(numReceivedMessageBytes > 0) { message[numReceivedMessageBytes - 1] = char(Serial.read()); numReceivedMessageBytes = numReceivedMessageBytes + 1; } if(numReceivedMessageBytes == 4) { sendMessage(); clearMessage(); } } }
void interpretIRCCommand ( string message ) { string parsedMessage = message; string command = stringSeparatedFromString ( " \t", & parsedMessage ); if ( ! command ) return; if ( sameStrings ( command, "/join" ) ) IRCJoinCommand ( parsedMessage ); else if ( sameStrings ( command, "/msg" ) ) IRCMsgCommand ( parsedMessage ); else verbatimIRCCommand ( message ); clearMessage (); }
void FindReplace::LoadSearch(SearchEditorModel::searchEntry *search_entry) { clearMessage(); if (!search_entry) { return; } UpdatePreviousFindStrings(search_entry->find); UpdatePreviousReplaceStrings(search_entry->replace); // Default for all saved searches is Regex, All HTML Files, Down. SetSearchMode(FindReplace::SearchMode_Regex); SetLookWhere(FindReplace::LookWhere_AllHTMLFiles);; SetSearchDirection(FindReplace::SearchDirection_Down); ui.cbLookWhere->setCurrentIndex(1); ui.cbSearchDirection->setCurrentIndex(1); // Show a message containing the name that was loaded QString message = ""; message = tr("Unnamed search loaded"); if (!search_entry->name.isEmpty()) { message = QString("%1: %2 ").arg(tr("Loaded")).arg(search_entry->name.replace('<', "<").replace('>', ">").left(50)); } ShowMessage(message); }
void ROSSubBase::startReceiveSlot() { lock.lockForWrite(); receiveflag=1; clearMessage(); lock.unlock(); }
QgsAuthConfigSelect::QgsAuthConfigSelect( QWidget *parent, const QString &dataprovider ) : QWidget( parent ) , mAuthCfg( QString() ) , mDataProvider( dataprovider ) , mConfigs( QgsAuthMethodConfigsMap() ) , mDisabled( false ) , mAuthNotifyLayout( nullptr ) , mAuthNotify( nullptr ) { if ( QgsAuthManager::instance()->isDisabled() ) { mDisabled = true; mAuthNotifyLayout = new QVBoxLayout; this->setLayout( mAuthNotifyLayout ); mAuthNotify = new QLabel( QgsAuthManager::instance()->disabledMessage(), this ); mAuthNotifyLayout->addWidget( mAuthNotify ); } else { setupUi( this ); leConfigMsg->setStyleSheet( QString( "QLineEdit{background-color: %1}" ) .arg( QgsAuthGuiUtils::yellowColor().name() ) ); clearConfig(); clearMessage(); populateConfigSelector(); } }
void updateScreen(struct gameData * bigPicPtr) { char string[10]; clearMessage(bigPicPtr->statRow); sprintf(string, "HP: %d", bigPicPtr->hp); mvwprintw(stdscr, bigPicPtr->statRow, 0, string); sprintf(string, "ATK: %d", bigPicPtr->atk); mvwprintw(stdscr, bigPicPtr->statRow, 11, string); sprintf(string, "DEF: %d", bigPicPtr->def); mvwprintw(stdscr, bigPicPtr->statRow, 22, string); sprintf(string, "GOLD: %d", bigPicPtr->gold); mvwprintw(stdscr, bigPicPtr->statRow, 32, string); sprintf(string, "EXP: %d", bigPicPtr->exp); mvwprintw(stdscr, bigPicPtr->statRow, 44, string); bigPicPtr->lvl = (bigPicPtr->exp+100)/100; sprintf(string, "LVL: %d", bigPicPtr->lvl); mvwprintw(stdscr, bigPicPtr->statRow, 55, string); for (int i = 0; i < bigPicPtr->maxCols; i++) { mvaddch(bigPicPtr->statRow-1, i, '-'); } move(bigPicPtr->cRow, bigPicPtr->cCol); }
void Designer::addMessage(QString message, bool showArrow) { clearMessage(); info->messages->setText(message); messageTimer = 0; if (showArrow) info->arrow->show(); }
void DUChainControlFlowJob::done(ThreadWeaver::Job *job) { job->deleteLater(); emit hideProgress(this); emit clearMessage(this); emitResult(); }
void CLIProgessFeedback::showMessage(const std::ostringstream& ss) { if (silent) return; std::string msg = ss.str(); if (messageLength > 0) clearMessage(); messageLength = msg.length(); cerr << msg; cerr.flush(); }
// Starts the search for the user's term. bool FindReplace::FindText( Searchable::Direction direction ) { bool found = false; clearMessage(); if ( !IsValidFindText() ) { return found; } SetCodeViewIfNeeded(); if ( GetLookWhere() == FindReplace::LookWhere_CurrentFile || m_LookWhereCurrentFile) { Searchable *searchable = GetAvailableSearchable(); if ( !searchable ) { return found; } found = searchable->FindNext( GetSearchRegex(), direction ); } else { found = FindInAllFiles( direction ); } if ( found ) { clearMessage(); } else { CannotFindSearchTerm(); } UpdatePreviousFindStrings(); return found; }
void FindOpponent(int incomeSd, int userID) { int found = 0; int i; for (i = 0; i < MAXUSERS; i++) if (i != userID && users_available[i]) { if (users[userID].ownLevel == users[i].desiredLevel && users[userID].desiredLevel == users[i].ownLevel) { found = 1; int gameID = CreateGame(userID, i); userGame[userID] = userGame[i] = gameID; userOp[userID] = i; userOp[i] = userID; printf("\n\nUserIDs: %d, %d\n", userID, i); printf("Game info\n"); printf("\tGameID: %d\n", gameID); printf("\tWhiteID: %d\n", games[gameID].white_user.userID); printf("\tBlackID: %d\n", games[gameID].black_user.userID); break; } } if (!found) { int result_val = 0; MessageType m = composeMessage(result, sizeof(int), &result_val); sendMessage(incomeSd, &m); while (userOp[userID] == userID) continue; } else { int result_val = 1; MessageType m = composeMessage(result, sizeof(int), &result_val); sendMessage(incomeSd, &m); } MessageType m = composeMessage(text, sizeof(users[userOp[userID]].name), &(users[userOp[userID]].name)); sendMessage(incomeSd, &m); Color color; if (games[userGame[userID]].white_user.userID == userID) color = white; else color = black; m = composeMessage(color_t, sizeof(Color), &color); sendMessage(incomeSd, &m); clearMessage(&m); }
void CCalc::OnBnClickedButton3() { // TODO: Add your control notification handler code here clearMessage(); CEdit* edit_value = (CEdit*)this->GetDlgItem(IDC_EDIT1); edit_value->EnableWindow(FALSE); edit_value = (CEdit*)this->GetDlgItem(IDC_EDIT2); edit_value->EnableWindow(FALSE); edit_value = (CEdit*)this->GetDlgItem(IDC_EDIT3); edit_value->EnableWindow(TRUE); }
void UIGChooser::setStatusBar(QStatusBar *pStatusBar) { /* Old status-bar set? */ if (m_pStatusBar) m_pChooserModel->disconnect(m_pStatusBar); /* Connect new status-bar: */ m_pStatusBar = pStatusBar; connect(m_pChooserModel, SIGNAL(sigClearStatusMessage()), m_pStatusBar, SLOT(clearMessage())); connect(m_pChooserModel, SIGNAL(sigShowStatusMessage(const QString&)), m_pStatusBar, SLOT(showMessage(const QString&))); }
bool FindReplace::FindMisspelledWord() { clearMessage(); SetCodeViewIfNeeded(true); m_SpellCheck = true; bool found = FindInAllFiles(Searchable::Direction_Down); m_SpellCheck = false; if (found) { clearMessage(); } else { CannotFindSearchTerm(); } return found; }
// Replaces the user's search term with the user's // replacement text in the entire document. int FindReplace::ReplaceAll() { m_MainWindow.GetCurrentContentTab().SaveTabContent(); clearMessage(); if ( !IsValidFindText() ) { return 0; } SetCodeViewIfNeeded( true ); int count = 0; if ( GetLookWhere() == FindReplace::LookWhere_CurrentFile || m_LookWhereCurrentFile) { Searchable *searchable = GetAvailableSearchable(); if ( !searchable ) { return 0; } count = searchable->ReplaceAll( GetSearchRegex(), ui.cbReplace->lineEdit()->text() ); } else { count = ReplaceInAllFiles(); } if ( count == 0 ) { ShowMessage( tr( "No replacements made" ) ); } else { QString message = tr( "%1 replacements made", 0, count ); ShowMessage( message.arg( count ) ); } if ( count > 0 ) { // Signal that the contents have changed and update the view m_MainWindow.GetCurrentBook()->SetModified( true ); m_MainWindow.GetCurrentContentTab().ContentChangedExternally(); } UpdatePreviousFindStrings(); UpdatePreviousReplaceStrings(); return count; }
void MCentral::repaintGraph(){ #ifdef MYDEBUG qDebug() << "Startuje MCentral::repaintGraph()"; #endif clearMessage(); //clearTmpDisp(); //To wykomentowac jezeli przycisk "wyczysc rezultat" ma nie czyscic ostatnich edycji engine->clear(); //Uwaga!!! kasuje niezapisane rezultaty //tmpDisp(engine->graphToString()); //To wykomentowac jezeli przycisk "wyczysc rezultat" ma nie czyscic ostatnich edycji #ifdef MYDEBUG qDebug() << "Konczy sie MCentral::repaintGraph()"; #endif }
int UserLogin(MessageType* m, int incomeSd, int userID) { printf("\n\nNew user [%d] is logging in!\n", userID); fflush(stdout); UserData user_data = *(UserData*)(m->data); users[userID] = user_data; //ud никуда не денется, потому что в куче users[userID].userID = userID; PrintUserByID(userID); if (!CanPlay()) { printf("User %s will not be logged in\n", user_data.name); fflush(stdout); int result_val = 0; MessageType m = composeMessage(result, sizeof(int), &result_val); sendMessage(incomeSd, &m); clearMessage(&m); return 0; } else { printf("User %s has successfully logged in!\n", user_data.name); fflush(stdout); int result_val = 1; MessageType m = composeMessage(result, sizeof(int), &result_val); sendMessage(incomeSd, &m); FindOpponent(incomeSd, userID); clearMessage(&m); return 1; } }
//-------------------------------------------------------------------------- MainWindow::MainWindow() : settings(new Settings(this)), scanner(new Scanner(this)), engine(new SearchEngine(this)), mainMenu(new MainMenu(this)), status(new StatusBar(this)), stack(new QStackedWidget(this)), settingsDialog(new SettingsDialog(this)) { // Set up window widgets setWindowTitle(tr("Vaultaire")); setWindowIcon(QIcon(":/vaultaire.svg")); setMenuBar(mainMenu); setStatusBar(status); setCentralWidget(stack); // Connect signals to show scanning in-progress in status bar connect(scanner, SIGNAL(started()), status, SLOT(startBusyIndicator())); connect(scanner, SIGNAL(started()), this, SLOT(showScanningMessage())); connect(scanner, SIGNAL(finished(Scanner::ScanResult)), status, SLOT(stopBusyIndicator())); connect(scanner, SIGNAL(finished(Scanner::ScanResult)), status, SLOT(clearMessage())); // Connect signals to show search in-progress in status bar connect(engine, SIGNAL(started()), status, SLOT(startBusyIndicator())); connect(engine, SIGNAL(finished(QStringList)), status, SLOT(stopBusyIndicator())); // Create application widgets scanView = new ScanView(scanner, this); browser = new LibraryBrowser(this); search = new SearchView(engine, this); stack->addWidget(scanView); stack->addWidget(browser); stack->addWidget(search); // Connect menu signals connect(mainMenu, SIGNAL(scanNewFile()), this, SLOT(showScanForm())); connect(mainMenu, SIGNAL(browseFiles()), this, SLOT(showFileBrowser())); connect(mainMenu, SIGNAL(findFile()), this, SLOT(showSearchForm())); connect(mainMenu, SIGNAL(showAboutInfo()), this, SLOT(about())); connect(mainMenu, SIGNAL(quit()), this, SLOT(close())); connect(mainMenu, SIGNAL(editSettings()), settingsDialog, SLOT(show())); readSettings(); }
void Designer::timerEvent(QTimerEvent *event) { if (!stopped && event->timerId() == timerId) { for (int i = 0; i < (int) buildingArea->blocks.size(); i++) if (buildingArea->blocks[i]->isCurrentError) { addMessage(buildingArea->blocks[i]->error); buildingArea->blocks[i]->isCurrentError = false; } if (messageTimer == UI::STEPS_PER_SECOND * 20) clearMessage(); messageTimer++; } QObject::timerEvent(event); }
int UserTryTurn(int incomeSd, int userID) { printf("\n\nUser %s is trying to make a turn!\n", users[userID].name); fflush(stdout); int result_val; if (userGame[userID] == -1) { printf("The game of %s is over, he will be disconnected", users[userID].name); fflush(stdout); result_val = 0; } else { int gameID = userGame[userID]; Game game = games[gameID]; printf("The id of the game is: %d\n", gameID); printf("UserID: %d\n", userID); printf("WhiteID: %d\n", game.white_user.userID); printf("BlackID: %d\n", game.black_user.userID); if (game.current == white) printf("Current turn is whites'\n"); else printf("Current turn is blacks'\n"); if ((game.current == white && game.white_user.userID != userID) || (game.current == black && game.black_user.userID != userID)) { printf("Not time for turn!\n"); result_val = 1; } else result_val = 2; } MessageType mes = composeMessage(result, sizeof(int), &result_val); sendMessage(incomeSd, &mes); if (result_val == 2) { getMessage(incomeSd, &mes); UserTurn(&mes, incomeSd, userID); } clearMessage(&mes); return 1; }
void MCentral::repaintGraph(QString name){ #ifdef MYDEBUG qDebug() << "Startuje MCentral::repaintGraph("<<name<<")"; #endif clearMessage(); clearTmpDisp(); if(name != ""){ //Nie wchodzi do ifa gdy zamykamy ostatni graf engine->setCurrentGraph(name); tmpDisp(engine->graphToString()); writeMessage(engine->dispResults()); } #ifdef MYDEBUG qDebug() << "Konczy sie MCentral::repaintGraph("<<name<<")"; #endif }
void OBSBasicStatusBar::StreamStopped() { if (streamOutput) { signal_handler_disconnect( obs_output_get_signal_handler(streamOutput), "reconnect", OBSOutputReconnect, this); signal_handler_disconnect( obs_output_get_signal_handler(streamOutput), "reconnect_success", OBSOutputReconnectSuccess, this); streamOutput = nullptr; clearMessage(); DecRef(); } }
int PostOffice::release_msg_env(MsgEnv* msg_env_ptr){ int retVal; PCB* blockedPCB; //Clear all the values in the envelope and enqueue it clearMessage(msg_env_ptr); _emptyMessages->enqueue(msg_env_ptr); //Check if there are any processes blocked on message_allocate blockedPCB = g_scheduler->getNextBlockedPCB(BLOCKED_MSG_ALLOC); //If a process is blocked on received, then make that process ready //(just the highest priority process, not all blocked ones) if (blockedPCB != NULL){ g_scheduler->makeReady(blockedPCB); } //Otherwise - or once the PCB is made ready - just return return SUCCESS; }
int QSplashScreen::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: messageChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 1: showMessage((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< const QColor(*)>(_a[3]))); break; case 2: showMessage((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 3: showMessage((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 4: clearMessage(); break; default: ; } _id -= 5; } return _id; }