~ubuntu-branches/ubuntu/vivid/kdesdk/vivid

« back to all changes in this revision

Viewing changes to okteta/kasten/gui/io/bytearrayviewprofilesynchronizer.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-06-06 11:49:54 UTC
  • mfrom: (0.4.21)
  • Revision ID: package-import@ubuntu.com-20120606114954-rdls73fzlpzxglbx
Tags: 4:4.8.80-0ubuntu1
* New uptream beta release
* Update dont_export_private_classes.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    This file is part of the Okteta Kasten module, made within the KDE community.
 
3
 
 
4
    Copyright 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 BYTEARRAYVIEWPROFILESYNCHRONIZER_H
 
24
#define BYTEARRAYVIEWPROFILESYNCHRONIZER_H
 
25
 
 
26
// lib
 
27
#include "oktetakastengui_export.h"
 
28
#include <bytearrayviewprofile.h>
 
29
// Kasten core
 
30
#include <kastencore.h>
 
31
// Qt Core
 
32
#include <QtCore/QObject>
 
33
 
 
34
 
 
35
namespace Kasten2
 
36
{
 
37
 
 
38
class ByteArrayViewProfileManager;
 
39
class ByteArrayView;
 
40
 
 
41
class OKTETAKASTENGUI_EXPORT ByteArrayViewProfileSynchronizer : public QObject
 
42
{
 
43
    Q_OBJECT
 
44
 
 
45
    enum DirtyFlags
 
46
    {
 
47
        ShowsNonprintingChanged = 1 << 0,
 
48
        ValueCodingChanged = 1 << 1,
 
49
        CharCodecChanged = 1 << 2,
 
50
        SubstituteCharChanged = 1 << 3,
 
51
        UndefinedCharChanged = 1 << 4,
 
52
        VisibleByteArrayCodingsChanged = 1 << 5,
 
53
        OffsetColumnVisibleChanged = 1 << 6,
 
54
        NoOfBytesPerLineChanged = 1 << 7,
 
55
        NoOfGroupedBytesChanged = 1 << 8,
 
56
        LayoutStyleChanged = 1 << 9,
 
57
        ViewModusChanged = 1 << 10
 
58
    };
 
59
 
 
60
  public:
 
61
    explicit ByteArrayViewProfileSynchronizer( ByteArrayViewProfileManager* viewProfileManager );
 
62
 
 
63
  public:
 
64
//     AbstractLoadJob *startLoad( const KUrl &url );
 
65
    void syncToRemote();
 
66
    void syncFromRemote();
 
67
//     AbstractConnectJob *startConnect( AbstractDocument* document,
 
68
//                                               const KUrl& url, AbstractModelSynchronizer::ConnectOption option );
 
69
 
 
70
    ByteArrayView* view() const;
 
71
    ByteArrayViewProfile::Id viewProfileId() const;
 
72
 
 
73
    void setView( ByteArrayView* view );
 
74
    void setViewProfileId( const ByteArrayViewProfile::Id& viewProfileId );
 
75
 
 
76
    LocalSyncState localSyncState() const;
 
77
 
 
78
  Q_SIGNALS:
 
79
    void localSyncStateChanged( Kasten2::LocalSyncState newState );
 
80
    void viewProfileChanged( const Kasten2::ByteArrayViewProfile::Id& viewProfileId );
 
81
 
 
82
  private Q_SLOTS:
 
83
    void onViewProfilesChanged( const QList<Kasten2::ByteArrayViewProfile>& viewProfiles );
 
84
    void onViewProfilesRemoved( const QList<Kasten2::ByteArrayViewProfile::Id>& viewProfileIds );
 
85
 
 
86
    // TODO: turn to one signal/slot with enum parameter for property and QVariant as new value
 
87
    void onShowsNonprintingChanged();
 
88
    void onValueCodingChanged();
 
89
    void onCharCodecChanged();
 
90
    void onSubstituteCharChanged();
 
91
    void onUndefinedCharChanged();
 
92
    void onVisibleByteArrayCodingsChanged();
 
93
    void onOffsetColumnVisibleChanged();
 
94
    void onNoOfBytesPerLineChanged();
 
95
    void onNoOfGroupedBytesChanged();
 
96
    void onLayoutStyleChanged();
 
97
    void onViewModusChanged();
 
98
 
 
99
  private:
 
100
    void updateView( const ByteArrayViewProfile& viewProfile );
 
101
    void updateViewProfile( ByteArrayViewProfile& viewProfile );
 
102
    void setDirtyFlag( int dirtyFlag );
 
103
 
 
104
  private:
 
105
    ByteArrayView* mView;
 
106
    ByteArrayViewProfile::Id mViewProfileId;
 
107
    int mDirtyFlags;
 
108
    bool mUpdatingView;
 
109
 
 
110
    ByteArrayViewProfileManager* mViewProfileManager;
 
111
};
 
112
 
 
113
 
 
114
inline ByteArrayView* ByteArrayViewProfileSynchronizer::view() const { return mView; }
 
115
inline ByteArrayViewProfile::Id ByteArrayViewProfileSynchronizer::viewProfileId() const { return mViewProfileId; }
 
116
 
 
117
}
 
118
 
 
119
 
 
120
#endif