Warning, file /utilities/okteta/kasten/gui/io/bytearrayviewprofilesynchronizer.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2012 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef KASTEN_BYTEARRAYVIEWPROFILESYNCHRONIZER_HPP
0010 #define KASTEN_BYTEARRAYVIEWPROFILESYNCHRONIZER_HPP
0011 
0012 // lib
0013 #include "oktetakastengui_export.hpp"
0014 #include "bytearrayviewprofile.hpp"
0015 // Kasten core
0016 #include <Kasten/KastenCore>
0017 // Qt Core
0018 #include <QObject>
0019 
0020 namespace Kasten {
0021 
0022 class ByteArrayViewProfileManager;
0023 class ByteArrayView;
0024 
0025 class OKTETAKASTENGUI_EXPORT ByteArrayViewProfileSynchronizer : public QObject
0026 {
0027     Q_OBJECT
0028 
0029     enum DirtyFlags
0030     {
0031         ShowsNonprintingChanged = 1 << 0,
0032         ValueCodingChanged = 1 << 1,
0033         CharCodecChanged = 1 << 2,
0034         SubstituteCharChanged = 1 << 3,
0035         UndefinedCharChanged = 1 << 4,
0036         VisibleByteArrayCodingsChanged = 1 << 5,
0037         OffsetColumnVisibleChanged = 1 << 6,
0038         NoOfBytesPerLineChanged = 1 << 7,
0039         NoOfGroupedBytesChanged = 1 << 8,
0040         LayoutStyleChanged = 1 << 9,
0041         ViewModusChanged = 1 << 10,
0042         OffsetCodingChanged = 1 << 11
0043     };
0044 
0045 public:
0046     explicit ByteArrayViewProfileSynchronizer(ByteArrayViewProfileManager* viewProfileManager);
0047 
0048 public:
0049 //     AbstractLoadJob *startLoad( const QUrl &url );
0050     void syncToRemote();
0051     void syncFromRemote();
0052 //     AbstractConnectJob *startConnect( AbstractDocument* document,
0053 //                                               const QUrl& url, AbstractModelSynchronizer::ConnectOption option );
0054 
0055     ByteArrayView* view() const;
0056     ByteArrayViewProfile::Id viewProfileId() const;
0057 
0058     void setView(ByteArrayView* view);
0059     void setViewProfileId(const ByteArrayViewProfile::Id& viewProfileId);
0060 
0061     LocalSyncState localSyncState() const;
0062 
0063 Q_SIGNALS:
0064     void localSyncStateChanged(Kasten::LocalSyncState newState);
0065     void viewProfileChanged(const Kasten::ByteArrayViewProfile::Id& viewProfileId);
0066 
0067 private Q_SLOTS:
0068     OKTETAKASTENGUI_NO_EXPORT void onViewProfilesChanged(const QVector<Kasten::ByteArrayViewProfile>& viewProfiles);
0069     OKTETAKASTENGUI_NO_EXPORT void onViewProfilesRemoved(const QVector<Kasten::ByteArrayViewProfile::Id>& viewProfileIds);
0070 
0071     // TODO: turn to one signal/slot with enum parameter for property and QVariant as new value
0072     OKTETAKASTENGUI_NO_EXPORT void onShowsNonprintingChanged();
0073     OKTETAKASTENGUI_NO_EXPORT void onOffsetCodingChanged();
0074     OKTETAKASTENGUI_NO_EXPORT void onValueCodingChanged();
0075     OKTETAKASTENGUI_NO_EXPORT void onCharCodecChanged();
0076     OKTETAKASTENGUI_NO_EXPORT void onSubstituteCharChanged();
0077     OKTETAKASTENGUI_NO_EXPORT void onUndefinedCharChanged();
0078     OKTETAKASTENGUI_NO_EXPORT void onVisibleByteArrayCodingsChanged();
0079     OKTETAKASTENGUI_NO_EXPORT void onOffsetColumnVisibleChanged();
0080     OKTETAKASTENGUI_NO_EXPORT void onNoOfBytesPerLineChanged();
0081     OKTETAKASTENGUI_NO_EXPORT void onNoOfGroupedBytesChanged();
0082     OKTETAKASTENGUI_NO_EXPORT void onLayoutStyleChanged();
0083     OKTETAKASTENGUI_NO_EXPORT void onViewModusChanged();
0084 
0085 private:
0086     OKTETAKASTENGUI_NO_EXPORT void updateView(const ByteArrayViewProfile& viewProfile);
0087     OKTETAKASTENGUI_NO_EXPORT void updateViewProfile(ByteArrayViewProfile& viewProfile);
0088     OKTETAKASTENGUI_NO_EXPORT void setDirtyFlag(int dirtyFlag);
0089     OKTETAKASTENGUI_NO_EXPORT void connectViewSignals();
0090 
0091 private:
0092     ByteArrayView* mView = nullptr;
0093     ByteArrayViewProfile::Id mViewProfileId;
0094     int mDirtyFlags = 0;
0095     bool mUpdatingView = false;
0096 
0097     ByteArrayViewProfileManager* mViewProfileManager;
0098 };
0099 
0100 inline ByteArrayView* ByteArrayViewProfileSynchronizer::view() const { return mView; }
0101 inline ByteArrayViewProfile::Id ByteArrayViewProfileSynchronizer::viewProfileId() const { return mViewProfileId; }
0102 
0103 }
0104 
0105 #endif