4 * This file is part of CameraPlus.
6 * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28 #include <QDeclarativeParserStatus>
30 #include <QQmlParserStatus>
32 #include "fileindex.h"
37 class FileNaming : public QObject, public QDeclarativeParserStatus {
39 class FileNaming : public QObject, public QQmlParserStatus {
44 Q_PROPERTY(QString imageSuffix READ imageSuffix WRITE setImageSuffix NOTIFY imageSuffixChanged);
45 Q_PROPERTY(QString videoSuffix READ videoSuffix WRITE setVideoSuffix NOTIFY videoSuffixChanged);
46 Q_PROPERTY(QString imagePath READ imagePath WRITE setImagePath NOTIFY imagePathChanged);
47 Q_PROPERTY(QString videoPath READ videoPath WRITE setVideoPath NOTIFY videoPathChanged);
48 Q_PROPERTY(QString temporaryVideoPath READ temporaryVideoPath WRITE setTemporaryVideoPath NOTIFY temporaryVideoPathChanged);
49 Q_PROPERTY(Settings *settings READ settings WRITE setSettings NOTIFY settingsChanged);
52 FileNaming(QObject *parent = 0);
55 QString imageSuffix() const;
56 void setImageSuffix(const QString& suffix);
58 QString videoSuffix() const;
59 void setVideoSuffix(const QString& suffix);
61 Q_INVOKABLE QString imageFileName();
62 Q_INVOKABLE QString videoFileName();
63 Q_INVOKABLE QString temporaryVideoFileName();
65 QString imagePath() const;
66 void setImagePath(const QString& path);
68 QString videoPath() const;
69 void setVideoPath(const QString& path);
71 QString temporaryVideoPath() const;
72 void setTemporaryVideoPath(const QString& path);
74 Settings *settings() const;
75 void setSettings(Settings *settings);
77 virtual void classBegin();
78 virtual void componentComplete();
81 void imageSuffixChanged();
82 void videoSuffixChanged();
83 void imagePathChanged();
84 void videoPathChanged();
85 void temporaryVideoPathChanged();
86 void settingsChanged();
90 Image = FileIndex::Image,
91 Video = FileIndex::Video,
94 QString fileName(const QString& path, const QString& suffix, const Type& type);
95 QString canonicalPath(const QString& path);
96 QString temporaryPath();
98 QString m_imageSuffix;
99 QString m_videoSuffix;
102 QString m_temporaryVideoPath;
104 Settings *m_settings;
108 #endif /* FILE_NAMING_H */