forked from qt-creator/qt-creator
QtSupport: style
Change-Id: Iabf3c96fc6d6b17282ec2ad43f32f76b04ac2ef0 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -101,7 +101,7 @@ static inline QStringList trimStringList(const QStringList &stringlist)
|
|||||||
return returnList;
|
return returnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ExampleItem> ExamplesListModel::parseExamples(QXmlStreamReader* reader, const QString& projectsOffset)
|
QList<ExampleItem> ExamplesListModel::parseExamples(QXmlStreamReader *reader, const QString &projectsOffset)
|
||||||
{
|
{
|
||||||
QList<ExampleItem> examples;
|
QList<ExampleItem> examples;
|
||||||
ExampleItem item;
|
ExampleItem item;
|
||||||
@@ -149,7 +149,7 @@ QList<ExampleItem> ExamplesListModel::parseExamples(QXmlStreamReader* reader, co
|
|||||||
return examples;
|
return examples;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ExampleItem> ExamplesListModel::parseDemos(QXmlStreamReader* reader, const QString& projectsOffset)
|
QList<ExampleItem> ExamplesListModel::parseDemos(QXmlStreamReader *reader, const QString &projectsOffset)
|
||||||
{
|
{
|
||||||
QList<ExampleItem> demos;
|
QList<ExampleItem> demos;
|
||||||
ExampleItem item;
|
ExampleItem item;
|
||||||
@@ -522,12 +522,11 @@ void ExamplesListModelFilter::updateFilter()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool containsSubString(const QStringList& list, const QString& substr, Qt::CaseSensitivity cs)
|
bool containsSubString(const QStringList &list, const QString &substr, Qt::CaseSensitivity cs)
|
||||||
{
|
{
|
||||||
foreach (const QString &elem, list) {
|
foreach (const QString &elem, list)
|
||||||
if (elem.contains(substr, cs))
|
if (elem.contains(substr, cs))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -549,10 +548,9 @@ bool ExamplesListModelFilter::filterAcceptsRow(int sourceRow, const QModelIndex
|
|||||||
const QStringList tags = sourceModel()->index(sourceRow, 0, sourceParent).data(Tags).toStringList();
|
const QStringList tags = sourceModel()->index(sourceRow, 0, sourceParent).data(Tags).toStringList();
|
||||||
|
|
||||||
if (!m_filterTags.isEmpty()) {
|
if (!m_filterTags.isEmpty()) {
|
||||||
foreach(const QString &tag, m_filterTags) {
|
foreach(const QString &tag, m_filterTags)
|
||||||
if (!tags.contains(tag, Qt::CaseInsensitive))
|
if (!tags.contains(tag, Qt::CaseInsensitive))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,7 +615,8 @@ void ExamplesListModelFilter::timerEvent(QTimerEvent *timerEvent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SearchStringLexer {
|
struct SearchStringLexer
|
||||||
|
{
|
||||||
QString code;
|
QString code;
|
||||||
const QChar *codePtr;
|
const QChar *codePtr;
|
||||||
QChar yychar;
|
QChar yychar;
|
||||||
|
|||||||
@@ -31,20 +31,27 @@
|
|||||||
#define EXAMPLESLISTMODEL_H
|
#define EXAMPLESLISTMODEL_H
|
||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
#include <QSortFilterProxyModel>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
#include <QSortFilterProxyModel>
|
|
||||||
|
|
||||||
namespace QtSupport {
|
namespace QtSupport {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
enum ExampleRoles { Name=Qt::UserRole, ProjectPath, Description, ImageUrl,
|
enum ExampleRoles
|
||||||
DocUrl, FilesToOpen, Tags, Difficulty, HasSourceCode,
|
{
|
||||||
Type, Dependencies, IsVideo, VideoUrl, VideoLength, Platforms };
|
Name = Qt::UserRole, ProjectPath, Description, ImageUrl,
|
||||||
|
DocUrl, FilesToOpen, Tags, Difficulty, HasSourceCode,
|
||||||
|
Type, Dependencies, IsVideo, VideoUrl, VideoLength, Platforms
|
||||||
|
};
|
||||||
|
|
||||||
enum InstructionalType { Example=0, Demo, Tutorial };
|
enum InstructionalType
|
||||||
|
{
|
||||||
|
Example = 0, Demo, Tutorial
|
||||||
|
};
|
||||||
|
|
||||||
struct ExampleItem {
|
struct ExampleItem
|
||||||
|
{
|
||||||
ExampleItem(): difficulty(0), isVideo(false) {}
|
ExampleItem(): difficulty(0), isVideo(false) {}
|
||||||
InstructionalType type;
|
InstructionalType type;
|
||||||
QString name;
|
QString name;
|
||||||
@@ -63,24 +70,21 @@ struct ExampleItem {
|
|||||||
QStringList platforms;
|
QStringList platforms;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExamplesListModel : public QAbstractListModel {
|
class ExamplesListModel : public QAbstractListModel
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ExamplesListModel(QObject *parent);
|
explicit ExamplesListModel(QObject *parent);
|
||||||
|
|
||||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||||
|
|
||||||
QStringList tags() const;
|
QStringList tags() const;
|
||||||
|
|
||||||
|
|
||||||
void ensureInitialized() const;
|
void ensureInitialized() const;
|
||||||
|
|
||||||
void beginReset()
|
void beginReset() { beginResetModel(); }
|
||||||
{ beginResetModel(); }
|
void endReset() { endResetModel(); }
|
||||||
|
|
||||||
void endReset()
|
|
||||||
{ endResetModel(); }
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void tagsUpdated();
|
void tagsUpdated();
|
||||||
@@ -92,9 +96,9 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void addItems(const QList<ExampleItem> &items);
|
void addItems(const QList<ExampleItem> &items);
|
||||||
QList<ExampleItem> parseExamples(QXmlStreamReader* reader, const QString& projectsOffset);
|
QList<ExampleItem> parseExamples(QXmlStreamReader *reader, const QString &projectsOffset);
|
||||||
QList<ExampleItem> parseDemos(QXmlStreamReader* reader, const QString& projectsOffset);
|
QList<ExampleItem> parseDemos(QXmlStreamReader *reader, const QString &projectsOffset);
|
||||||
QList<ExampleItem> parseTutorials(QXmlStreamReader* reader, const QString& projectsOffset);
|
QList<ExampleItem> parseTutorials(QXmlStreamReader *reader, const QString &projectsOffset);
|
||||||
void clear();
|
void clear();
|
||||||
QStringList exampleSources(QString *examplesFallback, QString *demosFallback,
|
QStringList exampleSources(QString *examplesFallback, QString *demosFallback,
|
||||||
QString *sourceFallback);
|
QString *sourceFallback);
|
||||||
@@ -105,8 +109,10 @@ private:
|
|||||||
bool m_helpInitialized;
|
bool m_helpInitialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExamplesListModelFilter : public QSortFilterProxyModel {
|
class ExamplesListModelFilter : public QSortFilterProxyModel
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Q_PROPERTY(bool showTutorialsOnly READ showTutorialsOnly WRITE setShowTutorialsOnly NOTIFY showTutorialsOnlyChanged)
|
Q_PROPERTY(bool showTutorialsOnly READ showTutorialsOnly WRITE setShowTutorialsOnly NOTIFY showTutorialsOnlyChanged)
|
||||||
Q_PROPERTY(QStringList filterTags READ filterTags WRITE setFilterTags NOTIFY filterTagsChanged)
|
Q_PROPERTY(QStringList filterTags READ filterTags WRITE setFilterTags NOTIFY filterTagsChanged)
|
||||||
@@ -120,11 +126,11 @@ public:
|
|||||||
QStringList filterTags() const { return m_filterTags; }
|
QStringList filterTags() const { return m_filterTags; }
|
||||||
QStringList searchStrings() const { return m_searchString; }
|
QStringList searchStrings() const { return m_searchString; }
|
||||||
|
|
||||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setFilterTags(const QStringList& arg)
|
void setFilterTags(const QStringList &arg)
|
||||||
{
|
{
|
||||||
if (m_filterTags != arg) {
|
if (m_filterTags != arg) {
|
||||||
m_filterTags = arg;
|
m_filterTags = arg;
|
||||||
@@ -133,7 +139,7 @@ public slots:
|
|||||||
}
|
}
|
||||||
void updateFilter();
|
void updateFilter();
|
||||||
|
|
||||||
void setSearchStrings(const QStringList& arg)
|
void setSearchStrings(const QStringList &arg)
|
||||||
{
|
{
|
||||||
if (m_searchString != arg) {
|
if (m_searchString != arg) {
|
||||||
m_searchString = arg;
|
m_searchString = arg;
|
||||||
@@ -142,20 +148,16 @@ public slots:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseSearchString(const QString& arg);
|
void parseSearchString(const QString &arg);
|
||||||
void setShowTutorialsOnly(bool showTutorialsOnly);
|
void setShowTutorialsOnly(bool showTutorialsOnly);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void showTutorialsOnlyChanged();
|
void showTutorialsOnlyChanged();
|
||||||
|
|
||||||
void filterTagsChanged(const QStringList& arg);
|
void filterTagsChanged(const QStringList& arg);
|
||||||
|
|
||||||
void searchStrings(const QStringList& arg);
|
void searchStrings(const QStringList& arg);
|
||||||
|
|
||||||
protected:
|
|
||||||
void timerEvent(QTimerEvent *event);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void timerEvent(QTimerEvent *event);
|
||||||
void delayedUpdateFilter();
|
void delayedUpdateFilter();
|
||||||
|
|
||||||
bool m_showTutorialsOnly;
|
bool m_showTutorialsOnly;
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ QPointer<ExamplesListModel> &examplesModelStatic()
|
|||||||
class Fetcher : public QObject
|
class Fetcher : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Fetcher() : QObject(), m_shutdown(false)
|
Fetcher() : QObject(), m_shutdown(false)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ private:
|
|||||||
class ExamplesWelcomePage : public Utils::IWelcomePage
|
class ExamplesWelcomePage : public Utils::IWelcomePage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ExamplesWelcomePage();
|
ExamplesWelcomePage();
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,10 @@
|
|||||||
|
|
||||||
#include "qtsupport_global.h"
|
#include "qtsupport_global.h"
|
||||||
|
|
||||||
#include <projectexplorer/kitinformation.h>
|
|
||||||
|
|
||||||
#include "baseqtversion.h"
|
#include "baseqtversion.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/kitinformation.h>
|
||||||
|
|
||||||
namespace QtSupport {
|
namespace QtSupport {
|
||||||
|
|
||||||
class QTSUPPORT_EXPORT QtKitInformation : public ProjectExplorer::KitInformation
|
class QTSUPPORT_EXPORT QtKitInformation : public ProjectExplorer::KitInformation
|
||||||
@@ -67,6 +67,7 @@ public:
|
|||||||
static void setQtVersionId(ProjectExplorer::Kit *k, const int id);
|
static void setQtVersionId(ProjectExplorer::Kit *k, const int id);
|
||||||
static BaseQtVersion *qtVersion(const ProjectExplorer::Kit *k);
|
static BaseQtVersion *qtVersion(const ProjectExplorer::Kit *k);
|
||||||
static void setQtVersion(ProjectExplorer::Kit *k, const BaseQtVersion *v);
|
static void setQtVersion(ProjectExplorer::Kit *k, const BaseQtVersion *v);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void qtVersionsChanged(const QList<int> &addedIds,
|
void qtVersionsChanged(const QList<int> &addedIds,
|
||||||
const QList<int> &removedIds,
|
const QList<int> &removedIds,
|
||||||
@@ -88,8 +89,8 @@ class QTSUPPORT_EXPORT QtVersionKitMatcher : public ProjectExplorer::KitMatcher
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit QtVersionKitMatcher(const Core::FeatureSet &required = Core::FeatureSet(),
|
explicit QtVersionKitMatcher(const Core::FeatureSet &required = Core::FeatureSet(),
|
||||||
const QtVersionNumber &min = QtVersionNumber(0, 0, 0),
|
const QtVersionNumber &min = QtVersionNumber(0, 0, 0),
|
||||||
const QtVersionNumber &max = QtVersionNumber(INT_MAX, INT_MAX, INT_MAX)) :
|
const QtVersionNumber &max = QtVersionNumber(INT_MAX, INT_MAX, INT_MAX)) :
|
||||||
m_min(min), m_max(max), m_features(required)
|
m_min(min), m_max(max), m_features(required)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user