Skip to content

Commit

Permalink
Feature/msfs shortcuts 2 (#133)
Browse files Browse the repository at this point in the history
* Write dialog titles in Title Case

- Common titles:
  * Read Error
  * Write Error
  * Import Error
  * Export Error
  * Logbook Error

* Update

* Fix compilation: add missing includes

* Ensure that aircraft type is non-null initially

- Otherwise rejected during persistence ("type must not be null")

* Remove duplicate keyboard sequences upon settings changes

* Update layout

* Improve Qt key sequence parsing

* Define default keyboard shortcuts
  • Loading branch information
till213 authored Apr 28, 2024
1 parent 48c732d commit b8a0be9
Show file tree
Hide file tree
Showing 34 changed files with 391 additions and 141 deletions.
14 changes: 8 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

### New Features
- Keyboard shortcuts can be defined and triggered within the flight simulator, in order to:
* Toggle recording / replay
* Pause / Stop
* Skip forward/backward
* Skip to begin
* The shortcuts can be defined in the Sky Dolly application settings
- Desktop notifications indicate whether recording has started, paused/resumed and stopped
* Toggle recording (CTRL+R) and replay (CTRL+P)
* Pause (ALT+P) and Stop (CTRL+S)
* Skip forward (CTRL+.) and backward (CTRL+,)
* Skip to begin (CTRL+PageUp) and end (CTRL+PageDown)
* The shortcuts can be defined in the Sky Dolly application settings (no restart required)
- Desktop notifications indicate whether recording has started, paused/resumed or stopped
* In order to make desktop notifications visible when the flight simulator is in fullscreen adjust the corresponding notification rules in the Windows settings (-> Notification Assistant)

### Improvements
- The default logbook name is now *Sky Dolly Logbook*
Expand All @@ -28,6 +29,7 @@
* The default import CSV format is now: *Flightradar24*
* The default export CSV format is now: *Position and attitude*
* Use the Sky Dolly logbook import & export instead
- Dialog titles are now consistently in Title Case and streamlined ("Write Error", "Read Error", ...)

### Bug Fixes
- KML export: the _first_ position point is now properly exported as well
Expand Down
14 changes: 7 additions & 7 deletions src/Kernel/src/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@ struct SettingsPrivate
static constexpr int DefaultPreviewInfoDialogCount {3};
static constexpr int PreviewInfoDialogBase {150};

// TODO Select proper defaults (non-assigned by default in MSFS)
static inline const QKeySequence DefaultRecordShortcut {"Ctrl+R"};
static inline const QKeySequence DefaultReplayShortcut {"Ctrl+E"};
static inline const QKeySequence DefaultPauseShortcut {"Ctrl+P"};
static inline const QKeySequence DefaultReplayShortcut {"Ctrl+P"};
static inline const QKeySequence DefaultPauseShortcut {"Alt+P"};
static inline const QKeySequence DefaultStopShortcut {"Ctrl+S"};
static inline const QKeySequence DefaultBackwardShortcut {"Ctrl+B"};
static inline const QKeySequence DefaultForwardShortcut {"Ctrl+F"};
static inline const QKeySequence DefaultBeginShortcut {"Ctrl+T"};
static inline const QKeySequence DefaultEndShortcut {"Ctrl+Shift+T"};
static inline const QKeySequence DefaultBackwardShortcut {"Ctrl+,"};
static inline const QKeySequence DefaultForwardShortcut {"Ctrl+."};
// TODO Find good default keys that are not already taken my the MSFS default keyboard layout
static inline const QKeySequence DefaultBeginShortcut {"Ctrl+PgUp"};
static inline const QKeySequence DefaultEndShortcut {"Ctrl+PgDown"};
static inline const FlightSimulatorShortcuts DefaultFlightSimulatorShortcuts {
DefaultRecordShortcut,
DefaultReplayShortcut,
Expand Down
2 changes: 0 additions & 2 deletions src/Model/include/Model/AircraftHandleData.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

#include <cstdint>

#include <QtGlobal>
#include <QFlags>
#include "TimeVariableData.h"
#include "ModelLib.h"

Expand Down
2 changes: 1 addition & 1 deletion src/Model/include/Model/AircraftType.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct MODEL_API AircraftType final
* The aircraft type, e.g. "Pitts Special". This is really the SimConnect "container title"
* which is also used to spawn AI aircraft.
*/
QString type;
QString type {"-"};

/*!
* The aircraft category:
Expand Down
3 changes: 0 additions & 3 deletions src/Model/include/Model/EngineData.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@

#include <cstdint>

#include <QtGlobal>
#include <QFlags>

#include "TimeVariableData.h"
#include "ModelLib.h"

Expand Down
3 changes: 0 additions & 3 deletions src/Model/include/Model/LightData.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
#ifndef LIGHTDATA_H
#define LIGHTDATA_H

#include <QtGlobal>
#include <QFlags>

#include "SimType.h"
#include "TimeVariableData.h"
#include "ModelLib.h"
Expand Down
3 changes: 0 additions & 3 deletions src/Model/include/Model/PositionData.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
#ifndef POSITIONDATA_H
#define POSITIONDATA_H

#include <QtGlobal>
#include <QFlags>

#include "TimeVariableData.h"
#include "ModelLib.h"

Expand Down
3 changes: 0 additions & 3 deletions src/Model/include/Model/PrimaryFlightControlData.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@

#include <cstdint>

#include <QtGlobal>
#include <QFlags>

#include "TimeVariableData.h"
#include "ModelLib.h"

Expand Down
3 changes: 0 additions & 3 deletions src/Model/include/Model/SecondaryFlightControlData.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@

#include <cstdint>

#include <QtGlobal>
#include <QFlags>

#include "TimeVariableData.h"
#include "ModelLib.h"

Expand Down
2 changes: 0 additions & 2 deletions src/Model/src/PositionData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <QFlags>

#include "SimType.h"
#include "PositionData.h"

Expand Down
2 changes: 1 addition & 1 deletion src/Persistence/src/Service/DatabaseService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ QString DatabaseService::getNewLogbookPath(QWidget *parent) noexcept
newLogbookPath = logbookDirectoryPath + "/" % fileInfo.fileName() % Const::DotLogbookExtension;
retry = false;
} else {
QMessageBox::information(parent, QCoreApplication::translate("DatabaseService", "Database exists"),
QMessageBox::information(parent, QCoreApplication::translate("DatabaseService", "Database Exists"),
QCoreApplication::translate("DatabaseService", "The logbook %1 already exists. Please choose another path.").arg(QDir::toNativeSeparators(logbookDirectoryPath)));
}
} else {
Expand Down
12 changes: 4 additions & 8 deletions src/PluginManager/src/Connect/AbstractSkyConnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,21 +751,17 @@ void AbstractSkyConnect::tryFirstConnectAndSetup() noexcept
bool AbstractSkyConnect::retryWithReconnect(const std::function<bool()> &func)
{
int nofAttempts {2};
bool ok {true};
while (nofAttempts > 0) {
bool ok {false};
while (!ok && nofAttempts > 0) {
ok = func();
--nofAttempts;
if (!ok && nofAttempts > 0) {
#ifdef DEBUG
qDebug() << "AbstractSkyConnect::retryWithReconnect: previous connection is stale, RETRY with reconnect" << nofAttempts << "more time(s)...";
#endif
// Automatically reconnect in case the server crashed
// previously (without sending a "quit" message)
if (!connectWithSim()) {
nofAttempts = 0;
}
} else {
nofAttempts = 0;
connectWithSim();
--nofAttempts;
}
}
return ok;
Expand Down
2 changes: 1 addition & 1 deletion src/PluginManager/src/Flight/FlightExportPluginBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ bool FlightExportPluginBase::exportFlight(const Flight &flight, const QString &f
}
}
} else {
QMessageBox::critical(PluginBase::getParentWidget(), tr("Export error"), tr("An error occured during export into file %1.").arg(QDir::toNativeSeparators(filePath)));
QMessageBox::critical(PluginBase::getParentWidget(), tr("Export Error"), tr("An error occured during export into file %1.").arg(QDir::toNativeSeparators(filePath)));
}

return ok;
Expand Down
6 changes: 3 additions & 3 deletions src/PluginManager/src/Flight/FlightImportPluginBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ bool FlightImportPluginBase::importFlights(Flight &flight) noexcept
qDebug() << QFileInfo(selectedPath).fileName() << "import" << (ok ? "SUCCESS" : "FAIL") << "in" << timer.elapsed() << "ms";
#endif
if (!ok && !baseSettings.isImportDirectoryEnabled()) {
QMessageBox::critical(PluginBase::getParentWidget(), tr("Import error"), tr("The file %1 could not be imported.").arg(selectedPath));
QMessageBox::critical(PluginBase::getParentWidget(), tr("Import Error"), tr("The file %1 could not be imported.").arg(selectedPath));
}
} else {
QMessageBox::critical(PluginBase::getParentWidget(), tr("Import error"),
QMessageBox::critical(PluginBase::getParentWidget(), tr("Import Error"),
tr("The selected aircraft '%1' is not a known aircraft in the logbook. "
"Check for spelling errors or record a flight with this aircraft first.").arg(d->selectedAircraftType.type));
}
Expand Down Expand Up @@ -401,7 +401,7 @@ void FlightImportPluginBase::confirmImportError(const QString &filePath, bool &i
messageBox->setIcon(QMessageBox::Critical);
QPushButton *proceedButton = messageBox->addButton(tr("&Proceed"), QMessageBox::AcceptRole);
QPushButton *ignoreAllButton = messageBox->addButton(tr("&Ignore All Failures"), QMessageBox::YesRole);
messageBox->setWindowTitle(tr("Import Failure"));
messageBox->setWindowTitle(tr("Import Error"));
messageBox->setText(tr("The file %1 could not be imported. Do you want to proceed with the remaining files in directory %2?").arg(fileInfo.fileName(), fileInfo.dir().dirName()));
messageBox->setInformativeText(tr("Aborting will keep the already successfully imported flights and aircraft."));
messageBox->setStandardButtons(QMessageBox::Cancel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ bool LocationExportPluginBase::exportLocations(const std::vector<Location> &loca
QDesktopServices::openUrl(QUrl(fileUrl));
}
} else {
QMessageBox::critical(PluginBase::getParentWidget(), tr("Export error"), tr("An error occured during export into file %1.").arg(QDir::toNativeSeparators(filePath)));
QMessageBox::critical(PluginBase::getParentWidget(), tr("Export Error"), tr("An error occured during export into file %1.").arg(QDir::toNativeSeparators(filePath)));
}

return ok;
Expand Down
4 changes: 2 additions & 2 deletions src/PluginManager/src/Location/LocationImportPluginBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ bool LocationImportPluginBase::importLocations() noexcept
qDebug() << QFileInfo(selectedPath).fileName() << "import" << (ok ? "SUCCESS" : "FAIL") << "in" << timer.elapsed() << "ms";
#endif
if (!ok && !baseSettings.isImportDirectoryEnabled()) {
QMessageBox::critical(PluginBase::getParentWidget(), tr("Import error"), tr("The file %1 could not be imported.").arg(selectedPath));
QMessageBox::critical(PluginBase::getParentWidget(), tr("Import Error"), tr("The file %1 could not be imported.").arg(selectedPath));
}

}
Expand Down Expand Up @@ -143,7 +143,7 @@ bool LocationImportPluginBase::importLocations(const QStringList &filePaths) noe
messageBox->setIcon(QMessageBox::Critical);
QPushButton *proceedButton = messageBox->addButton(tr("&Proceed"), QMessageBox::AcceptRole);
QPushButton *ignoreAllButton = messageBox->addButton(tr("&Ignore All Failures"), QMessageBox::YesRole);
messageBox->setWindowTitle(tr("Import failure"));
messageBox->setWindowTitle(tr("Import Error"));
messageBox->setText(tr("The file %1 could not be imported. Do you want to proceed with the remaining files in directory %2?").arg(fileInfo.fileName(), fileInfo.dir().dirName()));
messageBox->setInformativeText(tr("Aborting will keep the already successfully imported flights and aircraft."));
messageBox->setStandardButtons(QMessageBox::Cancel);
Expand Down
2 changes: 1 addition & 1 deletion src/PluginManager/src/Module/AbstractModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void AbstractModule::onRecordingStopped() noexcept
if (!ok) {
const PersistenceManager &persistenceManager = PersistenceManager::getInstance();
const QString logbookPath = QDir::toNativeSeparators(persistenceManager.getLogbookPath());
QMessageBox::critical(getWidget(), tr("Flight error"), tr("The flight could not be stored into the logbook %1.").arg(logbookPath));
QMessageBox::critical(getWidget(), tr("Write Error"), tr("The flight could not be stored into the logbook %1.").arg(logbookPath));
}
}

Expand Down
Loading

0 comments on commit b8a0be9

Please sign in to comment.