summaryrefslogtreecommitdiffstats
path: root/vcs/cvsservice/cvsoptions.h
blob: c4daf301e1c3c09345ca04d703783ba0d291944e (plain)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/***************************************************************************
 *   Copyright (C) 2003 by Mario Scalas                                    *
 *   mario.scalas@libero.it                                                *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef CVSOPTIONS_H
#define CVSOPTIONS_H

#include <tqstring.h>
#include <tqdom.h>

class CvsServicePart;
class TDEConfig;
class KDevProject;

/* This class represents the command line options for the used cvs commands.
 * It uses the singleton pattern.
 * @author Mario Scalas <mario.scalas@libero.it>
*/
class CvsOptions
{
public:
    static CvsOptions *instance();

    static TQString invalidLocation;

    virtual ~CvsOptions();

    void save( KDevProject *project );
    /// \FIXME parameter should be const!!
    void load( KDevProject *project );

    void setRecursiveWhenCommitRemove( bool b );
    bool recursiveWhenCommitRemove() const;

    void setPruneEmptyDirsWhenUpdate( bool b );
    bool pruneEmptyDirsWhenUpdate() const;

    void setRecursiveWhenUpdate( bool b );
    bool recursiveWhenUpdate() const;

    void setCreateDirsWhenUpdate( bool b );
    bool createDirsWhenUpdate() const;

    void setDiffOptions( const TQString &p );
    TQString diffOptions();

    void setRevertOptions( const TQString &p );
    TQString revertOptions();

    void setCvsRshEnvVar( const TQString &p );
    TQString cvsRshEnvVar();

    /**
    * Will try to determine location by using CVS/Root file
    */
    TQString guessLocation( const TQString &projectDir ) const;

    /**
    * Set server path string (this should be called by the part when a new project
    * is created or imported)
    * @param p (i.e. :pserver:marios@cvs.kde.org:/home/kde)
    */
    void setLocation( const TQString &p );
    /**
    * @result remote path (i.e. :pserver:marios@cvs.kde.org:/home/kde)
    */
    TQString location();

    void setContextLines( unsigned int contextLines );
    unsigned int contextLines() const;

    void setCompressionLevel( unsigned int compressionLevel = 0 );
    unsigned int compressionLevel() const;

private:
    // Cache
    bool m_recursiveWhenCommitRemove;
    bool m_pruneEmptyDirsWhenUpdate;
    bool m_recursiveWhenUpdate;
    bool m_createDirsWhenUpdate;
    TQString m_revertOptions;
    TQString m_diffOptions;
    TQString m_cvsRshEnvVar;
    TQString m_location;
    unsigned int m_compressionLevel;
    unsigned int m_contextLines;
    //! So we can access cvssservice configuration (repositories first of all)
    TDEConfig *m_serviceConfig;

    static CvsOptions *m_instance;
    CvsOptions();
};

#endif  // CVSOPTIONS_H