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
Marco Bubke
flatpak-qt-creator
Commits
83f505d9
Commit
83f505d9
authored
Apr 20, 2010
by
ck
Browse files
Maemo: Add model for future package contents view.
No functional changes for now. Reviewed-by: kh1
parent
9555ff02
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/plugins/qt4projectmanager/qt-maemo/maemopackagecontents.cpp
0 → 100644
View file @
83f505d9
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "maemopackagecontents.h"
#include "maemopackagecreationstep.h"
namespace
Qt4ProjectManager
{
namespace
Internal
{
MaemoPackageContents
::
MaemoPackageContents
(
MaemoPackageCreationStep
*
packageStep
)
:
QAbstractTableModel
(
packageStep
),
m_packageStep
(
packageStep
),
m_modified
(
true
)
// TODO: Has to come from settings
{
}
MaemoPackageContents
::
Deployable
MaemoPackageContents
::
deployableAt
(
int
row
)
const
{
Q_ASSERT
(
row
>=
0
&&
row
<
rowCount
());
return
row
==
0
?
Deployable
(
m_packageStep
->
localExecutableFilePath
(),
m_packageStep
->
remoteExecutableFilePath
())
:
m_deployables
.
at
(
row
-
1
);
}
int
MaemoPackageContents
::
rowCount
(
const
QModelIndex
&
parent
)
const
{
return
parent
.
isValid
()
?
0
:
m_deployables
.
count
()
+
1
;
}
int
MaemoPackageContents
::
columnCount
(
const
QModelIndex
&
parent
)
const
{
return
parent
.
isValid
()
?
0
:
2
;
}
QVariant
MaemoPackageContents
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
if
(
!
index
.
isValid
()
||
role
!=
Qt
::
DisplayRole
||
index
.
row
()
>=
rowCount
())
return
QVariant
();
const
Deployable
&
d
=
deployableAt
(
index
.
row
());
return
index
.
column
()
==
0
?
d
.
localFilePath
:
d
.
remoteFilePath
;
}
}
// namespace Qt4ProjectManager
}
// namespace Internal
src/plugins/qt4projectmanager/qt-maemo/maemopackagecontents.h
0 → 100644
View file @
83f505d9
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef MAEMOPACKAGECONTENTS_H
#define MAEMOPACKAGECONTENTS_H
#include <QtCore/QAbstractTableModel>
#include <QtCore/QList>
#include <QtCore/QString>
namespace
Qt4ProjectManager
{
namespace
Internal
{
class
MaemoPackageCreationStep
;
class
MaemoPackageContents
:
public
QAbstractTableModel
{
public:
struct
Deployable
{
Deployable
(
const
QString
&
localFilePath
,
const
QString
&
remoteFilePath
)
:
localFilePath
(
localFilePath
),
remoteFilePath
(
remoteFilePath
)
{}
QString
localFilePath
;
QString
remoteFilePath
;
};
virtual
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
;
MaemoPackageContents
(
MaemoPackageCreationStep
*
packageStep
);
Deployable
deployableAt
(
int
row
)
const
;
bool
isModified
()
const
{
return
m_modified
;
}
void
setUnModified
()
{
m_modified
=
false
;
}
// TODO: to/from map
private:
virtual
int
columnCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
;
virtual
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
;
// TODO: setData
private:
const
MaemoPackageCreationStep
*
const
m_packageStep
;
QList
<
Deployable
>
m_deployables
;
bool
m_modified
;
};
}
// namespace Qt4ProjectManager
}
// namespace Internal
#endif // MAEMOPACKAGECONTENTS_H
src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp
View file @
83f505d9
...
...
@@ -43,6 +43,7 @@
#include "maemoconstants.h"
#include "maemopackagecreationwidget.h"
#include "maemopackagecontents.h"
#include "maemotoolchain.h"
#include <projectexplorer/projectexplorerconstants.h>
...
...
@@ -67,13 +68,16 @@ namespace Qt4ProjectManager {
namespace
Internal
{
MaemoPackageCreationStep
::
MaemoPackageCreationStep
(
BuildConfiguration
*
buildConfig
)
:
ProjectExplorer
::
BuildStep
(
buildConfig
,
CreatePackageId
)
:
ProjectExplorer
::
BuildStep
(
buildConfig
,
CreatePackageId
),
m_packageContents
(
new
MaemoPackageContents
(
this
))
{
}
MaemoPackageCreationStep
::
MaemoPackageCreationStep
(
BuildConfiguration
*
buildConfig
,
MaemoPackageCreationStep
*
other
)
:
BuildStep
(
buildConfig
,
other
)
:
BuildStep
(
buildConfig
,
other
),
m_packageContents
(
new
MaemoPackageContents
(
this
))
{
}
...
...
@@ -119,7 +123,7 @@ bool MaemoPackageCreationStep::createPackage()
env
.
insert
(
key
,
path
%
QLatin1String
(
"madbin"
)
%
colon
%
env
.
value
(
key
));
env
.
insert
(
QLatin1String
(
"PERL5LIB"
),
path
%
QLatin1String
(
"madlib/perl5"
));
const
QString
projectDir
=
QFileInfo
(
e
xecutable
()).
absolutePath
();
const
QString
projectDir
=
QFileInfo
(
localE
xecutable
FilePath
()).
absolutePath
();
env
.
insert
(
QLatin1String
(
"PWD"
),
projectDir
);
const
QRegExp
envPattern
(
QLatin1String
(
"([^=]+)=[
\"
']?([^;
\"
']+)[
\"
']? ;.*"
));
...
...
@@ -161,7 +165,7 @@ bool MaemoPackageCreationStep::createPackage()
return
false
;
const
QString
targetFile
(
projectDir
%
QLatin1String
(
"/debian/"
)
%
executableFileName
().
toLower
()
%
e
xecutableFilePath
OnTarget
());
%
executableFileName
().
toLower
()
%
remoteE
xecutableFilePath
());
if
(
QFile
::
exists
(
targetFile
))
{
if
(
!
QFile
::
remove
(
targetFile
))
{
raiseError
(
tr
(
"Packaging Error: Could not replace file '%1'."
)
...
...
@@ -169,9 +173,9 @@ bool MaemoPackageCreationStep::createPackage()
return
false
;
}
}
if
(
!
QFile
::
copy
(
e
xecutable
(),
targetFile
))
{
if
(
!
QFile
::
copy
(
localE
xecutable
FilePath
(),
targetFile
))
{
raiseError
(
tr
(
"Packaging Error: Could not copy '%1' to '%2'."
)
.
arg
(
QDir
::
toNativeSeparators
(
e
xecutable
()))
.
arg
(
QDir
::
toNativeSeparators
(
localE
xecutable
FilePath
()))
.
arg
(
QDir
::
toNativeSeparators
(
targetFile
)));
return
false
;
}
...
...
@@ -186,6 +190,7 @@ bool MaemoPackageCreationStep::createPackage()
}
emit
addOutput
(
tr
(
"Package created."
));
m_packageContents
->
setUnModified
();
return
true
;
}
...
...
@@ -219,7 +224,7 @@ const Qt4BuildConfiguration *MaemoPackageCreationStep::qt4BuildConfiguration() c
return
static_cast
<
Qt4BuildConfiguration
*>
(
buildConfiguration
());
}
QString
MaemoPackageCreationStep
::
e
xecutable
()
const
QString
MaemoPackageCreationStep
::
localE
xecutable
FilePath
()
const
{
const
TargetInformation
&
ti
=
qt4BuildConfiguration
()
->
qt4Target
()
->
qt4Project
()
->
rootProjectNode
()
->
targetInformation
();
...
...
@@ -232,7 +237,7 @@ QString MaemoPackageCreationStep::executable() const
QString
MaemoPackageCreationStep
::
executableFileName
()
const
{
return
QFileInfo
(
e
xecutable
()).
fileName
();
return
QFileInfo
(
localE
xecutable
FilePath
()).
fileName
();
}
const
MaemoToolChain
*
MaemoPackageCreationStep
::
maemoToolChain
()
const
...
...
@@ -252,25 +257,28 @@ QString MaemoPackageCreationStep::targetRoot() const
bool
MaemoPackageCreationStep
::
packagingNeeded
()
const
{
// TODO: When the package contents get user-modifiable, we need
// to check whether files have been added and/or removed and whether
// the newest one is newer than the package.
// For the first check, we should have a switch that the widget sets
// to true when the user has changed the package contents and which
// we set to false after a successful package creation.
QFileInfo
packageInfo
(
packageFilePath
());
return
!
packageInfo
.
exists
()
||
packageInfo
.
lastModified
()
<=
QFileInfo
(
executable
()).
lastModified
();
if
(
!
packageInfo
.
exists
()
||
m_packageContents
->
isModified
())
return
true
;
for
(
int
i
=
0
;
i
<
m_packageContents
->
rowCount
();
++
i
)
{
if
(
packageInfo
.
lastModified
()
<=
QFileInfo
(
m_packageContents
->
deployableAt
(
i
).
localFilePath
)
.
lastModified
())
return
true
;
}
return
false
;
}
QString
MaemoPackageCreationStep
::
packageFilePath
()
const
{
QFileInfo
execInfo
(
e
xecutable
());
QFileInfo
execInfo
(
localE
xecutable
FilePath
());
return
execInfo
.
path
()
%
QDir
::
separator
()
%
execInfo
.
fileName
().
toLower
()
%
versionString
()
%
QLatin1String
(
"_armel.deb"
);
}
QString
MaemoPackageCreationStep
::
e
xecutableFilePath
OnTarget
()
const
QString
MaemoPackageCreationStep
::
remoteE
xecutableFilePath
()
const
{
return
QLatin1String
(
"/usr/bin/"
)
%
executableFileName
();
}
...
...
src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h
View file @
83f505d9
...
...
@@ -52,6 +52,7 @@ QT_END_NAMESPACE
namespace
Qt4ProjectManager
{
namespace
Internal
{
class
MaemoPackageContents
;
class
MaemoToolChain
;
class
Qt4BuildConfiguration
;
...
...
@@ -63,7 +64,9 @@ public:
MaemoPackageCreationStep
(
ProjectExplorer
::
BuildConfiguration
*
buildConfig
);
QString
packageFilePath
()
const
;
QString
executableFilePathOnTarget
()
const
;
QString
remoteExecutableFilePath
()
const
;
QString
localExecutableFilePath
()
const
;
private:
MaemoPackageCreationStep
(
ProjectExplorer
::
BuildConfiguration
*
buildConfig
,
MaemoPackageCreationStep
*
other
);
...
...
@@ -77,7 +80,6 @@ private:
bool
runCommand
(
QProcess
&
proc
,
const
QString
&
command
);
const
Qt4BuildConfiguration
*
qt4BuildConfiguration
()
const
;
const
MaemoToolChain
*
maemoToolChain
()
const
;
QString
executable
()
const
;
QString
executableFileName
()
const
;
QString
maddeRoot
()
const
;
QString
targetRoot
()
const
;
...
...
@@ -88,6 +90,8 @@ private:
const
QString
&
detailedMsg
=
QString
());
static
const
QLatin1String
CreatePackageId
;
MaemoPackageContents
*
const
m_packageContents
;
};
}
// namespace Internal
...
...
src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp
View file @
83f505d9
...
...
@@ -198,7 +198,7 @@ QString AbstractMaemoRunControl::packageFilePath() const
QString
AbstractMaemoRunControl
::
executableFilePathOnTarget
()
const
{
return
m_runConfig
->
packageStep
()
->
e
xecutableFilePath
OnTarget
();
return
m_runConfig
->
packageStep
()
->
remoteE
xecutableFilePath
();
}
bool
AbstractMaemoRunControl
::
isCleaning
()
const
...
...
src/plugins/qt4projectmanager/qt-maemo/maemosshconnection.cpp
View file @
83f505d9
...
...
@@ -147,7 +147,7 @@ void MaemoInteractiveSshConnection::runCommand(const QString &command)
int
endMarkerCount
=
0
;
do
{
ssh
->
waitFor
(
channel
(),
endMarker
.
toUtf8
(),
1
);
ssh
->
waitFor
(
channel
(),
endMarker
.
toUtf8
(),
1
);
// TODO: Hack net7 to get rid of busy loop.
const
char
*
const
error
=
lastError
();
if
(
error
)
throw
MaemoSshException
(
tr
(
"SSH error: %1"
).
arg
(
error
));
...
...
src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri
View file @
83f505d9
...
...
@@ -20,7 +20,8 @@ HEADERS += \
$$PWD/maemopackagecreationstep.h \
$$PWD/maemopackagecreationfactory.h \
$$PWD/ne7sshobject.h \
$$PWD/maemopackagecreationwidget.h
$$PWD/maemopackagecreationwidget.h \
$$PWD/maemopackagecontents.h
SOURCES += \
$$PWD/maemoconfigtestdialog.cpp \
...
...
@@ -39,7 +40,8 @@ SOURCES += \
$$PWD/maemopackagecreationstep.cpp \
$$PWD/maemopackagecreationfactory.cpp \
$$PWD/ne7sshobject.cpp \
$$PWD/maemopackagecreationwidget.cpp
$$PWD/maemopackagecreationwidget.cpp \
$$PWD/maemopackagecontents.cpp
FORMS += \
$$PWD/maemoconfigtestdialog.ui \
...
...
Write
Preview
Supports
Markdown
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