mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-13 22:32:03 +00:00
Provides user feedback upon improper command-line usage.
This commit is contained in:
parent
7c05b1788e
commit
71c3f58c99
@ -45,7 +45,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
|
||||
|
||||
MainWindow::MainWindow(const QString &fileName) {
|
||||
init();
|
||||
launchFile(fileName);
|
||||
if(!launchFile(fileName)) {
|
||||
setUIPhase(UIPhase::SelectingMachine);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::deleteMachine() {
|
||||
@ -210,11 +212,17 @@ void MainWindow::insertFile(const QString &fileName) {
|
||||
mediaTarget->insert_media(media);
|
||||
}
|
||||
|
||||
void MainWindow::launchFile(const QString &fileName) {
|
||||
bool MainWindow::launchFile(const QString &fileName) {
|
||||
targets = Analyser::Static::GetTargets(fileName.toStdString());
|
||||
if(!targets.empty()) {
|
||||
openFileName = QFileInfo(fileName).fileName();
|
||||
launchMachine();
|
||||
return true;
|
||||
} else {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Unable to open file: " + fileName);
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ class MainWindow : public QMainWindow, public Outputs::Speaker::Speaker::Delegat
|
||||
QAction *insertAction = nullptr;
|
||||
void insertFile(const QString &fileName);
|
||||
|
||||
void launchFile(const QString &fileName);
|
||||
bool launchFile(const QString &fileName);
|
||||
void launchTarget(std::unique_ptr<Analyser::Static::Target> &&);
|
||||
|
||||
void restoreSelections();
|
||||
|
Loading…
x
Reference in New Issue
Block a user