support multiple file opening on launch

master
zetaPRIME 2022-03-13 22:32:12 -04:00
parent 8db7adfa74
commit 22f5b0502d
3 changed files with 24 additions and 10 deletions

15
notes
View File

@ -33,16 +33,17 @@ parameters {
TODO {
immediate frontburner {
multi-window accounting {
- keep list of active windows
- quit (just trigger close on all sequentially)
- if opening project already in other window, focus/flash that window
- open project from command line
- IPC to open/new window in existing instance
revert action
rewrite signaling using CBOR to support file lists
support opening multiple files at once
(if no successes, open new project window)
- xdg mime package + desktop file association
change %f to %F once list support is implemented
array?
}
revert action
clear song info on loading template?
user-defined default template

View File

@ -78,8 +78,21 @@ int main(int argc, char *argv[]) {
Xybrid::Config::PluginRegistry::init();
Xybrid::Audio::AudioEngine::init();
auto* w = new Xybrid::MainWindow(nullptr, fileName);
w->show();
bool opn = false;
for (auto& fn : args) {
QFileInfo fi(fn);
if (!fi.exists()) continue;
auto fileName = fi.absoluteFilePath();
auto w = new Xybrid::MainWindow(nullptr, fileName);
if (w->getProject()) { w->show(); opn = true; }
else (w->deleteLater());
}
if (!opn) { // always show one window on launch
auto* w = new Xybrid::MainWindow(nullptr);
w->show();
}
// hook up exit event
QObject::connect(&a, &QCoreApplication::aboutToQuit, [] {

View File

@ -502,7 +502,7 @@ MainWindow::MainWindow(QWidget *parent, const QString& fileName) :
selectSampleForEditing(nullptr); // init blank
bool isFirst = openWindows.empty();
bool isFirst = false;//openWindows.empty();
openWindows.insert(this);
if (fileName.isEmpty()) {