Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
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
Administrator
linphone-desktop
Commits
ccc61842
Commit
ccc61842
authored
Mar 08, 2018
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(file): add a FileExtractor component (in progress)
parent
a221558d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
196 additions
and
1 deletion
+196
-1
CMakeLists.txt
CMakeLists.txt
+3
-1
FileExtractor.cpp
src/components/file/FileExtractor.cpp
+112
-0
FileExtractor.hpp
src/components/file/FileExtractor.hpp
+81
-0
No files found.
CMakeLists.txt
View file @
ccc61842
...
...
@@ -145,6 +145,7 @@ set(SOURCES
src/components/core/CoreHandlers.cpp
src/components/core/CoreManager.cpp
src/components/core/messages-count-notifier/AbstractMessagesCountNotifier.cpp
src/components/file/FileExtractor.cpp
src/components/notifier/Notifier.cpp
src/components/other/clipboard/Clipboard.cpp
src/components/other/colors/Colors.cpp
...
...
@@ -201,6 +202,7 @@ set(HEADERS
src/components/core/CoreHandlers.hpp
src/components/core/CoreManager.hpp
src/components/core/messages-count-notifier/AbstractMessagesCountNotifier.hpp
src/components/file/FileExtractor.hpp
src/components/notifier/Notifier.hpp
src/components/other/clipboard/Clipboard.hpp
src/components/other/colors/Colors.hpp
...
...
@@ -218,8 +220,8 @@ set(HEADERS
src/components/timeline/TimelineModel.hpp
src/components/url-handlers/UrlHandlers.hpp
src/utils/LinphoneUtils.hpp
src/utils/Utils.hpp
src/utils/QExifImageHeader.h
src/utils/Utils.hpp
)
set
(
TESTS
...
...
src/components/file/FileExtractor.cpp
0 → 100644
View file @
ccc61842
/*
* FileExtractor.cpp
* Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: March 8, 2018
* Author: Ronan Abhamon
*/
#include <mz_strm.h>
#include <QDebug>
#include "FileExtractor.hpp"
// =============================================================================
void
FileExtractor
::
extract
()
{
// TODO.
}
QString
FileExtractor
::
getFile
()
const
{
return
mFile
;
}
void
FileExtractor
::
setFile
(
const
QString
&
file
)
{
if
(
mExtracting
)
{
qWarning
()
<<
QStringLiteral
(
"Unable to set file, a file is extracting."
);
return
;
}
if
(
mFile
!=
file
)
{
mFile
=
file
;
emit
fileChanged
(
mFile
);
}
}
QString
FileExtractor
::
getExtractFolder
()
const
{
return
mExtractFolder
;
}
void
FileExtractor
::
setExtractFolder
(
const
QString
&
extractFolder
)
{
if
(
mExtracting
)
{
qWarning
()
<<
QStringLiteral
(
"Unable to set extract folder, a file is extracting."
);
return
;
}
if
(
mExtractFolder
!=
extractFolder
)
{
mExtractFolder
=
extractFolder
;
emit
extractFolderChanged
(
mExtractFolder
);
}
}
qint64
FileExtractor
::
getReadBytes
()
const
{
return
mReadBytes
;
}
void
FileExtractor
::
setReadBytes
(
qint64
readBytes
)
{
if
(
mReadBytes
!=
readBytes
)
{
mReadBytes
=
readBytes
;
emit
readBytesChanged
(
readBytes
);
}
}
qint64
FileExtractor
::
getTotalBytes
()
const
{
return
mTotalBytes
;
}
void
FileExtractor
::
setTotalBytes
(
qint64
totalBytes
)
{
if
(
mTotalBytes
!=
totalBytes
)
{
mTotalBytes
=
totalBytes
;
emit
totalBytesChanged
(
totalBytes
);
}
}
bool
FileExtractor
::
getExtracting
()
const
{
return
mExtracting
;
}
void
FileExtractor
::
setExtracting
(
bool
extracting
)
{
if
(
mExtracting
!=
extracting
)
{
mExtracting
=
extracting
;
emit
extractingChanged
(
extracting
);
}
}
void
FileExtractor
::
handleReadyData
()
{
// TODO.
}
void
FileExtractor
::
handleExtractFinished
()
{
// TODO.
}
void
FileExtractor
::
handleExtractProgress
(
qint64
readBytes
,
qint64
totalBytes
)
{
// TODO.
Q_UNUSED
(
readBytes
);
Q_UNUSED
(
totalBytes
);
}
src/components/file/FileExtractor.hpp
0 → 100644
View file @
ccc61842
/*
* FileExtractor.hpp
* Copyright (C) 2017-2018 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: March 8, 2018
* Author: Ronan Abhamon
*/
#ifndef FILE_EXTRACTOR_H_
#define FILE_EXTRACTOR_H_
#include <QFile>
// =============================================================================
class
FileExtractor
:
public
QObject
{
Q_OBJECT
;
Q_PROPERTY
(
QString
file
READ
getFile
WRITE
setFile
NOTIFY
fileChanged
);
Q_PROPERTY
(
QString
extractFolder
READ
getExtractFolder
WRITE
setExtractFolder
NOTIFY
extractFolderChanged
);
Q_PROPERTY
(
qint64
readBytes
READ
getReadBytes
NOTIFY
readBytesChanged
);
Q_PROPERTY
(
qint64
totalBytes
READ
getTotalBytes
NOTIFY
totalBytesChanged
);
Q_PROPERTY
(
bool
extracting
READ
getExtracting
NOTIFY
extractingChanged
);
public:
Q_INVOKABLE
void
extract
();
signals:
void
fileChanged
(
const
QString
&
file
);
void
extractFolderChanged
(
const
QString
&
extractFolder
);
void
readBytesChanged
(
qint64
readBytes
);
void
totalBytesChanged
(
qint64
totalBytes
);
void
extractingChanged
(
bool
extracting
);
void
extractFinished
();
void
extractFailed
();
private:
QString
getFile
()
const
;
void
setFile
(
const
QString
&
file
);
QString
getExtractFolder
()
const
;
void
setExtractFolder
(
const
QString
&
extractFolder
);
qint64
getReadBytes
()
const
;
void
setReadBytes
(
qint64
readBytes
);
qint64
getTotalBytes
()
const
;
void
setTotalBytes
(
qint64
totalBytes
);
bool
getExtracting
()
const
;
void
setExtracting
(
bool
extracting
);
void
handleReadyData
();
void
handleExtractFinished
();
void
handleExtractProgress
(
qint64
readBytes
,
qint64
totalBytes
);
QString
mFile
;
QString
mExtractFolder
;
QFile
mDestinationFile
;
qint64
mReadBytes
=
0
;
qint64
mTotalBytes
=
0
;
bool
mExtracting
=
false
;
};
#endif // FILE_EXTRACTOR_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