void MainWindow::viewSessionAndStudent(QTableWidgetItem *) { if (CLSSResultsTableWidget->currentRow() < 0) { return; } QDateTime sdt = CLSSResultsTableWidget->item(CLSSResultsTableWidget->currentRow(), 0)->data(Qt::UserRole).toDateTime(); int num = CLSSResultsTableWidget->item(CLSSResultsTableWidget->currentRow(), 1)->data(Qt::UserRole).toInt(); for (int i = 0; i < SVLSListWidget->count(); ++i) { if (SVLSListWidget->item(i)->data(Qt::UserRole).toDateTime() == sdt) { setCurrentSession(SVLSListWidget->item(i)); SVLCListWidget->setCurrentRow(num); actionSaved_sessions->setChecked(true); mainStackedWidget->setCurrentIndex(6); return; } } for (int i = 0; i < SVLASListWidget->count(); ++i) { if (SVLASListWidget->item(i)->data(Qt::UserRole).toDateTime() == sdt) { setCurrentSession(SVLASListWidget->item(i)); SVLCListWidget->setCurrentRow(num); actionSaved_sessions->setChecked(true); mainStackedWidget->setCurrentIndex(6); return; } } QMessageBox::information(this, tr("iTestServer"), tr("Session not found. This session might have been archived on a different computer.")); }
void MainWindow::restoreSession() { if (!SVSelectedSessionWidget->isEnabled()) { return; } if (current_db_session == NULL) { return; } if (!current_db_session->isArchived()) { return; } ArchivedSession * archived_session = current_db_archivedsessions.value(current_db_session->dateTime()); archived_session->setStatus(ArchivedSession::Remove); current_db_queued_sessions.removeAll(archived_session); current_db_queued_sessions.enqueue(archived_session); Session * session = new Session(archived_session); for (int i = 0; i < SVLASListWidget->count(); ++i) { if (SVLASListWidget->item(i)->data(Qt::UserRole).toDateTime() == current_db_session->dateTime()) { delete SVLASListWidget->item(i); } } current_db_archivedsessions.remove(current_db_session->dateTime()); current_db_sessions.insert(session->dateTime(), session); current_db_session = session; for (int i = 0; i < SVLSListWidget->count(); ++i) { if (SVLSListWidget->item(i)->data(Qt::UserRole).toDateTime() == current_db_session->dateTime()) { delete SVLSListWidget->item(i); } } QListWidgetItem * item = new QListWidgetItem(QString("%1 - %2").arg(session->dateTimeToString()).arg(session->name())); SVLSListWidget->insertItem(0, item); item->setData(Qt::UserRole, session->dateTime()); selectSessionItem(item); setCurrentSession(item); hideArchive(); setDatabaseModified(); }
bool PlatformMediaSessionManager::sessionWillBeginPlayback(PlatformMediaSession& session) { LOG(Media, "PlatformMediaSessionManager::sessionWillBeginPlayback - %p", &session); setCurrentSession(session); PlatformMediaSession::MediaType sessionType = session.mediaType(); SessionRestrictions restrictions = m_restrictions[sessionType]; if (session.state() == PlatformMediaSession::Interrupted && restrictions & InterruptedPlaybackNotPermitted) return false; #if USE(AUDIO_SESSION) if (activeAudioSessionRequired() && !AudioSession::sharedSession().tryToSetActive(true)) return false; #endif if (m_interrupted) endInterruption(PlatformMediaSession::NoFlags); Vector<PlatformMediaSession*> sessions = m_sessions; for (auto* oneSession : sessions) { if (oneSession == &session) continue; if (oneSession->mediaType() == sessionType && restrictions & ConcurrentPlaybackNotPermitted) oneSession->pauseSession(); } updateSessionState(); return true; }
void MainWindow::viewSession(QListWidgetItem * item) { if (item == NULL) { return; } QDateTime sdt = item->data(Qt::UserRole).toDateTime(); for (int i = 0; i < SVLSListWidget->count(); ++i) { if (SVLSListWidget->item(i)->data(Qt::UserRole).toDateTime() == sdt) { setCurrentSession(SVLSListWidget->item(i)); actionSaved_sessions->setChecked(true); mainStackedWidget->setCurrentIndex(6); return; } } for (int i = 0; i < SVLASListWidget->count(); ++i) { if (SVLASListWidget->item(i)->data(Qt::UserRole).toDateTime() == sdt) { setCurrentSession(SVLASListWidget->item(i)); actionSaved_sessions->setChecked(true); mainStackedWidget->setCurrentIndex(6); return; } } QMessageBox::information(this, tr("iTestServer"), tr("Session not found. This session might have been archived on a different computer.")); }
void LoginForm::userChanged() { setCurrentSession(Cache().getLastSession(ui->userInput->text())); if (m_Greeter.inAuthentication()) { m_Greeter.cancelAuthentication(); } if (! ui->userInput->text().isEmpty()) { m_Greeter.authenticate(ui->userInput->text()); ui->passwordInput->setFocus(); } else { ui->userInput->setFocus(); } }
void LoginForm::initialize() { QPixmap icon(":/resources/rqt-2.png"); // This project came from Razor-qt ui->iconLabel->setPixmap(icon.scaled(ui->iconLabel->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation)); ui->hostnameLabel->setText(m_Greeter.hostname()); ui->sessionCombo->setModel(&sessionsModel); addLeaveEntry(power.canShutdown(), "system-shutdown", tr("Shutdown"), "shutdown"); addLeaveEntry(power.canRestart(), "system-reboot", tr("Restart"), "restart"); addLeaveEntry(power.canHibernate(), "system-suspend-hibernate", tr("Hibernate"), "hibernate"); addLeaveEntry(power.canSuspend(), "system-suspend", tr("Suspend"), "suspend"); ui->leaveComboBox->setDisabled(ui->leaveComboBox->count() <= 1); ui->sessionCombo->setCurrentIndex(0); setCurrentSession(m_Greeter.defaultSessionHint()); connect(ui->userInput, SIGNAL(editingFinished()), this, SLOT(userChanged())); connect(ui->leaveComboBox, SIGNAL(activated(int)), this, SLOT(leaveDropDownActivated(int))); connect(&m_Greeter, SIGNAL(showPrompt(QString, QLightDM::Greeter::PromptType)), this, SLOT(onPrompt(QString, QLightDM::Greeter::PromptType))); connect(&m_Greeter, SIGNAL(authenticationComplete()), this, SLOT(authenticationComplete())); ui->passwordInput->setEnabled(false); ui->passwordInput->clear(); if (! m_Greeter.hideUsersHint()) { QStringList knownUsers; QLightDM::UsersModel usersModel; for (int i = 0; i < usersModel.rowCount(QModelIndex()); i++) { knownUsers << usersModel.data(usersModel.index(i, 0), QLightDM::UsersModel::NameRole).toString(); } ui->userInput->setCompleter(new QCompleter(knownUsers)); ui->userInput->completer()->setCompletionMode(QCompleter::InlineCompletion); } QString user = Cache().getLastUser(); if (user.isEmpty()) { user = m_Greeter.selectUserHint(); } ui->userInput->setText(user); userChanged(); }