Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bipscript
ide
Commits
a5a390e7
Commit
a5a390e7
authored
Mar 05, 2021
by
jhammen
Browse files
CLI attempt to open project from path arg
parent
6b5c5707
Changes
5
Hide whitespace changes
Inline
Side-by-side
main.cpp
View file @
a5a390e7
...
...
@@ -24,7 +24,7 @@ int main(int argc, char *argv[]) {
qRegisterMetaType
<
Position
>
(
"Position"
);
MainWindow
w
;
MainWindow
w
(
0
,
argc
>
1
?
argv
[
1
]
:
nullptr
)
;
w
.
showMaximized
();
return
a
.
exec
();
...
...
mainwindow.cpp
View file @
a5a390e7
...
...
@@ -30,7 +30,7 @@
#include <QLabel>
#include <QTime>
MainWindow
::
MainWindow
(
QWidget
*
parent
)
MainWindow
::
MainWindow
(
QWidget
*
parent
,
const
char
*
folder
)
:
QMainWindow
(
parent
),
projectList
(
ProjectList
::
instance
()),
audioEngine
(
AudioEngine
::
instance
()),
transportPosition
(
0
),
ui
(
new
Ui
::
MainWindow
),
timeWidget
(
this
),
bbtWidget
(
this
)
{
...
...
@@ -68,6 +68,10 @@ MainWindow::MainWindow(QWidget *parent)
SLOT
(
handleLink
(
EditorLocation
&
)));
projectList
.
load
();
if
(
folder
)
{
// from CLI
QDir
dir
(
folder
);
projectList
.
select
(
dir
.
canonicalPath
());
}
if
(
projectList
.
currentExists
())
{
loadProject
();
}
else
{
...
...
mainwindow.h
View file @
a5a390e7
...
...
@@ -37,7 +37,7 @@ class MainWindow;
class
MainWindow
:
public
QMainWindow
{
Q_OBJECT
public:
explicit
MainWindow
(
QWidget
*
parent
=
0
);
explicit
MainWindow
(
QWidget
*
parent
=
0
,
const
char
*
project
=
nullptr
);
~
MainWindow
();
void
closeEvent
(
QCloseEvent
*
event
);
private
slots
:
...
...
projectlist.cpp
View file @
a5a390e7
...
...
@@ -137,6 +137,12 @@ bool ProjectList::open(int index) {
return
false
;
}
bool
ProjectList
::
select
(
QString
path
)
{
int
index
=
findProject
(
path
);
return
index
==
-
1
?
false
:
open
(
index
);
}
QString
ProjectList
::
commonRoot
(
QString
&
path1
,
QString
&
path2
)
{
QStringList
list1
=
path1
.
split
(
QDir
::
separator
());
QStringList
list2
=
path2
.
split
(
QDir
::
separator
());
...
...
projectlist.h
View file @
a5a390e7
...
...
@@ -76,5 +76,6 @@ class ProjectList {
void
removeProject
(
int
index
);
bool
isOpen
(
int
index
)
{
return
index
==
openIndex
;
}
bool
open
(
int
index
);
bool
select
(
QString
path
);
};
#endif // PROJECTLIST_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment