Skip to content

Commit 63d8bc1

Browse files
committed
set emergency button
1 parent 2bc8c2e commit 63d8bc1

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/TConsole.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,11 @@ TConsole::TConsole(Host* pH, const QString& name, const ConsoleType type, QWidge
338338
replayButton->setMaximumSize(QSize(30, 30));
339339
replayButton->setSizePolicy(sizePolicy5);
340340
replayButton->setFocusPolicy(Qt::NoFocus);
341-
replayButton->setIcon(QIcon(qsl(":/icons/media-tape.png")));
341+
342+
QIcon replayIcon;
343+
replayIcon.addPixmap(QPixmap(qsl(":/icons/media-tape.png")), QIcon::Normal, QIcon::Off);
344+
replayIcon.addPixmap(QPixmap(qsl(":/icons/media-tape-red-cross.png")), QIcon::Normal, QIcon::On);
345+
replayButton->setIcon(replayIcon);
342346
//: Button tooltip for the replay recording toggle button
343347
replayButton->setToolTip(utils::richText(tr("Start recording of replay")));
344348
connect(replayButton, &QAbstractButton::clicked, this, &TConsole::slot_toggleReplayRecording);
@@ -349,7 +353,8 @@ TConsole::TConsole(Host* pH, const QString& name, const ConsoleType type, QWidge
349353
logButton->setCheckable(true);
350354
logButton->setSizePolicy(sizePolicy5);
351355
logButton->setFocusPolicy(Qt::NoFocus);
352-
logButton->setToolTip(utils::richText(tr("Toggle logging")));
356+
//: Button tooltip for the logging button
357+
logButton->setToolTip(utils::richText(tr("Start logging game output to log file.")));
353358

354359
QIcon logIcon;
355360
logIcon.addPixmap(QPixmap(qsl(":/icons/folder-downloads.png")), QIcon::Normal, QIcon::Off);
@@ -400,7 +405,12 @@ TConsole::TConsole(Host* pH, const QString& name, const ConsoleType type, QWidge
400405

401406
emergencyStop->setMinimumSize(QSize(30, 30));
402407
emergencyStop->setMaximumSize(QSize(30, 30));
403-
emergencyStop->setIcon(QIcon(qsl(":/icons/edit-bomb.png")));
408+
409+
QIcon emergencyIcon;
410+
emergencyIcon.addPixmap(QPixmap(qsl(":/icons/edit-bomb.png")), QIcon::Normal, QIcon::Off);
411+
emergencyIcon.addPixmap(QPixmap(qsl(":/icons/red-bomb.png")), QIcon::Normal, QIcon::On);
412+
emergencyStop->setIcon(emergencyIcon);
413+
404414
emergencyStop->setSizePolicy(sizePolicy4);
405415
emergencyStop->setFocusPolicy(Qt::NoFocus);
406416
emergencyStop->setCheckable(true);
@@ -879,14 +889,17 @@ void TConsole::slot_toggleReplayRecording()
879889
mReplayFile.setFileName(mLogFileName);
880890
if (!mReplayFile.open(QIODevice::WriteOnly)) {
881891
qWarning() << "TConsole: failed to open replay file for writing:" << mReplayFile.errorString();
892+
mRecordReplay = false;
893+
//: Informational message displayed when replay recording file could not be opened
894+
printSystemMessage(tr("Failed to open replay recording file for writing.") % QChar::LineFeed);
895+
return;
882896
}
883897
if (mudlet::scmRunTimeQtVersion >= QVersionNumber(5, 13, 0)) {
884898
mReplayStream.setVersion(mudlet::scmQDataStreamFormat_5_12);
885899
}
886900
mReplayStream.setDevice(&mReplayFile);
887901
mpHost->mTelnet.recordReplay();
888902
printSystemMessage(tr("Replay recording has started. File: %1").arg(mReplayFile.fileName()) % QChar::LineFeed);
889-
replayButton->setIcon(QIcon(qsl(":/icons/media-tape-red-cross.png")));
890903
//: Button tooltip for the replay recording toggle button
891904
replayButton->setToolTip(utils::richText(tr("Stop recording of replay")));
892905
} else {
@@ -898,7 +911,6 @@ void TConsole::slot_toggleReplayRecording()
898911
//: Informational message displayed when replay recording is stopped
899912
printSystemMessage(tr("Replay recording has been stopped. File: %1").arg(mReplayFile.fileName()) % QChar::LineFeed);
900913
}
901-
replayButton->setIcon(QIcon(qsl(":/icons/media-tape.png")));
902914
//: Button tooltip for the replay recording toggle button
903915
replayButton->setToolTip(utils::richText(tr("Start recording of replay")));
904916
}
@@ -1913,10 +1925,8 @@ void TConsole::slot_stopAllItems(bool b)
19131925
{
19141926
if (b) {
19151927
mpHost->stopAllTriggers();
1916-
emergencyStop->setIcon(QIcon(qsl(":/icons/red-bomb.png")));
19171928
} else {
19181929
mpHost->reenableAllTriggers();
1919-
emergencyStop->setIcon(QIcon(qsl(":/icons/edit-bomb.png")));
19201930
}
19211931
}
19221932

0 commit comments

Comments
 (0)