File indexing completed on 2025-01-19 04:22:43

0001 /*
0002 SPDX-FileCopyrightText: 2021 Hamed Masafi <hamed.masfi@gmail.com>
0003 
0004 SPDX-License-Identifier: GPL-3.0-or-later
0005 */
0006 
0007 #include "commandaddremote.h"
0008 
0009 namespace Git
0010 {
0011 
0012 CommandAddRemote::CommandAddRemote(QObject *parent)
0013     : AbstractCommand{parent}
0014 {
0015 }
0016 
0017 QStringList CommandAddRemote::generateArgs() const
0018 {
0019     QStringList args{QStringLiteral("remote"), QStringLiteral("add")};
0020 
0021     if (mFetch)
0022         args << QStringLiteral("--fetch");
0023     if (mMirror)
0024         args << QStringLiteral("--mirrot");
0025     appendBool(mTags, args, QStringLiteral("tags"));
0026 
0027     if (!mMaster.isEmpty())
0028         args << QStringLiteral("--master=") + mMaster;
0029 
0030     args << mRemoteName << mUrl;
0031     return args;
0032 }
0033 
0034 const QString &CommandAddRemote::remoteName() const
0035 {
0036     return mRemoteName;
0037 }
0038 
0039 void CommandAddRemote::setRemoteName(const QString &newRemoteName)
0040 {
0041     mRemoteName = newRemoteName;
0042 }
0043 
0044 OptionalBool CommandAddRemote::tags() const
0045 {
0046     return mTags;
0047 }
0048 
0049 void CommandAddRemote::setTags(OptionalBool newTags)
0050 {
0051     mTags = newTags;
0052 }
0053 
0054 void CommandAddRemote::setTags(Qt::CheckState newTags)
0055 {
0056     setTags(checkStateToOptionalBool(newTags));
0057 }
0058 
0059 bool CommandAddRemote::mirror() const
0060 {
0061     return mMirror;
0062 }
0063 
0064 void CommandAddRemote::setMirror(bool newMirror)
0065 {
0066     mMirror = newMirror;
0067 }
0068 
0069 const QString &CommandAddRemote::master() const
0070 {
0071     return mMaster;
0072 }
0073 
0074 void CommandAddRemote::setMaster(const QString &newMaster)
0075 {
0076     mMaster = newMaster;
0077 }
0078 
0079 bool CommandAddRemote::fetch() const
0080 {
0081     return mFetch;
0082 }
0083 
0084 void CommandAddRemote::setFetch(bool newFetch)
0085 {
0086     mFetch = newFetch;
0087 }
0088 
0089 const QString &CommandAddRemote::url() const
0090 {
0091     return mUrl;
0092 }
0093 
0094 void CommandAddRemote::setUrl(const QString &newUrl)
0095 {
0096     mUrl = newUrl;
0097 }
0098 
0099 } // namespace Git