Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
00e14ded
Commit
00e14ded
authored
Mar 13, 2015
by
crashmatt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mavlink-ftp : Initial upload file added to file view
parent
e9f6640d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
5 deletions
+47
-5
QGCUASFileView.cc
src/ui/QGCUASFileView.cc
+28
-1
QGCUASFileView.h
src/ui/QGCUASFileView.h
+2
-0
QGCUASFileView.ui
src/ui/QGCUASFileView.ui
+17
-4
No files found.
src/ui/QGCUASFileView.cc
View file @
00e14ded
...
...
@@ -33,7 +33,8 @@ QGCUASFileView::QGCUASFileView(QWidget *parent, QGCUASFileManager *manager) :
QWidget
(
parent
),
_manager
(
manager
),
_listInProgress
(
false
),
_downloadInProgress
(
false
)
_downloadInProgress
(
false
),
_uploadInProgress
(
false
)
{
_ui
.
setupUi
(
this
);
...
...
@@ -48,6 +49,8 @@ QGCUASFileView::QGCUASFileView(QWidget *parent, QGCUASFileManager *manager) :
Q_ASSERT
(
success
);
success
=
connect
(
_ui
.
downloadButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
_downloadFile
()));
Q_ASSERT
(
success
);
success
=
connect
(
_ui
.
uploadButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
_uploadFile
()));
Q_ASSERT
(
success
);
success
=
connect
(
_ui
.
treeWidget
,
SIGNAL
(
currentItemChanged
(
QTreeWidgetItem
*
,
QTreeWidgetItem
*
)),
this
,
SLOT
(
_currentItemChanged
(
QTreeWidgetItem
*
,
QTreeWidgetItem
*
)));
Q_ASSERT
(
success
);
}
...
...
@@ -90,6 +93,29 @@ void QGCUASFileView::_downloadFile(void)
}
}
/// @brief uploads a file into the currently selected directory the tree view
void
QGCUASFileView
::
_uploadFile
(
void
)
{
Q_ASSERT
(
!
_uploadInProgress
);
_ui
.
statusText
->
clear
();
// And now download to this location
QString
path
;
QTreeWidgetItem
*
item
=
_ui
.
treeWidget
->
currentItem
();
if
(
item
&&
item
->
type
()
!=
_typeDir
)
{
return
;
}
QString
targetDir
=
item
->
text
(
0
);
QString
uploadFromHere
=
QGCFileDialog
::
getOpenFileName
(
this
,
tr
(
"Upload File"
),
QDir
::
homePath
());
_manager
->
uploadPath
(
targetDir
,
uploadFromHere
);
}
/// @brief Called when length of file being downloaded is known.
void
QGCUASFileView
::
_downloadLength
(
unsigned
int
length
)
{
...
...
@@ -267,6 +293,7 @@ void QGCUASFileView::_currentItemChanged(QTreeWidgetItem* current, QTreeWidgetIt
Q_UNUSED
(
previous
);
// FIXME: Should not enable when downloading
_ui
.
downloadButton
->
setEnabled
(
current
?
(
current
->
type
()
==
_typeFile
)
:
false
);
_ui
.
uploadButton
->
setEnabled
(
current
?
(
current
->
type
()
==
_typeDir
)
:
false
);
}
void
QGCUASFileView
::
_requestDirectoryList
(
const
QString
&
dir
)
...
...
src/ui/QGCUASFileView.h
View file @
00e14ded
...
...
@@ -47,6 +47,7 @@ private slots:
void
_listComplete
(
void
);
void
_downloadFile
(
void
);
void
_uploadFile
(
void
);
void
_downloadLength
(
unsigned
int
length
);
void
_downloadProgress
(
unsigned
int
length
);
void
_downloadErrorMessage
(
const
QString
&
msg
);
...
...
@@ -74,6 +75,7 @@ private:
bool
_listInProgress
;
///< Indicates that a listDirectory command is in progress
bool
_downloadInProgress
;
///< Indicates that a downloadPath command is in progress
bool
_uploadInProgress
;
///< Indicates that a upload command is in progress
};
#endif // QGCUASFILEVIEW_H
src/ui/QGCUASFileView.ui
View file @
00e14ded
...
...
@@ -6,7 +6,7 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
2
00
</width>
<width>
2
16
</width>
<height>
518
</height>
</rect>
</property>
...
...
@@ -14,7 +14,7 @@
<string>
Form
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"
3
"
column=
"1"
>
<item
row=
"
5
"
column=
"1"
>
<widget
class=
"QPushButton"
name=
"listFilesButton"
>
<property
name=
"text"
>
<string>
List Files
</string>
...
...
@@ -33,6 +33,9 @@
</item>
<item
row=
"0"
column=
"0"
colspan=
"3"
>
<widget
class=
"QTreeWidget"
name=
"treeWidget"
>
<property
name=
"contextMenuPolicy"
>
<enum>
Qt::NoContextMenu
</enum>
</property>
<property
name=
"headerHidden"
>
<bool>
true
</bool>
</property>
...
...
@@ -43,7 +46,7 @@
</column>
</widget>
</item>
<item
row=
"
3
"
column=
"2"
>
<item
row=
"
5
"
column=
"2"
>
<widget
class=
"QPushButton"
name=
"downloadButton"
>
<property
name=
"enabled"
>
<bool>
false
</bool>
...
...
@@ -53,7 +56,7 @@
</property>
</widget>
</item>
<item
row=
"
2
"
column=
"0"
colspan=
"3"
>
<item
row=
"
3
"
column=
"0"
colspan=
"3"
>
<widget
class=
"QLabel"
name=
"statusText"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Preferred"
>
...
...
@@ -66,6 +69,16 @@
</property>
</widget>
</item>
<item
row=
"4"
column=
"2"
>
<widget
class=
"QPushButton"
name=
"uploadButton"
>
<property
name=
"enabled"
>
<bool>
false
</bool>
</property>
<property
name=
"text"
>
<string>
Upload File
</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
...
...
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