File indexing completed on 2024-04-28 16:01:32

0001 /******************************************************************************
0002  * This file is part of the libqgit2 library
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2.1 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Lesser General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Lesser General Public
0015  * License along with this library; if not, write to the Free Software
0016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0017  */
0018 
0019 #ifndef LIBQGIT2_REMOTE_H
0020 #define LIBQGIT2_REMOTE_H
0021 
0022 #include "libqgit2_export.h"
0023 #include "qgitcredentials.h"
0024 
0025 #include <QtCore/QSharedPointer>
0026 
0027 struct git_remote;
0028 
0029 namespace LibQGit2 {
0030 
0031 /**
0032  * @brief Represents a git remote
0033  *
0034  * @ingroup LibQGit2
0035  * @{
0036  */
0037 class LIBQGIT2_EXPORT Remote : public QObject
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     /**
0043      * @param remote The raw remote pointer. This needs to be initialized beforehand.
0044      *        This object takes ownership of this pointer and frees it when this object is destructed.
0045      * @param credentials Credentials to be used with this remote if any.
0046      * @param parent The parent of this QObject.
0047      */
0048     explicit Remote(git_remote *remote, const Credentials &credentials = Credentials(), QObject *parent = 0);
0049 
0050     /**
0051      * Gets the URL specified for this remote.
0052      */
0053     QString url() const;
0054 
0055     /**
0056      * Perform a push on this Remote.
0057      * @param refSpecs The refspecs to use for pushing. If left empty the configured refspecs will be used.
0058      * @throws LibQGit2::Exception
0059      */
0060     void push(const QList<QString> &refSpecs = QList<QString>());
0061 
0062     git_remote* data() const;
0063 
0064 signals:
0065     void transferProgress(int);
0066 
0067 private:
0068     Q_DISABLE_COPY(Remote)
0069 
0070     struct Private;
0071     QSharedPointer<Private> d_ptr;
0072 };
0073 
0074 /** @} */
0075 
0076 }
0077 
0078 #endif // LIBQGIT2_REMOTE_H