AbstractStatusesModel::AbstractStatusesModel(QObject *parent) : AbstractTwitterModel(parent) , m_count(0) , m_trim_user(false) , m_include_entities(true) , m_contributor_details(false) { QHash<int, QByteArray> roles; roles[ContributorsRole] = "contributors"; roles[CoordinatesRole] = "coordinates"; roles[created_at_role] = "created_at"; roles[EntitiesRole] = "entities"; roles[FavoritedRole] = "favorited"; roles[GeoRole] = "geo"; roles[id_role] = "id"; roles[id_str_role] = "id_str"; roles[in_reply_to_screen_nameRole] = "in_reply_to_screen_name"; roles[in_reply_to_status_idRole] = "in_reply_to_status_id_str"; roles[InReplyTouser_idRole] = "in_reply_to_user_id_str"; roles[PlaceRole] = "place"; roles[possibly_sensitiveRole] = "possibly_sensitive"; roles[retweet_countRole] = "retweet_count"; roles[RetweetedRole] = "retweeted"; roles[retweeted_statusRole] = "retweeted_status"; roles[SourceRole] = "source"; roles[TextRole] = "text"; roles[plain_textRole] = "plain_text"; roles[rich_textRole] = "rich_text"; roles[TruncatedRole] = "truncated"; roles[UserRole] = "user"; roles[MediaRole] = "media"; setRoleNames(roles); }
CommandModel::CommandModel() : m_loading(false) { QHash<int, QByteArray> names = roleNames(); names.insert(Qt::UserRole, "trigger"); setRoleNames(names); }
LanguageListModel::LanguageListModel(QObject *parent) : QAbstractListModel(parent) { #if QT_VERSION < QT_VERSION_CHECK(5,0,0) setRoleNames(roleNames()); #endif }
PowerModel::PowerModel(QObject *parent) : QAbstractListModel(parent) { QHash<int, QByteArray> roles; roles.insert(Qt::DisplayRole, "label"); roles.insert(Qt::DecorationRole, "icon"); setRoleNames(roles); PowerAction shutdown; shutdown.name = i18nc("an action", "Shutdown"); shutdown.type = Shutdown; shutdown.iconName = "system-shutdown"; m_powerList.append(shutdown); PowerAction restart; restart.name = i18nc("an action", "Restart"); restart.type = Restart; restart.iconName = "system-reboot"; m_powerList.append(restart); PowerAction suspend; suspend.name = i18nc("an action", "Suspend"); suspend.type = Suspend; suspend.iconName = "system-suspend"; m_powerList.append(suspend); PowerAction hibernate; hibernate.name = i18nc("an action", "Hibernate"); hibernate.type = Hibernate; hibernate.iconName = "system-suspend-hibernate"; m_powerList.append(hibernate); emit countChanged(); }
TechnologyModel::TechnologyModel(QAbstractListModel* parent) : QAbstractListModel(parent), m_manager(NULL), m_tech(NULL), m_scanning(false), m_changesInhibited(false), m_uneffectedChanges(false), m_scanResultsReady(false) { m_manager = NetworkManagerFactory::createInstance(); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) setRoleNames(roleNames()); #endif connect(m_manager, SIGNAL(availabilityChanged(bool)), this, SLOT(managerAvailabilityChanged(bool))); connect(m_manager, SIGNAL(technologiesChanged()), this, SLOT(updateTechnologies())); connect(m_manager, SIGNAL(servicesChanged()), this, SLOT(updateServiceList())); }
ReverseTranslationsModel::ReverseTranslationsModel(QObject *parent) : QAbstractListModel(parent) { #if QT_VERSION < QT_VERSION_CHECK(5,0,0) setRoleNames(roleNames()); #endif }
AttachmentListModel::AttachmentListModel(QObject *parent) : QAbstractListModel(parent) , m_messageId(QMailMessageId()) { roles.insert(ContentLocation, "contentLocation"); roles.insert(DisplayName, "displayName"); roles.insert(Downloaded, "downloaded"); roles.insert(MimeType, "mimeType"); roles.insert(Size, "size"); roles.insert(StatusInfo, "statusInfo"); roles.insert(Url, "url"); roles.insert(ProgressInfo, "progressInfo"); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) setRoleNames(roles); #endif connect(EmailAgent::instance(), SIGNAL(attachmentDownloadStatusChanged(QString,EmailAgent::AttachmentStatus)), this, SLOT(onAttachmentDownloadStatusChanged(QString,EmailAgent::AttachmentStatus))); connect(EmailAgent::instance(), SIGNAL(attachmentDownloadProgressChanged(QString,int)), this, SLOT(onAttachmentDownloadProgressChanged(QString,int))); connect(EmailAgent::instance(), SIGNAL(attachmentUrlChanged(QString,QString)), this, SLOT(onAttachmentUrlChanged(QString,QString))); }
TranslationServicesModel::TranslationServicesModel(const QStringList &strings, QObject *parent) : QStringListModel(strings, parent) { #if QT_VERSION < QT_VERSION_CHECK(5,0,0) setRoleNames(roleNames()); #endif }
BrowseModelPrivate::BrowseModelPrivate(ServiceProxyCall *call, const QString &protocolInfo, BrowseModel *parent) : QAbstractListModel(parent) , m_currentOffset(0) , m_busy(true) , m_done(false) , m_protocolInfo(protocolInfo) , m_lastIndex(-1) , m_call(call) , m_settings() , q_ptr(parent) { QHash<int, QByteArray> roles; roles[BrowseRoleTitle] = "title"; roles[BrowseRoleId] = "upnpId"; roles[BrowseRoleUPnPClass] = "upnpClass"; roles[BrowseRoleIcon] = "icon"; roles[BrowseRoleType] = "type"; roles[BrowseRoleDetail] = "detail"; roles[BrowseRoleURI] = "uri"; roles[BrowseRoleMetaData] = "metadata"; roles[BrowseRoleFilter] = "filter"; setRoleNames(roles); qDebug() << "Created browse model"; if (m_call != 0) { connect(m_call, SIGNAL(ready()), SLOT(onCallReady())); m_call->setParent(this); } connect(&m_settings, SIGNAL(filterInDetailsChanged()), SLOT(onFilterInDetailsChanged())); }
DocumentListModel::DocumentListModel(QObject *parent) : QAbstractListModel(parent), m_searchThread(0), m_groupBy(GroupByName), m_filter(UnknownType) { QHash<int, QByteArray> roleNames = QAbstractListModel::roleNames(); roleNames[FileNameRole] = "fileName"; roleNames[FilePathRole] = "filePath"; roleNames[DocTypeRole] = "docType"; roleNames[SectionCategoryRole] = "sectionCategory"; roleNames[FileSizeRole] = "fileSize"; roleNames[AuthorNameRole] = "authorName"; roleNames[AccessedTimeRole] = "accessedTime"; roleNames[ModifiedTimeRole] = "modifiedTime"; roleNames[UUIDRole] = "uuid"; setRoleNames(roleNames); m_docTypes["odt"] = TextDocumentType; m_docTypes["doc"] = TextDocumentType; m_docTypes["docx"] = TextDocumentType; m_docTypes["odp"] = PresentationType; m_docTypes["ppt"] = PresentationType; m_docTypes["pptx"] = PresentationType; m_docTypes["ods"] = SpreadsheetType; m_docTypes["xls"] = SpreadsheetType; m_docTypes["xlsx"] = SpreadsheetType; }
DirModel::DirModel(QObject *parent) : QAbstractItemModel(parent) , d(new DirModelPrivate(this)) { // QThread* workerThread = new QThread(this); // d->moveToThread(workerThread); // workerThread->start(); QHash<int, QByteArray>roleNames; roleNames[Qt::DecorationRole] = "decoration"; roleNames[DirModel::Name] = "Name"; // roleNames[DirModel::Size] = "Size"; roleNames[DirModel::ModifiedTime] = "ModifiedTime"; roleNames[DirModel::Permissions] = "Permissions"; roleNames[DirModel::Owner] = "Owner"; roleNames[DirModel::Group] = "Group"; roleNames[DirModel::Type] = "Type"; // Type == item.mimeComment() ... yeah, go figure that one out. roleNames[DirModel::ColumnCount] = "ColumnCount"; roleNames[DirModel::UrlRole] = "Url"; roleNames[DirModel::MimeTypeRole] = "MimeType"; roleNames[DirModel::IconName] = "IconName"; roleNames[DirModel::BaseName] = "BaseName"; roleNames[DirModel::Extension] = "Extension"; roleNames[DirModel::TimeString] = "TimeString"; roleNames[DirModel::MimeOrThumb] = "MimeOrThumb"; setRoleNames(roleNames); }
HistoryModel::HistoryModel(QObject *parent) : QAbstractListModel(parent) { // Set role names to access data from QML QHash<int, QByteArray> roles; roles[TimeRole] = "time"; roles[HeartRateRole] = "heartRate"; setRoleNames(roles); // Read info file if is exists QFile historyFile("/home/user/MyDocs/heartrate.csv"); if (historyFile.exists() && historyFile.open(QIODevice::ReadOnly)) { QTextStream in(&historyFile); while (!in.atEnd()) { QString line = in.readLine(); QStringList values = line.split(" "); if (values.length() > 1) { QDateTime time = QDateTime::fromString(values[0], Qt::ISODate); int value = values[1].toInt(); HeartRateMeasurement measurement(time, value); m_data.append(measurement); } } historyFile.close(); } }
KnotsDirectory::KnotsDirectory( QObject *parent ) : QAbstractListModel( parent ) , _xmlReader(0) , _xmlSource(0) , _currentDownload(0) , _parser(0) { _roles[IdRole] = "id"; _roles[NameRole] = "name"; _roles[ImageRole] = "thumbnail"; _roles[WidthRole] = "width"; _roles[HeightRole] = "height"; _roles[ViewsRole] = "views"; _roles[AddedRole] = "addedOn"; _roles[DurationRole] = "duration"; _roles[LastViewedPositionRole] = "lastposition"; _roles[MediaIdRole] = "mediaId"; setRoleNames(_roles); _parser = new SaxKnotsItemHandler(); _parser->setItemHandler(this); connect(&Knots::instance().serverConnection(), SIGNAL(finished(QNetworkReply*)),SLOT(onDirectoryFetchFinished(QNetworkReply*))); }
ResultModel::ResultModel(QObject *parent) : QAbstractListModel(parent), m_historyIndex(-1) { #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) setRoleNames(roleNames()); #endif }
PlaceModel::PlaceModel(QObject *parent) : QAbstractListModel(parent) { QList<QDesktopServices::StandardLocation> locations; locations << QDesktopServices::DocumentsLocation; locations << QDesktopServices::MusicLocation; locations << QDesktopServices::MoviesLocation; locations << QDesktopServices::PicturesLocation; foreach (QDesktopServices::StandardLocation location, locations) { const QString path = QDesktopServices::storageLocation(location); QDir dir(path); if (path.isEmpty() || dir == QDir::home()) continue; // do not use "path" directly, on Windows it uses back slashes // where the rest of Qt uses forward slashes m_paths << dir.path(); } // set role names QHash<int, QByteArray> roleNames; roleNames.insert(ChatModel::AvatarRole, "avatar"); roleNames.insert(ChatModel::NameRole, "name"); roleNames.insert(ChatModel::JidRole, "url"); setRoleNames(roleNames); }
QDeclarativeFolderListModel::QDeclarativeFolderListModel(QObject *parent) : QAbstractListModel(parent) { mImageCache = dynamic_cast<PlexyDesk::ImageCache *>(PlexyDesk::PlexyQmlGlue::qmlEngine()->imageProvider("plexydesk")); QHash<int, QByteArray> roles; roles[FileNameRole] = "fileName"; roles[FilePathRole] = "filePath"; roles[FileIconRole] = "fileIcon"; roles[FileMimeIconRole] = "fileMimeIcon"; roles[FileTypeIconRole] = "fileTypeIcon"; setRoleNames(roles); d = new QDeclarativeFolderListModelPrivate; d->model.setFilter(QDir::AllDirs | QDir::Files | QDir::Drives | QDir::NoDotAndDotDot); connect(&d->model, SIGNAL(rowsInserted(const QModelIndex&,int,int)) , this, SLOT(inserted(const QModelIndex&,int,int))); connect(&d->model, SIGNAL(rowsRemoved(const QModelIndex&,int,int)) , this, SLOT(removed(const QModelIndex&,int,int))); connect(&d->model, SIGNAL(dataChanged(const QModelIndex&,const QModelIndex&)) , this, SLOT(handleDataChanged(const QModelIndex&,const QModelIndex&))); connect(&d->model, SIGNAL(modelReset()), this, SLOT(refresh())); connect(&d->model, SIGNAL(layoutChanged()), this, SLOT(refresh())); SetToHome(); }
void BookmarkModel::generateRoleNames() { for (int i = 0; i < this->columnCount(); i++) m_roles[Qt::UserRole + i] = this->headerData(i, Qt::Horizontal).toByteArray(); setRoleNames(m_roles); }
ToDoListModel::ToDoListModel(QObject *parent) : QAbstractListModel(parent) { QHash<int, QByteArray> roles; roles[ItemTextRole] = "itemtext"; roles[ItemDueDateRole] = "itemduedate"; setRoleNames(roles); }
/** * @brief ConcertModel::ConcertModel * @param parent */ ConcertModel::ConcertModel(QObject *parent) : QAbstractItemModel(parent) { QHash<int, QByteArray> roles; roles[NameRole] = "name"; roles[FileNameRole] = "file"; setRoleNames(roles); }
CQSpreadsheetListModel::CQSpreadsheetListModel(QObject* parent) : QAbstractListModel(parent), d(new Private()) { QHash<int, QByteArray> roleNames; roleNames.insert(SheetNameRole, "sheetName"); roleNames.insert(ThumbnailRole, "thumbnail"); setRoleNames(roleNames); }
Rules::Rules(QObject *parent): HueModel(parent), m_busy(false) { #if QT_VERSION < 0x050000 setRoleNames(roleNames()); #endif }
UVModel::UVModel(QObject *parent) : QAbstractListModel(parent) { QHash<int, QByteArray> roles; roles[DisplayRole] = "name"; roles[SizeRole] = "nbPages"; setRoleNames(roles); }
ApplicationFilterModel::ApplicationFilterModel(QAbstractItemModel *sourceModel, QObject *parent) : QSortFilterProxyModel(parent) { PANORAMA_INITIALIZE(ApplicationFilterModel); setSourceModel(sourceModel); setRoleNames(sourceModel->roleNames()); }
QQuickViewTestUtil::QaimModel::QaimModel(QObject *parent) : QAbstractListModel(parent) { QHash<int, QByteArray> roles; roles[Name] = "name"; roles[Number] = "number"; setRoleNames(roles); }
GriloModel::GriloModel(QObject *parent) : QAbstractListModel(parent) { QHash<int, QByteArray> roles; roles[MediaRole] = "media"; setRoleNames(roles); }
CategoriesModel::CategoriesModel(QObject* parent): QAbstractItemModel(parent) { m_categories.append(Category("All Songs", "audio", Category::AllMusic)); m_categories.append(Category("Artists", "user-identity", Category::Artists)); m_categories.append(Category("Albums", "tools-media-optical-copy", Category::Albums)); setRoleNames(MediaCenter::appendAdditionalMediaRoles(roleNames())); }
QObjectListModel::QObjectListModel(QObject *parent, QList<QObject*> *list) : QAbstractListModel(parent), _list(list) { QHash<int, QByteArray> roles; roles[Qt::UserRole + 1] = "object"; setRoleNames(roles); }
FocusZonesModel::FocusZonesModel(QObject *parent) :QAbstractListModel(parent) { QHash<int, QByteArray> roles; roles[StatusRole] = "status"; roles[AreaRole] = "area"; setRoleNames(roles); }
//![0] AnimalModel::AnimalModel(QObject *parent) : QAbstractListModel(parent) { QHash<int, QByteArray> roles; roles[TypeRole] = "type"; roles[SizeRole] = "size"; setRoleNames(roles); }
NesCheats::NesCheats() { QHash<int, QByteArray> roles; roles.insert(CodeRole, "code"); roles.insert(DescriptionRole, "codeDescription"); roles.insert(EnableRole, "codeEnabled"); setRoleNames(roles); }