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

okteta

  • sources
  • kde-4.12
  • kdesdk
  • okteta
  • kasten
  • gui
  • system
bytearrayviewprofilemanager.h
Go to the documentation of this file.
1 /*
2  This file is part of the Okteta Kasten module, made within the KDE community.
3 
4  Copyright 2010,2012 Friedrich W. H. Kossebau <kossebau@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) version 3, or any
10  later version accepted by the membership of KDE e.V. (or its
11  successor approved by the membership of KDE e.V.), which shall
12  act as a proxy defined in Section 6 of version 3 of the license.
13 
14  This library 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 GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #ifndef BYTEARRAYVIEWPROFILEMANAGER_H
24 #define BYTEARRAYVIEWPROFILEMANAGER_H
25 
26 // lib
27 #include "bytearrayviewprofile.h"
28 // Qt
29 #include <QtCore/QObject>
30 #include <QtCore/QList>
31 #include <QtCore/QDateTime>
32 #include <QtCore/QHash>
33 
34 class KDirWatch;
35 
36 
37 namespace Kasten2
38 {
39 class ByteArrayViewProfileLock;
40 
41 
42 class ByteArrayViewProfileFileInfo
43 {
44 public:
45  ByteArrayViewProfileFileInfo( const QDateTime& lastModified, bool )
46  : mLastModified( lastModified )
47  , mLocked( false )
48  {}
49 
50  const QDateTime& lastModified() const { return mLastModified; }
51  bool isLocked() const { return mLocked; }
52 
53  void setLastModified( const QDateTime& lastModified ) { mLastModified = lastModified; }
54  void setLocked( bool isLocked ) { mLocked = isLocked; }
55 
56 private:
57  QDateTime mLastModified;
58  bool mLocked;
59 // bool mUserOwned;
60 };
61 
62 typedef QHash<ByteArrayViewProfile::Id, ByteArrayViewProfileFileInfo> ByteArrayViewProfileFileInfoLookup;
63 
64 
65 class OKTETAKASTENGUI_EXPORT ByteArrayViewProfileManager : public QObject
66 {
67  Q_OBJECT
68 
69  public:
70  ByteArrayViewProfileManager();
71  virtual ~ByteArrayViewProfileManager();
72 
73  public:
74  QList<ByteArrayViewProfile> viewProfiles() const;
75  int viewProfilesCount() const;
76  ByteArrayViewProfile viewProfile( const ByteArrayViewProfile::Id& id ) const;
77  ByteArrayViewProfile::Id defaultViewProfileId() const;
78  ByteArrayViewProfile defaultViewProfile() const;
79  bool isViewProfileLocked( const ByteArrayViewProfile::Id& id ) const;
80 
81  public:
82  void saveViewProfiles( QList<ByteArrayViewProfile>& viewProfiles );
83  void removeViewProfiles( const QList<ByteArrayViewProfile::Id>& viewProfileIds );
84  void setDefaultViewProfile( const ByteArrayViewProfile::Id& viewProfileId );
85 
86  ByteArrayViewProfileLock createLock( const ByteArrayViewProfile::Id& viewProfileId );
87 
88  Q_SIGNALS:
89  void viewProfilesChanged( const QList<Kasten2::ByteArrayViewProfile>& viewProfiles );
90  void viewProfilesRemoved( const QList<Kasten2::ByteArrayViewProfile::Id>& viewProfileIds );
91  void defaultViewProfileChanged( const Kasten2::ByteArrayViewProfile::Id& viewProfileId );
92  void viewProfilesLocked( const QList<Kasten2::ByteArrayViewProfile::Id>& viewProfileIds );
93  void viewProfilesUnlocked( const QList<Kasten2::ByteArrayViewProfile::Id>& viewProfileIds );
94 
95  private:
96  QString filePathOfViewProfile( const ByteArrayViewProfile::Id& viewProfileId ) const;
97  // Returns the viewProfile as loaded from the file with the given fileName.
98  // If the loading fails the viewProfile has no id set.
99  ByteArrayViewProfile loadViewProfile( const QString& fileName ) const;
100  void saveViewProfile( const ByteArrayViewProfile& viewProfile ) const;
101  void removeViewProfile( const ByteArrayViewProfile::Id& viewProfileId );
102 
103  private Q_SLOTS:
104  void onViewProfilesFolderChanged( const QString& path );
105  void onDefaultViewProfileChanged( const QString& path );
106 
107  private:
108  QList<ByteArrayViewProfile> mViewProfiles;
109 
110  ByteArrayViewProfile::Id mDefaultViewProfileId;
111 
112  KDirWatch* mViewProfileFileWatcher;
113 
114  QHash<QString, ByteArrayViewProfileFileInfoLookup> mViewProfileFileInfoLookupPerFolder;
115 };
116 
117 }
118 
119 #endif
Kasten2::ByteArrayViewProfile::Id
QString Id
Definition: bytearrayviewprofile.h:42
Kasten2::ByteArrayViewProfile
Definition: bytearrayviewprofile.h:39
Kasten2::ByteArrayViewProfileFileInfo::isLocked
bool isLocked() const
Definition: bytearrayviewprofilemanager.h:51
Kasten2::ByteArrayViewProfileLock
Definition: bytearrayviewprofilelock.h:38
bytearrayviewprofile.h
QObject
Kasten2::ByteArrayViewProfileFileInfo
Definition: bytearrayviewprofilemanager.h:42
OKTETAKASTENGUI_EXPORT
#define OKTETAKASTENGUI_EXPORT
Definition: oktetakastengui_export.h:36
Kasten2::ByteArrayViewProfileFileInfo::lastModified
const QDateTime & lastModified() const
Definition: bytearrayviewprofilemanager.h:50
Kasten2::ByteArrayViewProfileFileInfoLookup
QHash< ByteArrayViewProfile::Id, ByteArrayViewProfileFileInfo > ByteArrayViewProfileFileInfoLookup
Definition: bytearrayviewprofilemanager.h:62
Kasten2::ByteArrayViewProfileFileInfo::ByteArrayViewProfileFileInfo
ByteArrayViewProfileFileInfo(const QDateTime &lastModified, bool)
Definition: bytearrayviewprofilemanager.h:45
Kasten2::viewProfileIds
static QList< ByteArrayViewProfile::Id > viewProfileIds(const QList< ByteArrayViewProfile > &viewProfiles)
Definition: bytearrayviewprofilemanager.cpp:58
Kasten2::ByteArrayViewProfileManager
Definition: bytearrayviewprofilemanager.h:65
Kasten2::ByteArrayViewProfileFileInfo::setLocked
void setLocked(bool isLocked)
Definition: bytearrayviewprofilemanager.h:54
Kasten2::ByteArrayViewProfileFileInfo::setLastModified
void setLastModified(const QDateTime &lastModified)
Definition: bytearrayviewprofilemanager.h:53
QList
Definition: bookmarkable.h:29
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okteta

Skip menu "okteta"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • 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