Esempio n. 1
0
void CGameServer::RestartLevel()
{
	SetLoading(false);
	AllowPrecaches();
	DestroyAllEntities(tvector<tstring>(), true);
	m_bRestartLevel = true;
	Game()->SetupGame(CVar::GetCVarValue("game_mode"));
	m_bRestartLevel = false;
	SetLoading(false);
}
Esempio n. 2
0
void ClientHandler::OnLoadStart(CefRefPtr<CefBrowser> browser,
                                CefRefPtr<CefFrame> frame) {
    REQUIRE_UI_THREAD();
    if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
        SetLoading(true);
    }
}
void TrackSelectionDialog::accept() {
  if (save_on_close_) {
    SetLoading(tr("Saving tracks") + "...");

    // Save tags in the background
    QFuture<void> future =
        QtConcurrent::run(&TrackSelectionDialog::SaveData, data_);
    QFutureWatcher<void>* watcher = new QFutureWatcher<void>(this);
    watcher->setFuture(future);
    connect(watcher, SIGNAL(finished()), SLOT(AcceptFinished()));

    return;
  }

  QDialog::accept();

  for (const Data& data : data_) {
    if (data.pending_ || data.results_.isEmpty() || data.selected_result_ == -1)
      continue;

    const Song& new_metadata = data.results_[data.selected_result_];

    emit SongChosen(data.original_song_, new_metadata);
  }
}
Esempio n. 4
0
void EditTagDialog::SetSongsFinished() {
  QFutureWatcher<QList<Data> >* watcher =
      dynamic_cast<QFutureWatcher<QList<Data> >*>(sender());
  if (!watcher) return;
  watcher->deleteLater();

  if (!SetLoading(QString())) return;

  data_ = watcher->result();
  if (data_.count() == 0) {
    // If there were no valid songs, disable everything
    ui_->song_list->setEnabled(false);
    ui_->tab_widget->setEnabled(false);

    // Show a summary with empty information
    UpdateSummaryTab(Song());
    ui_->tab_widget->setCurrentWidget(ui_->summary_tab);

    SetSongListVisibility(false);
    return;
  }

  // Add the filenames to the list
  for (const Data& data : data_) {
    ui_->song_list->addItem(data.current_.basefilename());
  }

  // Select all
  ui_->song_list->setCurrentRow(0);
  ui_->song_list->selectAll();

  // Hide the list if there's only one song in it
  SetSongListVisibility(data_.count() != 1);
}
Esempio n. 5
0
void ClientHandler::OnLoadEnd(CefRefPtr<CefBrowser> browser,
                              CefRefPtr<CefFrame> frame,
                              int httpStatusCode) {
    REQUIRE_UI_THREAD();
    if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
        SetLoading(false);
    }
}
void ClientHandler::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
                                         bool isLoading,
                                         bool canGoBack,
                                         bool canGoForward) {
  REQUIRE_UI_THREAD();
  SetLoading(isLoading);
  SetNavState(canGoBack, canGoForward);
}
void TrackSelectionDialog::AcceptFinished() {
  QFutureWatcher<void>* watcher = dynamic_cast<QFutureWatcher<void>*>(sender());
  if (!watcher) return;
  watcher->deleteLater();

  SetLoading(QString());
  QDialog::accept();
}
Esempio n. 8
0
void ClientHandler::OnLoadStart(CefRefPtr<CefBrowser> browser,
                                CefRefPtr<CefFrame> frame) {
  REQUIRE_UI_THREAD();

  if (m_BrowserHwnd == browser->GetWindowHandle() && frame->IsMain()) {
    // We've just started loading a page
    SetLoading(true);
  }
}
Esempio n. 9
0
void EditTagDialog::accept() {
  // Show the loading indicator
  if (!SetLoading(tr("Saving tracks") + "...")) return;

  // Save tags in the background
  QFuture<void> future =
      QtConcurrent::run(this, &EditTagDialog::SaveData, data_);
  QFutureWatcher<void>* watcher = new QFutureWatcher<void>(this);
  watcher->setFuture(future);
  connect(watcher, SIGNAL(finished()), SLOT(AcceptFinished()));
}
Esempio n. 10
0
void EditTagDialog::accept() {
  // Show the loading indicator
  if (!SetLoading(tr("Saving tracks") + "...")) return;

  abortRequested_ = false;
  ui_->abortSaveButton->setEnabled(true);

  // Save tags in the background
  QFuture<void> future =
      QtConcurrent::run(this, &EditTagDialog::SaveData, data_);
  NewClosure(future, this, SLOT(AcceptFinished()));
}
Esempio n. 11
0
void EditTagDialog::AcceptFinished() {
  if (!SetLoading(QString())) return;

  // Ask library to rescan the edited tracks to update
  // GUI.
  SongList editedTracks;
  for(Data d: data_) {
      editedTracks << d.current_;
  }
  app_->library()->Rescan(editedTracks);

  QDialog::accept();
}
void ClientHandler::OnLoadEnd(CefRefPtr<CefBrowser> browser,
                              CefRefPtr<CefFrame> frame,
                              int httpStatusCode) {
  REQUIRE_UI_THREAD();

  if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
    // We've just finished loading a page
    SetLoading(false);

    // Continue the DOM test.
    if (frame->GetURL() == dom_test::kTestUrl)
      dom_test::OnLoadEnd(browser);
  }
}
Esempio n. 13
0
void ClientHandler::OnLoadEnd(CefRefPtr<CefBrowser> browser,
                              CefRefPtr<CefFrame> frame,
                              int httpStatusCode) {
  REQUIRE_UI_THREAD();

  if (m_BrowserHwnd == browser->GetWindowHandle() && frame->IsMain()) {
    // We've just finished loading a page
    SetLoading(false);

    CefRefPtr<CefDOMVisitor> visitor = GetDOMVisitor(frame->GetURL());
    if (visitor.get())
      frame->VisitDOM(visitor);
  }
}
Esempio n. 14
0
void EditTagDialog::SetSongs(const SongList& s, const PlaylistItemList& items) {
  // Show the loading indicator
  if (!SetLoading(tr("Loading tracks") + "...")) return;

  data_.clear();
  playlist_items_ = items;
  ui_->song_list->clear();

  // Reload tags in the background
  QFuture<QList<Data>> future =
      QtConcurrent::run(this, &EditTagDialog::LoadData, s);
  QFutureWatcher<QList<Data>>* watcher = new QFutureWatcher<QList<Data>>(this);
  watcher->setFuture(future);
  connect(watcher, SIGNAL(finished()), SLOT(SetSongsFinished()));
}
void ClientHandler::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
                                         bool isLoading,
                                         bool canGoBack,
                                         bool canGoForward) {
  CEF_REQUIRE_UI_THREAD();

  SetLoading(isLoading);
  SetNavState(canGoBack, canGoForward);

  if (!isLoading) {
    // Continue the DOM test.
    if (browser->GetMainFrame()->GetURL() == dom_test::kTestUrl)
      dom_test::OnLoadEnd(browser);
  }
}
Esempio n. 16
0
void EditTagDialog::SetSongs(const SongList& s, const PlaylistItemList& items) {
  // Show the loading indicator
  if (!SetLoading(tr("Loading tracks") + "...")) return;

  data_.clear();
  playlist_items_ = items;
  ui_->song_list->clear();

  // Reload tags in the background
  QFuture<QList<Data>> future =
      QtConcurrent::run(this, &EditTagDialog::LoadData, s);
  NewClosure(future, this,
             SLOT(SetSongsFinished(QFuture<QList<EditTagDialog::Data>>)),
             future);
}
Esempio n. 17
0
void BlockStream::OpenInit(dword mode, int64 _filesize) {
	streamsize = _filesize;
	style = STRM_READ|STRM_SEEK;
	SetLoading();
	mode &= ~SHAREMASK;
	if(mode != READ) {
		style |= STRM_WRITE;
		SetStoring();
	}
	rdlim = wrlim = ptr = buffer;
	pos = 0;
	pagepos = -1;
	pagedirty = false;
	if(!buffer)
		SetBufferSize(4096);
	if(mode == APPEND) SeekEnd();
}
TrackSelectionDialog::TrackSelectionDialog(QWidget* parent)
    : QDialog(parent), ui_(new Ui_TrackSelectionDialog), save_on_close_(false) {
  // Setup dialog window
  ui_->setupUi(this);

  connect(ui_->song_list, SIGNAL(currentRowChanged(int)), SLOT(UpdateStack()));
  connect(ui_->results,
          SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
          SLOT(ResultSelected()));

  ui_->splitter->setSizes(QList<int>() << 200 << width() - 200);
  SetLoading(QString());

  // Add the next/previous buttons
  previous_button_ =
      new QPushButton(IconLoader::Load("go-previous", IconLoader::Base), 
                      tr("Previous"), this);
  next_button_ = new QPushButton(IconLoader::Load("go-next", IconLoader::Base), 
                                 tr("Next"), this);
  ui_->button_box->addButton(previous_button_, QDialogButtonBox::ResetRole);
  ui_->button_box->addButton(next_button_, QDialogButtonBox::ResetRole);

  connect(previous_button_, SIGNAL(clicked()), SLOT(PreviousSong()));
  connect(next_button_, SIGNAL(clicked()), SLOT(NextSong()));

  // Set some shortcuts for the buttons
  new QShortcut(QKeySequence::Back, previous_button_, SLOT(click()));
  new QShortcut(QKeySequence::Forward, next_button_, SLOT(click()));
  new QShortcut(QKeySequence::MoveToPreviousPage, previous_button_,
                SLOT(click()));
  new QShortcut(QKeySequence::MoveToNextPage, next_button_, SLOT(click()));

  // Resize columns
  ui_->results->setColumnWidth(0, 50);   // Track column
  ui_->results->setColumnWidth(1, 50);   // Year column
  ui_->results->setColumnWidth(2, 160);  // Title column
  ui_->results->setColumnWidth(3, 160);  // Artist column
  ui_->results->setColumnWidth(4, 160);  // Album column
}