• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

lokalize

  • sources
  • kde-4.14
  • kdesdk
  • lokalize
  • src
  • cataloglistview
catalogmodel.h
Go to the documentation of this file.
1 /* ****************************************************************************
2  This file is part of Lokalize
3 
4  Copyright (C) 2007-2013 by Nick Shaforostoff <shafff@ukr.net>
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License as
8  published by the Free Software Foundation; either version 2 of
9  the License or (at your option) version 3 or any later version
10  accepted by the membership of KDE e.V. (or its successor approved
11  by the membership of KDE e.V.), which shall act as a proxy
12  defined in Section 14 of version 3 of the license.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 **************************************************************************** */
23 
24 #ifndef CATALOGMODEL_H
25 #define CATALOGMODEL_H
26 
27 #include "mergecatalog.h"
28 #include "pos.h"
29 
30 #include <QAbstractItemModel>
31 #include <QSortFilterProxyModel>
32 #include <QVector>
33 
34 class Catalog;
35 
36 
37 
41 class CatalogTreeModel: public QAbstractItemModel
42 {
43 Q_OBJECT
44 public:
45 
46  enum CatalogModelColumns
47  {
48  Key=0,
49  Source,
50  Target,
51  Notes,
52  TranslationStatus,
53  Empty,
54  State,
55  Modified,
56  ColumnCount,
57  DisplayedColumnCount=TranslationStatus+1
58  };
59 
60  enum Roles
61  {
62  StringFilterRole=Qt::UserRole+1
63  };
64 
65  CatalogTreeModel(QObject* parent, Catalog* catalog);
66  ~CatalogTreeModel(){}
67 
68  QModelIndex index (int row, int column, const QModelIndex& parent=QModelIndex())const;
69  QModelIndex parent(const QModelIndex&) const;
70  int rowCount(const QModelIndex& parent=QModelIndex()) const;
71  int columnCount(const QModelIndex& parent=QModelIndex()) const;
72  QVariant data(const QModelIndex&,int role=Qt::DisplayRole) const;
73  QVariant headerData(int section,Qt::Orientation, int role=Qt::DisplayRole) const;
74 
75  Catalog* catalog()const{return m_catalog;}
76 
77  void setIgnoreAccel(bool n){m_ignoreAccel=n;}
78 
79 public slots:
80  void reflectChanges(DocPosition);
81  void fileLoaded();
82 private:
83  Catalog* m_catalog;
84  bool m_ignoreAccel;
85 
86  static QVector<QVariant> m_fonts;
87  //DocPos m_prevChanged;
88 };
89 
90 
91 
92 
93 
94 
95 
96 
97 class CatalogTreeFilterModel: public QSortFilterProxyModel
98 {
99 Q_OBJECT
100 public:
101  enum FilterOptions
102  {
103  CaseInsensitive=1<<0,
104  IgnoreAccel=1<<1,
105 
106  Ready=1<<2,
107  NotReady=1<<3,
108  NonEmpty=1<<4,
109  Empty=1<<5,
110  Modified=1<<6,
111  NonModified=1<<7,
112  SameInSync=1<<8,
113  DifferentInSync=1<<9,
114  NotInSync=1<<10,
115 
116  //states (see defines below)
117  New=1<<11,
118  NeedsTranslation=1<<12,
119  NeedsL10n=1<<13,
120  NeedsAdaptation=1<<14,
121  Translated=1<<15,
122  NeedsReviewTranslation=1<<16,
123  NeedsReviewL10n=1<<17,
124  NeedsReviewAdaptation=1<<18,
125  Final=1<<19,
126  SignedOff=1<<20,
127  MaxOption=1<<21,
128  AllStates=MaxOption-1
129  };
130 
131 #define STATES ((0xffff<<11)&(AllStates))
132 #define FIRSTSTATEPOSITION 11
133 
134 
135  CatalogTreeFilterModel(QObject* parent);
136  ~CatalogTreeFilterModel(){}
137 
138  bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
139 
140  void setFilerOptions(int o);
141  int filerOptions()const{return m_filerOptions;}
142 
143  void setSourceModel(QAbstractItemModel* sourceModel);
144 
145  bool individualRejectFilterEnabled(){return m_individualRejectFilterEnable;}
146  void setEntryFilteredOut(int entry, bool filteredOut);
147 
148  void setMergeCatalogPointer(MergeCatalog* pointer);
149 
150 public slots:
151  void setEntriesFilteredOut(bool filteredOut=false);
152 
153 private:
154  int m_filerOptions;
155  bool m_individualRejectFilterEnable;
156  QVector<bool> m_individualRejectFilter; //used from kross scripts
157  MergeCatalog* m_mergeCatalog;
158 };
159 
160 
161 
162 
163 #endif
QModelIndex
MergeCatalog
Merge source container.
Definition: mergecatalog.h:71
CatalogTreeFilterModel::SameInSync
Definition: catalogmodel.h:112
CatalogTreeFilterModel::FilterOptions
FilterOptions
Definition: catalogmodel.h:101
CatalogTreeFilterModel::Final
Definition: catalogmodel.h:125
CatalogTreeFilterModel::NeedsAdaptation
Definition: catalogmodel.h:120
CatalogTreeFilterModel::individualRejectFilterEnabled
bool individualRejectFilterEnabled()
Definition: catalogmodel.h:145
CatalogTreeModel::headerData
QVariant headerData(int section, Qt::Orientation, int role=Qt::DisplayRole) const
Definition: catalogmodel.cpp:112
CatalogTreeModel::CatalogModelColumns
CatalogModelColumns
Definition: catalogmodel.h:46
CatalogTreeModel::TranslationStatus
Definition: catalogmodel.h:52
pos.h
CatalogTreeModel::data
QVariant data(const QModelIndex &, int role=Qt::DisplayRole) const
Definition: catalogmodel.cpp:128
CatalogTreeFilterModel::Modified
Definition: catalogmodel.h:110
CatalogTreeFilterModel::setMergeCatalogPointer
void setMergeCatalogPointer(MergeCatalog *pointer)
Definition: catalogmodel.cpp:302
CatalogTreeFilterModel::NeedsReviewAdaptation
Definition: catalogmodel.h:124
CatalogTreeFilterModel::IgnoreAccel
Definition: catalogmodel.h:104
CatalogTreeModel::Source
Definition: catalogmodel.h:49
CatalogTreeModel::Target
Definition: catalogmodel.h:50
CatalogTreeModel::reflectChanges
void reflectChanges(DocPosition)
Definition: catalogmodel.cpp:84
CatalogTreeFilterModel::NeedsTranslation
Definition: catalogmodel.h:118
CatalogTreeModel::index
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: catalogmodel.cpp:63
DocPosition
This struct represents a position in a catalog.
Definition: pos.h:38
CatalogTreeModel::rowCount
int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: catalogmodel.cpp:105
CatalogTreeModel::catalog
Catalog * catalog() const
Definition: catalogmodel.h:75
CatalogTreeModel::StringFilterRole
Definition: catalogmodel.h:62
CatalogTreeModel::Empty
Definition: catalogmodel.h:53
CatalogTreeFilterModel::setSourceModel
void setSourceModel(QAbstractItemModel *sourceModel)
Definition: catalogmodel.cpp:220
QObject
CatalogTreeFilterModel::CatalogTreeFilterModel
CatalogTreeFilterModel(QObject *parent)
Definition: catalogmodel.cpp:208
CatalogTreeModel::Modified
Definition: catalogmodel.h:55
CatalogTreeFilterModel::setFilerOptions
void setFilerOptions(int o)
Definition: catalogmodel.cpp:243
CatalogTreeModel
MVC wrapper for Catalog.
Definition: catalogmodel.h:41
CatalogTreeModel::columnCount
int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: catalogmodel.cpp:73
CatalogTreeModel::setIgnoreAccel
void setIgnoreAccel(bool n)
Definition: catalogmodel.h:77
CatalogTreeFilterModel::setEntriesFilteredOut
void setEntriesFilteredOut(bool filteredOut=false)
Definition: catalogmodel.cpp:227
mergecatalog.h
CatalogTreeFilterModel::~CatalogTreeFilterModel
~CatalogTreeFilterModel()
Definition: catalogmodel.h:136
CatalogTreeModel::State
Definition: catalogmodel.h:54
CatalogTreeFilterModel::filerOptions
int filerOptions() const
Definition: catalogmodel.h:141
CatalogTreeModel::Notes
Definition: catalogmodel.h:51
CatalogTreeFilterModel::SignedOff
Definition: catalogmodel.h:126
CatalogTreeFilterModel::NeedsL10n
Definition: catalogmodel.h:119
QSortFilterProxyModel
CatalogTreeFilterModel
Definition: catalogmodel.h:97
CatalogTreeModel::Roles
Roles
Definition: catalogmodel.h:60
CatalogTreeFilterModel::NotReady
Definition: catalogmodel.h:107
QAbstractProxyModel::sourceModel
QAbstractItemModel * sourceModel() const
QVector< QVariant >
CatalogTreeFilterModel::filterAcceptsRow
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
Definition: catalogmodel.cpp:251
CatalogTreeModel::Key
Definition: catalogmodel.h:48
CatalogTreeFilterModel::Ready
Definition: catalogmodel.h:106
CatalogTreeModel::fileLoaded
void fileLoaded()
Definition: catalogmodel.cpp:79
CatalogTreeFilterModel::NeedsReviewTranslation
Definition: catalogmodel.h:122
CatalogTreeModel::ColumnCount
Definition: catalogmodel.h:56
CatalogTreeModel::CatalogTreeModel
CatalogTreeModel(QObject *parent, Catalog *catalog)
Definition: catalogmodel.cpp:41
QAbstractItemModel
CatalogTreeFilterModel::MaxOption
Definition: catalogmodel.h:127
Catalog
This class represents a catalog It uses CatalogStorage interface to work with catalogs in different f...
Definition: catalog.h:74
CatalogTreeFilterModel::NonEmpty
Definition: catalogmodel.h:108
CatalogTreeFilterModel::DifferentInSync
Definition: catalogmodel.h:113
CatalogTreeFilterModel::Empty
Definition: catalogmodel.h:109
QObject::parent
QObject * parent() const
CatalogTreeFilterModel::New
Definition: catalogmodel.h:117
CatalogTreeModel::~CatalogTreeModel
~CatalogTreeModel()
Definition: catalogmodel.h:66
CatalogTreeFilterModel::NotInSync
Definition: catalogmodel.h:114
CatalogTreeFilterModel::AllStates
Definition: catalogmodel.h:128
CatalogTreeModel::DisplayedColumnCount
Definition: catalogmodel.h:57
CatalogTreeFilterModel::CaseInsensitive
Definition: catalogmodel.h:103
CatalogTreeFilterModel::Translated
Definition: catalogmodel.h:121
CatalogTreeFilterModel::setEntryFilteredOut
void setEntryFilteredOut(int entry, bool filteredOut)
Definition: catalogmodel.cpp:234
CatalogTreeFilterModel::NeedsReviewL10n
Definition: catalogmodel.h:123
QVariant
CatalogTreeFilterModel::NonModified
Definition: catalogmodel.h:111
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:06 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

lokalize

Skip menu "lokalize"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal