File: workingdirectory.h

package info (click to toggle)
dlt-viewer 2.27.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 9,196 kB
  • sloc: cpp: 31,376; ansic: 4,224; xml: 492; sh: 244; makefile: 81
file content (74 lines) | stat: -rw-r--r-- 2,328 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef WORKINGDIRERCTORY_H
#define WORKINGDIRERCTORY_H

#include <QObject>
#include <QString>

/*!
* \brief The WorkingDirerctory class
* This is a convenience class to access the different working directories
* stored in the config.ini of the viewer. The config.ini is accessed through
* QDltSettingsManager.
*\sa QDltSettingsManager
*/
class WorkingDirectory : public QObject
{
    Q_OBJECT
public:
    enum WorkingDirectoryType {
        LogFile,
        ProjectFile,
        FilterFile,
        ExportDir,
        PluginConfig
    };

public:
    WorkingDirectory();
    /*!
     * \brief getDirectory
     * Get working directory for specific type of operation.
     * \param type Type of operation defined in WorkingDirectoryType
     * \param extra Optional parameter. Used for getting settings for a plugin
     * \return Current working directory for the operation
     * \sa WorkingDirectoryType
     */
    QString getDirectory(WorkingDirectoryType type, QString extra = QString());

    //! Get working directory for DLT files
    QString getDltDirectory();
    //! Get working directory for Project files
    QString getDlpDirectory();
    //! Get working directory for Filter files
    QString getDlfDirectory();
    //! Get working directory for export files
    QString getExportDirectory();
    //! Get working directory for plugin configuration
    QString getPluginDirectory(QString pluginName);

    /*!
     * \brief setDirectory
     * Set directory for specific type of operation.
     * \param type The type defined by WorkingDirectoryType.
     * \param extra Possible plugin name.
     * \sa WorkingDirectoryType
     */
    void setDirectory(WorkingDirectoryType type, QString dir, QString extra = QString());

    //! Set working directory for DLT files
    void setDltDirectory(QString dir);
    //! Set working directory for Project files
    void setDlpDirectory(QString dir);
    //! Set working directory for Filter files
    void setDlfDirectory(QString dir);
    //! Set working directory for export files
    void setExportDirectory(QString dir);
    //! Set working directory for plugin configuration
    void setPluginDirectory(QString pluginName, QString dir);

    // Helpers
private:
    QString createKeyFor(WorkingDirectoryType type, QString extra);
};

#endif // WORKINGDIRERCTORY_H