forked from qt-creator/qt-creator
Maemo: Improve file selection dialog for publishing.
- Make sure file names are completely visible. - Show hidden files. - Pre-unselect files of types unlikely to be included in the package.
This commit is contained in:
@@ -40,6 +40,8 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "maemopublishedprojectmodel.h"
|
#include "maemopublishedprojectmodel.h"
|
||||||
|
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
namespace {
|
namespace {
|
||||||
@@ -49,6 +51,32 @@ const int IncludeColumn = 2;
|
|||||||
MaemoPublishedProjectModel::MaemoPublishedProjectModel(QObject *parent)
|
MaemoPublishedProjectModel::MaemoPublishedProjectModel(QObject *parent)
|
||||||
: QFileSystemModel(parent)
|
: QFileSystemModel(parent)
|
||||||
{
|
{
|
||||||
|
setFilter(filter() | QDir::Hidden | QDir::System);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoPublishedProjectModel::initFilesToExclude()
|
||||||
|
{
|
||||||
|
initFilesToExclude(rootPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
void MaemoPublishedProjectModel::initFilesToExclude(const QString &filePath)
|
||||||
|
{
|
||||||
|
QFileInfo fi(filePath);
|
||||||
|
if (fi.isDir()) {
|
||||||
|
const QStringList fileNames = QDir(filePath).entryList(QDir::Files
|
||||||
|
| QDir::Dirs | QDir::NoDotAndDotDot | QDir::System | QDir::Hidden);
|
||||||
|
foreach (const QString &fileName, fileNames)
|
||||||
|
initFilesToExclude(filePath + QLatin1Char('/') + fileName);
|
||||||
|
} else {
|
||||||
|
const QString &fileName = fi.fileName();
|
||||||
|
if (fi.isHidden() || fileName.endsWith(QLatin1String(".o"))
|
||||||
|
|| fileName == QLatin1String("Makefile")
|
||||||
|
|| fileName.contains(QLatin1String(".pro.user"))
|
||||||
|
|| fileName.contains(QLatin1String(".so"))
|
||||||
|
|| fileName.endsWith(QLatin1String(".a"))) {
|
||||||
|
m_filesToExclude.insert(filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int MaemoPublishedProjectModel::columnCount(const QModelIndex &parent) const
|
int MaemoPublishedProjectModel::columnCount(const QModelIndex &parent) const
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class MaemoPublishedProjectModel : public QFileSystemModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit MaemoPublishedProjectModel(QObject *parent = 0);
|
explicit MaemoPublishedProjectModel(QObject *parent = 0);
|
||||||
|
void initFilesToExclude();
|
||||||
QStringList filesToExclude() const { return m_filesToExclude.toList(); }
|
QStringList filesToExclude() const { return m_filesToExclude.toList(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -65,6 +66,8 @@ private:
|
|||||||
int role);
|
int role);
|
||||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
|
|
||||||
|
void initFilesToExclude(const QString &filePath);
|
||||||
|
|
||||||
QSet<QString> m_filesToExclude;
|
QSet<QString> m_filesToExclude;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,10 @@ MaemoPublishingFileSelectionDialog::MaemoPublishingFileSelectionDialog(const QSt
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
m_projectModel = new MaemoPublishedProjectModel(this);
|
m_projectModel = new MaemoPublishedProjectModel(this);
|
||||||
const QModelIndex rootIndex = m_projectModel->setRootPath(projectPath);
|
const QModelIndex rootIndex = m_projectModel->setRootPath(projectPath);
|
||||||
|
m_projectModel->initFilesToExclude();
|
||||||
ui->projectView->setModel(m_projectModel);
|
ui->projectView->setModel(m_projectModel);
|
||||||
ui->projectView->setRootIndex(rootIndex);
|
ui->projectView->setRootIndex(rootIndex);
|
||||||
|
ui->projectView->header()->setResizeMode(0, QHeaderView::ResizeToContents);
|
||||||
}
|
}
|
||||||
|
|
||||||
MaemoPublishingFileSelectionDialog::~MaemoPublishingFileSelectionDialog()
|
MaemoPublishingFileSelectionDialog::~MaemoPublishingFileSelectionDialog()
|
||||||
|
|||||||
Reference in New Issue
Block a user