forked from qt-creator/qt-creator
QtSupport: style
Change-Id: Iabf3c96fc6d6b17282ec2ad43f32f76b04ac2ef0 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -524,10 +524,9 @@ 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
|
||||||
|
{
|
||||||
|
Name = Qt::UserRole, ProjectPath, Description, ImageUrl,
|
||||||
DocUrl, FilesToOpen, Tags, Difficulty, HasSourceCode,
|
DocUrl, FilesToOpen, Tags, Difficulty, HasSourceCode,
|
||||||
Type, Dependencies, IsVideo, VideoUrl, VideoLength, Platforms };
|
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();
|
||||||
@@ -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,8 +126,8 @@ 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)
|
||||||
@@ -147,15 +153,11 @@ public slots:
|
|||||||
|
|
||||||
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,
|
||||||
|
|||||||
Reference in New Issue
Block a user