Skip to content

Commit

Permalink
feat(mainwindow): update companion new session
Browse files Browse the repository at this point in the history
Open a new session when it's an unchanged temporary buffer (i.e. unsaved, the content is exactly the template), otherwise don't open a new session.
  • Loading branch information
ouuan committed Dec 14, 2019
1 parent 9a3662f commit 1b1058a
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/mainwindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,8 @@ void MainWindow::createAndAttachServer() {
}

void MainWindow::applyCompanion(Network::CompanionData data) {
auto res = QMessageBox::warning(this, tr("New Session?"),
tr("A request from competitive companion received,\nopen a new session?"),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes);

if (res == QMessageBox::Yes) {
launchSession(true);
if (openFile == nullptr && !isTextChanged()) {
launchSession(false);
QString meta = data.toMetaString();
meta.prepend("\n");
meta.append("Powered by CP Editor (https://github.com/coder3101/cp-editor2)");
Expand Down

0 comments on commit 1b1058a

Please sign in to comment.