forked from qt-creator/qt-creator
		
	Fixes: Refactor git settings code, add some more menu options
This commit is contained in:
		@@ -18,7 +18,8 @@ HEADERS += gitplugin.h \
 | 
			
		||||
    annotationhighlighter.h \
 | 
			
		||||
    gitsubmiteditorwidget.h \
 | 
			
		||||
    gitsubmiteditor.h \
 | 
			
		||||
    gitversioncontrol.h
 | 
			
		||||
    gitversioncontrol.h \
 | 
			
		||||
    gitsettings.h
 | 
			
		||||
 | 
			
		||||
SOURCES += gitplugin.cpp \
 | 
			
		||||
    gitoutputwindow.cpp \
 | 
			
		||||
@@ -30,7 +31,8 @@ SOURCES += gitplugin.cpp \
 | 
			
		||||
    annotationhighlighter.cpp \
 | 
			
		||||
    gitsubmiteditorwidget.cpp \
 | 
			
		||||
    gitsubmiteditor.cpp \
 | 
			
		||||
    gitversioncontrol.cpp
 | 
			
		||||
    gitversioncontrol.cpp \
 | 
			
		||||
    gitsettings.cpp
 | 
			
		||||
 | 
			
		||||
FORMS += changeselectiondialog.ui \
 | 
			
		||||
    settingspage.ui \
 | 
			
		||||
 
 | 
			
		||||
@@ -88,6 +88,8 @@ GitClient::GitClient(GitPlugin* plugin, Core::ICore *core) :
 | 
			
		||||
    m_plugin(plugin),
 | 
			
		||||
    m_core(core)
 | 
			
		||||
{
 | 
			
		||||
    if (QSettings *s = m_core->settings())
 | 
			
		||||
        m_settings.fromSettings(s);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GitClient::~GitClient()
 | 
			
		||||
@@ -178,7 +180,7 @@ void GitClient::diff(const QString &workingDirectory, const QStringList &fileNam
 | 
			
		||||
    const QString title = tr("Git Diff");
 | 
			
		||||
 | 
			
		||||
    VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, workingDirectory, true, "originalFileName", workingDirectory);
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->m_outputWindow, editor);
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), editor);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -196,27 +198,26 @@ void GitClient::diff(const QString &workingDirectory, const QString &fileName)
 | 
			
		||||
    const QString sourceFile = source(workingDirectory, fileName);
 | 
			
		||||
 | 
			
		||||
    VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, sourceFile, true, "originalFileName", sourceFile);
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->m_outputWindow, editor);
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), editor);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitClient::status(const QString &workingDirectory)
 | 
			
		||||
{
 | 
			
		||||
    QStringList statusArgs(QLatin1String("status"));
 | 
			
		||||
    statusArgs << QLatin1String("-u");
 | 
			
		||||
    executeGit(workingDirectory, statusArgs, m_plugin->m_outputWindow, 0,true);
 | 
			
		||||
    executeGit(workingDirectory, statusArgs, m_plugin->outputWindow(), 0,true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitClient::log(const QString &workingDirectory, const QString &fileName)
 | 
			
		||||
{
 | 
			
		||||
    if (Git::Constants::debug)
 | 
			
		||||
        qDebug() << "log" << workingDirectory << fileName;
 | 
			
		||||
    QStringList arguments;
 | 
			
		||||
    int logCount = 10;
 | 
			
		||||
    if (m_plugin->m_settingsPage && m_plugin->m_settingsPage->logCount() > 0)
 | 
			
		||||
        logCount = m_plugin->m_settingsPage->logCount();
 | 
			
		||||
 | 
			
		||||
    arguments << QLatin1String("log") << QLatin1String("-n")
 | 
			
		||||
        << QString::number(logCount);
 | 
			
		||||
    QStringList arguments(QLatin1String("log"));
 | 
			
		||||
 | 
			
		||||
    if (m_settings.logCount > 0)
 | 
			
		||||
         arguments << QLatin1String("-n") << QString::number(m_settings.logCount);
 | 
			
		||||
 | 
			
		||||
    if (!fileName.isEmpty())
 | 
			
		||||
        arguments << fileName;
 | 
			
		||||
 | 
			
		||||
@@ -224,7 +225,7 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName)
 | 
			
		||||
    const QString kind = QLatin1String(Git::Constants::GIT_LOG_EDITOR_KIND);
 | 
			
		||||
    const QString sourceFile = source(workingDirectory, fileName);
 | 
			
		||||
    VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, sourceFile, false, "logFileName", sourceFile);
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->m_outputWindow, editor);
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), editor);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitClient::show(const QString &source, const QString &id)
 | 
			
		||||
@@ -240,7 +241,7 @@ void GitClient::show(const QString &source, const QString &id)
 | 
			
		||||
 | 
			
		||||
    const QFileInfo sourceFi(source);
 | 
			
		||||
    const QString workDir = sourceFi.isDir() ? sourceFi.absoluteFilePath() : sourceFi.absolutePath();
 | 
			
		||||
    executeGit(workDir, arguments, m_plugin->m_outputWindow, editor);
 | 
			
		||||
    executeGit(workDir, arguments, m_plugin->outputWindow(), editor);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitClient::blame(const QString &workingDirectory, const QString &fileName)
 | 
			
		||||
@@ -255,7 +256,7 @@ void GitClient::blame(const QString &workingDirectory, const QString &fileName)
 | 
			
		||||
    const QString sourceFile = source(workingDirectory, fileName);
 | 
			
		||||
 | 
			
		||||
    VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, sourceFile, true, "blameFileName", sourceFile);
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->m_outputWindow, editor);
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), editor);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitClient::checkout(const QString &workingDirectory, const QString &fileName)
 | 
			
		||||
@@ -269,7 +270,7 @@ void GitClient::checkout(const QString &workingDirectory, const QString &fileNam
 | 
			
		||||
    arguments << QLatin1String("checkout") << QLatin1String("HEAD") << QLatin1String("--")
 | 
			
		||||
            << fileName;
 | 
			
		||||
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->m_outputWindow, 0,true);
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0,true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitClient::hardReset(const QString &workingDirectory, const QString &commit)
 | 
			
		||||
@@ -279,7 +280,7 @@ void GitClient::hardReset(const QString &workingDirectory, const QString &commit
 | 
			
		||||
    if (!commit.isEmpty())
 | 
			
		||||
        arguments << commit;
 | 
			
		||||
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->m_outputWindow, 0,true);
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0,true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitClient::addFile(const QString &workingDirectory, const QString &fileName)
 | 
			
		||||
@@ -287,7 +288,7 @@ void GitClient::addFile(const QString &workingDirectory, const QString &fileName
 | 
			
		||||
    QStringList arguments;
 | 
			
		||||
    arguments << QLatin1String("add") << fileName;
 | 
			
		||||
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->m_outputWindow, 0,true);
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0,true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool GitClient::synchronousAdd(const QString &workingDirectory, const QStringList &files)
 | 
			
		||||
@@ -302,8 +303,8 @@ bool GitClient::synchronousAdd(const QString &workingDirectory, const QStringLis
 | 
			
		||||
    if (!rc) {
 | 
			
		||||
        const QString errorMessage = tr("Unable to add %n file(s) to %1: %2", 0, files.size()).
 | 
			
		||||
                                     arg(workingDirectory, QString::fromLocal8Bit(errorText));
 | 
			
		||||
        m_plugin->m_outputWindow->append(errorMessage);
 | 
			
		||||
        m_plugin->m_outputWindow->popup(false);
 | 
			
		||||
        m_plugin->outputWindow()->append(errorMessage);
 | 
			
		||||
        m_plugin->outputWindow()->popup(false);
 | 
			
		||||
    }
 | 
			
		||||
    return rc;
 | 
			
		||||
}
 | 
			
		||||
@@ -319,14 +320,14 @@ bool GitClient::synchronousReset(const QString &workingDirectory,
 | 
			
		||||
    arguments << QLatin1String("reset") << QLatin1String("HEAD") << QLatin1String("--") << files;
 | 
			
		||||
    const bool rc = synchronousGit(workingDirectory, arguments, &outputText, &errorText);
 | 
			
		||||
    const QString output = QString::fromLocal8Bit(outputText);
 | 
			
		||||
    m_plugin->m_outputWindow->popup(false);
 | 
			
		||||
    m_plugin->m_outputWindow->append(output);
 | 
			
		||||
    m_plugin->outputWindow()->popup(false);
 | 
			
		||||
    m_plugin->outputWindow()->append(output);
 | 
			
		||||
    // Note that git exits with 1 even if the operation is successful
 | 
			
		||||
    // Assume real failure if the output does not contain "foo.cpp modified"
 | 
			
		||||
    if (!rc && !output.contains(QLatin1String("modified"))) {
 | 
			
		||||
        const QString errorMessage = tr("Unable to reset %n file(s) in %1: %2", 0, files.size()).
 | 
			
		||||
                                     arg(workingDirectory, QString::fromLocal8Bit(errorText));
 | 
			
		||||
        m_plugin->m_outputWindow->append(errorMessage);
 | 
			
		||||
        m_plugin->outputWindow()->append(errorMessage);
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    return true;
 | 
			
		||||
@@ -339,13 +340,13 @@ void GitClient::executeGit(const QString &workingDirectory, const QStringList &a
 | 
			
		||||
    if (Git::Constants::debug)
 | 
			
		||||
        qDebug() << "executeGit" << workingDirectory << arguments << editor;
 | 
			
		||||
 | 
			
		||||
    m_plugin->m_outputWindow->append(formatCommand(QLatin1String(kGitCommand), arguments));
 | 
			
		||||
    m_plugin->outputWindow()->append(formatCommand(QLatin1String(kGitCommand), arguments));
 | 
			
		||||
 | 
			
		||||
    QProcess process;
 | 
			
		||||
    ProjectExplorer::Environment environment = ProjectExplorer::Environment::systemEnvironment();
 | 
			
		||||
 | 
			
		||||
    if (m_plugin->m_settingsPage && !m_plugin->m_settingsPage->adoptEnvironment())
 | 
			
		||||
        environment.set(QLatin1String("PATH"), m_plugin->m_settingsPage->path());
 | 
			
		||||
    if (m_settings.adoptPath)
 | 
			
		||||
        environment.set(QLatin1String("PATH"), m_settings.path);
 | 
			
		||||
 | 
			
		||||
    GitCommand* command = new GitCommand();
 | 
			
		||||
    if (outputToWindow) {
 | 
			
		||||
@@ -373,14 +374,14 @@ bool GitClient::synchronousGit(const QString &workingDirectory
 | 
			
		||||
        qDebug() << "synchronousGit" << workingDirectory << arguments;
 | 
			
		||||
    const QString binary = QLatin1String(kGitCommand);
 | 
			
		||||
 | 
			
		||||
    m_plugin->m_outputWindow->append(formatCommand(binary, arguments));
 | 
			
		||||
    m_plugin->outputWindow()->append(formatCommand(binary, arguments));
 | 
			
		||||
 | 
			
		||||
    QProcess process;
 | 
			
		||||
    process.setWorkingDirectory(workingDirectory);
 | 
			
		||||
 | 
			
		||||
    ProjectExplorer::Environment environment = ProjectExplorer::Environment::systemEnvironment();
 | 
			
		||||
    if (m_plugin->m_settingsPage && !m_plugin->m_settingsPage->adoptEnvironment())
 | 
			
		||||
        environment.set(QLatin1String("PATH"), m_plugin->m_settingsPage->path());
 | 
			
		||||
    if (m_settings.adoptPath)
 | 
			
		||||
        environment.set(QLatin1String("PATH"), m_settings.path);
 | 
			
		||||
    process.setEnvironment(environment.toStringList());
 | 
			
		||||
 | 
			
		||||
    process.start(binary, arguments);
 | 
			
		||||
@@ -417,6 +418,34 @@ static inline QString trimFileSpecification(QString fileSpec)
 | 
			
		||||
    return fileSpec;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory,
 | 
			
		||||
                                             bool untracked,
 | 
			
		||||
                                             QString *output,
 | 
			
		||||
                                             QString *errorMessage)
 | 
			
		||||
{
 | 
			
		||||
    // Run 'status'. Note that git returns exitcode 1 if there are no added files.
 | 
			
		||||
    QByteArray outputText;
 | 
			
		||||
    QByteArray errorText;
 | 
			
		||||
    QStringList statusArgs(QLatin1String("status"));
 | 
			
		||||
    if (untracked)
 | 
			
		||||
        statusArgs << QLatin1String("-u");
 | 
			
		||||
    const bool statusRc = synchronousGit(workingDirectory, statusArgs, &outputText, &errorText);
 | 
			
		||||
    if (output)
 | 
			
		||||
        *output = QString::fromLocal8Bit(outputText).remove(QLatin1Char('\r'));
 | 
			
		||||
    // Is it something really fatal?
 | 
			
		||||
    if (!statusRc && !outputText.contains(kBranchIndicatorC)) {
 | 
			
		||||
        if (errorMessage) {
 | 
			
		||||
            const QString error = QString::fromLocal8Bit(errorText).remove(QLatin1Char('\r'));
 | 
			
		||||
            *errorMessage = tr("Unable to obtain the status: %1").arg(error);
 | 
			
		||||
        }
 | 
			
		||||
        return StatusFailed;
 | 
			
		||||
    }
 | 
			
		||||
    // Unchanged?
 | 
			
		||||
    if (outputText.contains("nothing to commit"))
 | 
			
		||||
        return StatusUnchanged;
 | 
			
		||||
    return StatusChanged;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Parse a git status file list:
 | 
			
		||||
 * \code
 | 
			
		||||
    # Changes to be committed:
 | 
			
		||||
@@ -517,24 +546,15 @@ bool GitClient::getCommitData(const QString &workingDirectory,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Run status. Note that it has exitcode 1 if there are no added files.
 | 
			
		||||
    QByteArray outputText;
 | 
			
		||||
    QByteArray errorText;
 | 
			
		||||
    QStringList statusArgs(QLatin1String("status"));
 | 
			
		||||
 | 
			
		||||
    if (untrackedFilesInCommit)
 | 
			
		||||
        statusArgs << QLatin1String("-u");
 | 
			
		||||
    const bool statusRc = synchronousGit(repoDirectory, statusArgs, &outputText, &errorText);
 | 
			
		||||
    if (!statusRc) {
 | 
			
		||||
        // Something fatal
 | 
			
		||||
        if (!outputText.contains(kBranchIndicatorC)) {
 | 
			
		||||
            *errorMessage = tr("Unable to obtain the project status: %1").arg(QString::fromLocal8Bit(errorText));
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        // All unchanged
 | 
			
		||||
        if (outputText.contains("nothing to commit")) {
 | 
			
		||||
            *errorMessage = tr("There are no modified files.");
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
    QString output;
 | 
			
		||||
    switch (gitStatus(repoDirectory, untrackedFilesInCommit, &output, errorMessage)) {
 | 
			
		||||
    case  StatusChanged:
 | 
			
		||||
        break;
 | 
			
		||||
    case StatusUnchanged:
 | 
			
		||||
        *errorMessage = tr("There are no modified files.");
 | 
			
		||||
        return false;
 | 
			
		||||
    case StatusFailed:
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //    Output looks like:
 | 
			
		||||
@@ -555,7 +575,7 @@ bool GitClient::getCommitData(const QString &workingDirectory,
 | 
			
		||||
    //    #
 | 
			
		||||
    //    #       list of files...
 | 
			
		||||
 | 
			
		||||
    const QStringList lines = QString::fromLocal8Bit(outputText).remove(QLatin1Char('\r')).split(QLatin1Char('\n'));
 | 
			
		||||
    const QStringList lines = output.split(QLatin1Char('\n'));
 | 
			
		||||
    if (!parseFiles(lines, d)) {
 | 
			
		||||
        *errorMessage = tr("Unable to parse the file output.");
 | 
			
		||||
        return false;
 | 
			
		||||
@@ -610,22 +630,62 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
 | 
			
		||||
    QByteArray errorText;
 | 
			
		||||
    const bool rc = synchronousGit(repositoryDirectory, args, &outputText, &errorText);
 | 
			
		||||
    const QString message = rc ?
 | 
			
		||||
        tr("Committed %n file(s).", 0, checkedFiles.size()) :
 | 
			
		||||
        tr("Unable to commit %n file(s): %1", 0, checkedFiles.size()).arg(QString::fromLocal8Bit(errorText));
 | 
			
		||||
        tr("Committed %n file(s).\n", 0, checkedFiles.size()) :
 | 
			
		||||
        tr("Unable to commit %n file(s): %1\n", 0, checkedFiles.size()).arg(QString::fromLocal8Bit(errorText));
 | 
			
		||||
 | 
			
		||||
    m_plugin->m_outputWindow->append(message);
 | 
			
		||||
    m_plugin->m_outputWindow->popup(false);
 | 
			
		||||
    m_plugin->outputWindow()->append(message);
 | 
			
		||||
    m_plugin->outputWindow()->popup(false);
 | 
			
		||||
    return rc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitClient::pull(const QString &workingDirectory)
 | 
			
		||||
{
 | 
			
		||||
    executeGit(workingDirectory, QStringList(QLatin1String("pull")), m_plugin->m_outputWindow, 0,true);
 | 
			
		||||
    executeGit(workingDirectory, QStringList(QLatin1String("pull")), m_plugin->outputWindow(), 0, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitClient::push(const QString &workingDirectory)
 | 
			
		||||
{
 | 
			
		||||
    executeGit(workingDirectory, QStringList(QLatin1String("push")), m_plugin->m_outputWindow, 0,true);
 | 
			
		||||
    executeGit(workingDirectory, QStringList(QLatin1String("push")), m_plugin->outputWindow(), 0, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitClient::stash(const QString &workingDirectory)
 | 
			
		||||
{
 | 
			
		||||
    // Check for changes and stash
 | 
			
		||||
    QString errorMessage;
 | 
			
		||||
    switch (gitStatus(workingDirectory, false, 0, &errorMessage)) {
 | 
			
		||||
    case  StatusChanged:
 | 
			
		||||
        executeGit(workingDirectory, QStringList(QLatin1String("stash")), m_plugin->outputWindow(), 0, true);
 | 
			
		||||
        break;
 | 
			
		||||
    case StatusUnchanged:
 | 
			
		||||
        m_plugin->outputWindow()->append(tr("There are no modified files."));
 | 
			
		||||
        m_plugin->outputWindow()->popup();
 | 
			
		||||
        break;
 | 
			
		||||
    case StatusFailed:
 | 
			
		||||
        m_plugin->outputWindow()->append(errorMessage);
 | 
			
		||||
        m_plugin->outputWindow()->popup();
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitClient::stashPop(const QString &workingDirectory)
 | 
			
		||||
{
 | 
			
		||||
    QStringList arguments(QLatin1String("stash"));
 | 
			
		||||
    arguments << QLatin1String("pop");
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitClient::branchList(const QString &workingDirectory)
 | 
			
		||||
{
 | 
			
		||||
    QStringList arguments(QLatin1String("branch"));
 | 
			
		||||
    arguments << QLatin1String("-r");
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitClient::stashList(const QString &workingDirectory)
 | 
			
		||||
{
 | 
			
		||||
    QStringList arguments(QLatin1String("stash"));
 | 
			
		||||
    arguments << QLatin1String("list");
 | 
			
		||||
    executeGit(workingDirectory, arguments, m_plugin->outputWindow(), 0, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString GitClient::readConfig(const QString &workingDirectory, const QStringList &configVar)
 | 
			
		||||
@@ -645,6 +705,21 @@ QString GitClient::readConfigValue(const QString &workingDirectory, const QStrin
 | 
			
		||||
    return readConfig(workingDirectory, QStringList(configVar)).remove(QLatin1Char('\n'));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GitSettings GitClient::settings() const
 | 
			
		||||
{
 | 
			
		||||
    return m_settings;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitClient::setSettings(const GitSettings &s)
 | 
			
		||||
{
 | 
			
		||||
    if (s != m_settings) {
 | 
			
		||||
        m_settings = s;
 | 
			
		||||
        if (QSettings *s = m_core->settings())
 | 
			
		||||
            m_settings.toSettings(s);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ------------------------ GitCommand
 | 
			
		||||
GitCommand::GitCommand()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -34,6 +34,8 @@
 | 
			
		||||
#ifndef GITCLIENT_H
 | 
			
		||||
#define GITCLIENT_H
 | 
			
		||||
 | 
			
		||||
#include "gitsettings.h"
 | 
			
		||||
 | 
			
		||||
#include <coreplugin/iversioncontrol.h>
 | 
			
		||||
#include <coreplugin/editormanager/ieditor.h>
 | 
			
		||||
#include <projectexplorer/environment.h>
 | 
			
		||||
@@ -91,6 +93,11 @@ public:
 | 
			
		||||
    void pull(const QString &workingDirectory);
 | 
			
		||||
    void push(const QString &workingDirectory);
 | 
			
		||||
 | 
			
		||||
    void stash(const QString &workingDirectory);
 | 
			
		||||
    void stashPop(const QString &workingDirectory);
 | 
			
		||||
    void branchList(const QString &workingDirectory);
 | 
			
		||||
    void stashList(const QString &workingDirectory);
 | 
			
		||||
 | 
			
		||||
    QString readConfig(const QString &workingDirectory, const QStringList &configVar);
 | 
			
		||||
 | 
			
		||||
    QString readConfigValue(const QString &workingDirectory, const QString &configVar);
 | 
			
		||||
@@ -106,10 +113,19 @@ public:
 | 
			
		||||
                      const QStringList &checkedFiles,
 | 
			
		||||
                      const QStringList &origCommitFiles);
 | 
			
		||||
 | 
			
		||||
    GitSettings  settings() const;
 | 
			
		||||
    void setSettings(const GitSettings &s);
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
    void show(const QString &source, const QString &id);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    enum StatusResult { StatusChanged, StatusUnchanged, StatusFailed };
 | 
			
		||||
    StatusResult gitStatus(const QString &workingDirectory,
 | 
			
		||||
                           bool untracked,
 | 
			
		||||
                           QString *output = 0,
 | 
			
		||||
                           QString *errorMessage = 0);
 | 
			
		||||
 | 
			
		||||
    VCSBase::VCSBaseEditor *createVCSEditor(const QString &kind,
 | 
			
		||||
                                                 QString title,
 | 
			
		||||
                                                 const QString &source,
 | 
			
		||||
@@ -132,6 +148,7 @@ private:
 | 
			
		||||
    const QString m_msgWait;
 | 
			
		||||
    GitPlugin     *m_plugin;
 | 
			
		||||
    Core::ICore   *m_core;
 | 
			
		||||
    GitSettings   m_settings;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class GitCommand : public QObject
 | 
			
		||||
 
 | 
			
		||||
@@ -104,6 +104,7 @@ void GitOutputWindow::append(const QString &text)
 | 
			
		||||
    const QStringList lines = text.split(QLatin1Char('\n'));
 | 
			
		||||
    foreach (const QString &s, lines)
 | 
			
		||||
        m_outputListWidget->addItem(s);
 | 
			
		||||
    m_outputListWidget->scrollToBottom();
 | 
			
		||||
    popup();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -126,6 +126,10 @@ GitPlugin::GitPlugin() :
 | 
			
		||||
    m_diffSelectedFilesAction(0),
 | 
			
		||||
    m_undoAction(0),
 | 
			
		||||
    m_redoAction(0),
 | 
			
		||||
    m_stashAction(0),
 | 
			
		||||
    m_stashPopAction(0),
 | 
			
		||||
    m_stashListAction(0),
 | 
			
		||||
    m_branchListAction(0),
 | 
			
		||||
    m_projectExplorer(0),
 | 
			
		||||
    m_gitClient(0),
 | 
			
		||||
    m_outputWindow(0),
 | 
			
		||||
@@ -206,6 +210,15 @@ static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = {
 | 
			
		||||
    Git::Constants::DIFF_SELECTED
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static inline Core::ICommand *createSeparator(Core::ActionManagerInterface *am,
 | 
			
		||||
                                              const QList<int> &context,
 | 
			
		||||
                                              const QString &id,
 | 
			
		||||
                                              QObject *parent)
 | 
			
		||||
{
 | 
			
		||||
    QAction *a = new QAction(parent);
 | 
			
		||||
    a->setSeparator(true);
 | 
			
		||||
    return  am->registerAction(a, id, context);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool GitPlugin::initialize(const QStringList &arguments, QString *error_message)
 | 
			
		||||
{
 | 
			
		||||
@@ -262,7 +275,6 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *error_message)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    Core::ICommand *command;
 | 
			
		||||
    QAction *tmpaction;
 | 
			
		||||
 | 
			
		||||
    m_diffAction = new QAction(tr("Diff current file"), this);
 | 
			
		||||
    command = actionManager->registerAction(m_diffAction, "Git.Diff", globalcontext);
 | 
			
		||||
@@ -306,10 +318,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *error_message)
 | 
			
		||||
    connect(m_addAction, SIGNAL(triggered()), this, SLOT(addFile()));
 | 
			
		||||
    gitContainer->addAction(command);
 | 
			
		||||
 | 
			
		||||
    tmpaction = new QAction(this);
 | 
			
		||||
    tmpaction->setSeparator(true);
 | 
			
		||||
    command = actionManager->registerAction(tmpaction, QLatin1String("Git.Sep.Project"), globalcontext);
 | 
			
		||||
    gitContainer->addAction(command);
 | 
			
		||||
    gitContainer->addAction(createSeparator(actionManager, globalcontext, QLatin1String("Git.Sep.Project"), this));
 | 
			
		||||
 | 
			
		||||
    m_diffProjectAction = new QAction(tr("Diff current project"), this);
 | 
			
		||||
    command = actionManager->registerAction(m_diffProjectAction, "Git.DiffProject", globalcontext);
 | 
			
		||||
@@ -337,15 +346,26 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *error_message)
 | 
			
		||||
    connect(m_undoProjectAction, SIGNAL(triggered()), this, SLOT(undoProjectChanges()));
 | 
			
		||||
    gitContainer->addAction(command);
 | 
			
		||||
 | 
			
		||||
    tmpaction = new QAction(this);
 | 
			
		||||
    tmpaction->setSeparator(true);
 | 
			
		||||
    command = actionManager->registerAction(tmpaction, QLatin1String("Git.Sep.Global"), globalcontext);
 | 
			
		||||
    gitContainer->addAction(createSeparator(actionManager, globalcontext, QLatin1String("Git.Sep.Global"), this));
 | 
			
		||||
 | 
			
		||||
    m_stashAction = new QAction(tr("Stash"), this);
 | 
			
		||||
    m_stashAction->setToolTip("Saves the current state of your work.");
 | 
			
		||||
    command = actionManager->registerAction(m_stashAction, "Git.Stash", globalcontext);
 | 
			
		||||
    command->setAttribute(Core::ICommand::CA_UpdateText);
 | 
			
		||||
    connect(m_stashAction, SIGNAL(triggered()), this, SLOT(stash()));
 | 
			
		||||
    gitContainer->addAction(command);
 | 
			
		||||
 | 
			
		||||
    m_showAction = new QAction(tr("Show commit..."), this);
 | 
			
		||||
    command = actionManager->registerAction(m_showAction, "Git.ShowCommit", globalcontext);
 | 
			
		||||
    m_pullAction = new QAction(tr("Pull"), this);
 | 
			
		||||
    command = actionManager->registerAction(m_pullAction, "Git.Pull", globalcontext);
 | 
			
		||||
    command->setAttribute(Core::ICommand::CA_UpdateText);
 | 
			
		||||
    connect(m_showAction, SIGNAL(triggered()), this, SLOT(showCommit()));
 | 
			
		||||
    connect(m_pullAction, SIGNAL(triggered()), this, SLOT(pull()));
 | 
			
		||||
    gitContainer->addAction(command);
 | 
			
		||||
 | 
			
		||||
    m_stashPopAction = new QAction(tr("Stash pop"), this);
 | 
			
		||||
    m_stashAction->setToolTip("Restores changes saved to the stash list using \"Stash\".");
 | 
			
		||||
    command = actionManager->registerAction(m_stashPopAction, "Git.StashPop", globalcontext);
 | 
			
		||||
    command->setAttribute(Core::ICommand::CA_UpdateText);
 | 
			
		||||
    connect(m_stashPopAction, SIGNAL(triggered()), this, SLOT(stashPop()));
 | 
			
		||||
    gitContainer->addAction(command);
 | 
			
		||||
 | 
			
		||||
    m_commitAction = new QAction(tr("Commit..."), this);
 | 
			
		||||
@@ -355,24 +375,37 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *error_message)
 | 
			
		||||
    connect(m_commitAction, SIGNAL(triggered()), this, SLOT(startCommit()));
 | 
			
		||||
    gitContainer->addAction(command);
 | 
			
		||||
 | 
			
		||||
    m_pullAction = new QAction(tr("Pull"), this);
 | 
			
		||||
    command = actionManager->registerAction(m_pullAction, "Git.Pull", globalcontext);
 | 
			
		||||
    command->setAttribute(Core::ICommand::CA_UpdateText);
 | 
			
		||||
    connect(m_pullAction, SIGNAL(triggered()), this, SLOT(pull()));
 | 
			
		||||
    gitContainer->addAction(command);
 | 
			
		||||
 | 
			
		||||
    m_pushAction = new QAction(tr("Push"), this);
 | 
			
		||||
    command = actionManager->registerAction(m_pushAction, "Git.Push", globalcontext);
 | 
			
		||||
    command->setAttribute(Core::ICommand::CA_UpdateText);
 | 
			
		||||
    connect(m_pushAction, SIGNAL(triggered()), this, SLOT(push()));
 | 
			
		||||
    gitContainer->addAction(command);
 | 
			
		||||
 | 
			
		||||
    gitContainer->addAction(createSeparator(actionManager, globalcontext, QLatin1String("Git.Sep.Branch"), this));
 | 
			
		||||
 | 
			
		||||
    m_branchListAction = new QAction(tr("List branches"), this);
 | 
			
		||||
    command = actionManager->registerAction(m_branchListAction, "Git.BranchList", globalcontext);
 | 
			
		||||
    command->setAttribute(Core::ICommand::CA_UpdateText);
 | 
			
		||||
    connect(m_branchListAction, SIGNAL(triggered()), this, SLOT(branchList()));
 | 
			
		||||
    gitContainer->addAction(command);
 | 
			
		||||
 | 
			
		||||
    m_stashListAction = new QAction(tr("List stashes"), this);
 | 
			
		||||
    command = actionManager->registerAction(m_stashListAction, "Git.StashList", globalcontext);
 | 
			
		||||
    command->setAttribute(Core::ICommand::CA_UpdateText);
 | 
			
		||||
    connect(m_stashListAction, SIGNAL(triggered()), this, SLOT(stashList()));
 | 
			
		||||
    gitContainer->addAction(command);
 | 
			
		||||
 | 
			
		||||
    m_showAction = new QAction(tr("Show commit..."), this);
 | 
			
		||||
    command = actionManager->registerAction(m_showAction, "Git.ShowCommit", globalcontext);
 | 
			
		||||
    command->setAttribute(Core::ICommand::CA_UpdateText);
 | 
			
		||||
    connect(m_showAction, SIGNAL(triggered()), this, SLOT(showCommit()));
 | 
			
		||||
    gitContainer->addAction(command);
 | 
			
		||||
 | 
			
		||||
    // Submit editor
 | 
			
		||||
    QList<int> submitContext;
 | 
			
		||||
    submitContext.push_back(m_core->uniqueIDManager()->uniqueIdentifier(QLatin1String(Constants::C_GITSUBMITEDITOR)));
 | 
			
		||||
    m_submitCurrentAction = new QAction(VCSBase::VCSBaseSubmitEditor::submitIcon(), tr("Commit"), this);
 | 
			
		||||
    command = actionManager->registerAction(m_submitCurrentAction, Constants::SUBMIT_CURRENT, submitContext);
 | 
			
		||||
    // TODO
 | 
			
		||||
    connect(m_submitCurrentAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog()));
 | 
			
		||||
 | 
			
		||||
    m_diffSelectedFilesAction = new QAction(VCSBase::VCSBaseSubmitEditor::diffIcon(), tr("Diff Selected Files"), this);
 | 
			
		||||
@@ -421,7 +454,7 @@ void GitPlugin::diffCurrentProject()
 | 
			
		||||
    m_gitClient->diff(workingDirectory, QString());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QFileInfo GitPlugin::currentFile()
 | 
			
		||||
QFileInfo GitPlugin::currentFile() const
 | 
			
		||||
{
 | 
			
		||||
    QString fileName = m_core->fileManager()->currentFile();
 | 
			
		||||
    QFileInfo fileInfo(fileName);
 | 
			
		||||
@@ -636,26 +669,52 @@ bool GitPlugin::editorAboutToClose(Core::IEditor *iEditor)
 | 
			
		||||
 | 
			
		||||
void GitPlugin::pull()
 | 
			
		||||
{
 | 
			
		||||
    QString workingDirectory = getWorkingDirectory();
 | 
			
		||||
    if (workingDirectory.isEmpty())
 | 
			
		||||
        return;
 | 
			
		||||
    m_gitClient->pull(workingDirectory);
 | 
			
		||||
    const QString workingDirectory = getWorkingDirectory();
 | 
			
		||||
    if (!workingDirectory.isEmpty())
 | 
			
		||||
        m_gitClient->pull(workingDirectory);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitPlugin::push()
 | 
			
		||||
{
 | 
			
		||||
    QString workingDirectory = getWorkingDirectory();
 | 
			
		||||
    if (workingDirectory.isEmpty())
 | 
			
		||||
        return;
 | 
			
		||||
    m_gitClient->push(workingDirectory);
 | 
			
		||||
    const QString workingDirectory = getWorkingDirectory();
 | 
			
		||||
    if (!workingDirectory.isEmpty())
 | 
			
		||||
        m_gitClient->push(workingDirectory);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitPlugin::stash()
 | 
			
		||||
{
 | 
			
		||||
    const QString workingDirectory = getWorkingDirectory();
 | 
			
		||||
    if (!workingDirectory.isEmpty())
 | 
			
		||||
        m_gitClient->stash(workingDirectory);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitPlugin::stashPop()
 | 
			
		||||
{
 | 
			
		||||
    const QString workingDirectory = getWorkingDirectory();
 | 
			
		||||
    if (!workingDirectory.isEmpty())
 | 
			
		||||
        m_gitClient->stashPop(workingDirectory);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitPlugin::branchList()
 | 
			
		||||
{
 | 
			
		||||
    const QString workingDirectory = getWorkingDirectory();
 | 
			
		||||
    if (!workingDirectory.isEmpty())
 | 
			
		||||
        m_gitClient->branchList(workingDirectory);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitPlugin::stashList()
 | 
			
		||||
{
 | 
			
		||||
    const QString workingDirectory = getWorkingDirectory();
 | 
			
		||||
    if (!workingDirectory.isEmpty())
 | 
			
		||||
        m_gitClient->stashList(workingDirectory);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitPlugin::updateActions()
 | 
			
		||||
{
 | 
			
		||||
    QFileInfo current = currentFile();
 | 
			
		||||
    const QFileInfo current = currentFile();
 | 
			
		||||
    const QString fileName = current.fileName();
 | 
			
		||||
    const QString currentDirectory = getWorkingDirectory();
 | 
			
		||||
    QString repository = m_gitClient->findRepositoryForFile(current.absoluteFilePath());
 | 
			
		||||
    const QString repository = m_gitClient->findRepositoryForFile(current.absoluteFilePath());
 | 
			
		||||
    // First check for file commands and if the current file is inside
 | 
			
		||||
    // a Git-repository
 | 
			
		||||
    m_diffAction->setText(tr("Diff %1").arg(fileName));
 | 
			
		||||
@@ -693,7 +752,7 @@ void GitPlugin::updateActions()
 | 
			
		||||
 | 
			
		||||
    if (m_projectExplorer && m_projectExplorer->currentNode()
 | 
			
		||||
        && m_projectExplorer->currentNode()->projectNode()) {
 | 
			
		||||
        QString name = QFileInfo(m_projectExplorer->currentNode()->projectNode()->path()).baseName();
 | 
			
		||||
        const QString name = QFileInfo(m_projectExplorer->currentNode()->projectNode()->path()).baseName();
 | 
			
		||||
        m_diffProjectAction->setEnabled(true);
 | 
			
		||||
        m_diffProjectAction->setText(tr("Diff Project %1").arg(name));
 | 
			
		||||
        m_statusProjectAction->setEnabled(true);
 | 
			
		||||
@@ -729,4 +788,19 @@ void GitPlugin::showCommit()
 | 
			
		||||
    m_gitClient->show(m_changeSelectionDialog->m_ui.repositoryEdit->text(), change);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GitOutputWindow *GitPlugin::outputWindow() const
 | 
			
		||||
{
 | 
			
		||||
    return m_outputWindow;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GitSettings GitPlugin::settings() const
 | 
			
		||||
{
 | 
			
		||||
    return m_gitClient->settings();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitPlugin::setSettings(const GitSettings &s)
 | 
			
		||||
{
 | 
			
		||||
    m_gitClient->setSettings(s);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Q_EXPORT_PLUGIN(GitPlugin)
 | 
			
		||||
 
 | 
			
		||||
@@ -66,6 +66,7 @@ namespace Internal {
 | 
			
		||||
    class ChangeSelectionDialog;
 | 
			
		||||
    class GitSubmitEditor;
 | 
			
		||||
    struct CommitData;
 | 
			
		||||
    struct GitSettings;
 | 
			
		||||
 | 
			
		||||
// Just a proxy for GitPlugin
 | 
			
		||||
class CoreListener : public Core::ICoreListener
 | 
			
		||||
@@ -94,6 +95,11 @@ public:
 | 
			
		||||
 | 
			
		||||
    QString                     getWorkingDirectory();
 | 
			
		||||
 | 
			
		||||
    GitOutputWindow             *outputWindow() const;
 | 
			
		||||
 | 
			
		||||
    GitSettings  settings() const;
 | 
			
		||||
    void setSettings(const GitSettings &s);
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
    void                        updateActions();
 | 
			
		||||
    bool                        editorAboutToClose(Core::IEditor *editor);
 | 
			
		||||
@@ -114,12 +120,15 @@ private slots:
 | 
			
		||||
 | 
			
		||||
    void                        showCommit();
 | 
			
		||||
    void                        startCommit();
 | 
			
		||||
    void                        stash();
 | 
			
		||||
    void                        stashPop();
 | 
			
		||||
    void                        branchList();
 | 
			
		||||
    void                        stashList();
 | 
			
		||||
    void                        pull();
 | 
			
		||||
    void                        push();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    friend class GitClient;
 | 
			
		||||
    QFileInfo                   currentFile();
 | 
			
		||||
    QFileInfo                   currentFile() const;
 | 
			
		||||
    Core::IEditor               *openSubmitEditor(const QString &fileName, const CommitData &cd);
 | 
			
		||||
    void                        cleanChangeTmpFile();
 | 
			
		||||
 | 
			
		||||
@@ -144,6 +153,10 @@ private:
 | 
			
		||||
    QAction                     *m_diffSelectedFilesAction;
 | 
			
		||||
    QAction                     *m_undoAction;
 | 
			
		||||
    QAction                     *m_redoAction;
 | 
			
		||||
    QAction                     *m_stashAction;
 | 
			
		||||
    QAction                     *m_stashPopAction;
 | 
			
		||||
    QAction                     *m_stashListAction;
 | 
			
		||||
    QAction                     *m_branchListAction;
 | 
			
		||||
 | 
			
		||||
    ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer;
 | 
			
		||||
    GitClient                   *m_gitClient;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										79
									
								
								src/plugins/git/gitsettings.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								src/plugins/git/gitsettings.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,79 @@
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** This file is part of Qt Creator
 | 
			
		||||
**
 | 
			
		||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
 | 
			
		||||
**
 | 
			
		||||
** Contact:  Qt Software Information (qt-info@nokia.com)
 | 
			
		||||
**
 | 
			
		||||
**
 | 
			
		||||
** Non-Open Source Usage
 | 
			
		||||
**
 | 
			
		||||
** Licensees may use this file in accordance with the Qt Beta Version
 | 
			
		||||
** License Agreement, Agreement version 2.2 provided with the Software or,
 | 
			
		||||
** alternatively, in accordance with the terms contained in a written
 | 
			
		||||
** agreement between you and Nokia.
 | 
			
		||||
**
 | 
			
		||||
** GNU General Public License Usage
 | 
			
		||||
**
 | 
			
		||||
** Alternatively, this file may be used under the terms of the GNU General
 | 
			
		||||
** Public License versions 2.0 or 3.0 as published by the Free Software
 | 
			
		||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
 | 
			
		||||
** of this file.  Please review the following information to ensure GNU
 | 
			
		||||
** General Public Licensing requirements will be met:
 | 
			
		||||
**
 | 
			
		||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
 | 
			
		||||
** http://www.gnu.org/copyleft/gpl.html.
 | 
			
		||||
**
 | 
			
		||||
** In addition, as a special exception, Nokia gives you certain additional
 | 
			
		||||
** rights. These rights are described in the Nokia Qt GPL Exception
 | 
			
		||||
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
 | 
			
		||||
**
 | 
			
		||||
***************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include "gitsettings.h"
 | 
			
		||||
 | 
			
		||||
#include <QtCore/QSettings>
 | 
			
		||||
#include <QtCore/QTextStream>
 | 
			
		||||
 | 
			
		||||
static const char *groupC = "Git";
 | 
			
		||||
static const char *sysEnvKeyC = "SysEnv";
 | 
			
		||||
static const char *pathKeyC = "Path";
 | 
			
		||||
static const char *logCountKeyC = "LogCount";
 | 
			
		||||
 | 
			
		||||
enum { defaultLogCount =  10 };
 | 
			
		||||
 | 
			
		||||
namespace Git {
 | 
			
		||||
namespace Internal {
 | 
			
		||||
 | 
			
		||||
GitSettings::GitSettings() :
 | 
			
		||||
    adoptPath(false),
 | 
			
		||||
    logCount(defaultLogCount)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitSettings::fromSettings(QSettings *settings)
 | 
			
		||||
{
 | 
			
		||||
    settings->beginGroup(QLatin1String(groupC));
 | 
			
		||||
    adoptPath = settings->value(QLatin1String(sysEnvKeyC), false).toBool();
 | 
			
		||||
    path = settings->value(QLatin1String(pathKeyC), QString()).toString();
 | 
			
		||||
    logCount = settings->value(QLatin1String(logCountKeyC), defaultLogCount).toInt();
 | 
			
		||||
    settings->endGroup();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GitSettings::toSettings(QSettings *settings) const
 | 
			
		||||
{
 | 
			
		||||
    settings->beginGroup(QLatin1String(groupC));
 | 
			
		||||
    settings->setValue(QLatin1String(sysEnvKeyC), adoptPath);
 | 
			
		||||
    settings->setValue(QLatin1String(pathKeyC), path);
 | 
			
		||||
    settings->setValue(QLatin1String(logCountKeyC), logCount);
 | 
			
		||||
    settings->endGroup();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool GitSettings::equals(const GitSettings &s) const
 | 
			
		||||
{
 | 
			
		||||
    return adoptPath == s.adoptPath  && path == s.path && logCount == s.logCount;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										69
									
								
								src/plugins/git/gitsettings.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								src/plugins/git/gitsettings.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,69 @@
 | 
			
		||||
/***************************************************************************
 | 
			
		||||
**
 | 
			
		||||
** This file is part of Qt Creator
 | 
			
		||||
**
 | 
			
		||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
 | 
			
		||||
**
 | 
			
		||||
** Contact:  Qt Software Information (qt-info@nokia.com)
 | 
			
		||||
**
 | 
			
		||||
**
 | 
			
		||||
** Non-Open Source Usage
 | 
			
		||||
**
 | 
			
		||||
** Licensees may use this file in accordance with the Qt Beta Version
 | 
			
		||||
** License Agreement, Agreement version 2.2 provided with the Software or,
 | 
			
		||||
** alternatively, in accordance with the terms contained in a written
 | 
			
		||||
** agreement between you and Nokia.
 | 
			
		||||
**
 | 
			
		||||
** GNU General Public License Usage
 | 
			
		||||
**
 | 
			
		||||
** Alternatively, this file may be used under the terms of the GNU General
 | 
			
		||||
** Public License versions 2.0 or 3.0 as published by the Free Software
 | 
			
		||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
 | 
			
		||||
** of this file.  Please review the following information to ensure GNU
 | 
			
		||||
** General Public Licensing requirements will be met:
 | 
			
		||||
**
 | 
			
		||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
 | 
			
		||||
** http://www.gnu.org/copyleft/gpl.html.
 | 
			
		||||
**
 | 
			
		||||
** In addition, as a special exception, Nokia gives you certain additional
 | 
			
		||||
** rights. These rights are described in the Nokia Qt GPL Exception
 | 
			
		||||
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
 | 
			
		||||
**
 | 
			
		||||
***************************************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef GITSETTINGS_H
 | 
			
		||||
#define GITSETTINGS_H
 | 
			
		||||
 | 
			
		||||
#include <QtCore/QStringList>
 | 
			
		||||
 | 
			
		||||
QT_BEGIN_NAMESPACE
 | 
			
		||||
class QSettings;
 | 
			
		||||
QT_END_NAMESPACE
 | 
			
		||||
 | 
			
		||||
namespace Git {
 | 
			
		||||
namespace Internal {
 | 
			
		||||
 | 
			
		||||
// Todo: Add user name and password?
 | 
			
		||||
struct GitSettings
 | 
			
		||||
{
 | 
			
		||||
    GitSettings();
 | 
			
		||||
 | 
			
		||||
    void fromSettings(QSettings *);
 | 
			
		||||
    void toSettings(QSettings *) const;
 | 
			
		||||
 | 
			
		||||
    bool equals(const GitSettings &s) const;
 | 
			
		||||
 | 
			
		||||
    bool adoptPath;
 | 
			
		||||
    QString path;
 | 
			
		||||
    int logCount;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
inline bool operator==(const GitSettings &p1, const GitSettings &p2)
 | 
			
		||||
    { return p1.equals(p2); }
 | 
			
		||||
inline bool operator!=(const GitSettings &p1, const GitSettings &p2)
 | 
			
		||||
    { return !p1.equals(p2); }
 | 
			
		||||
 | 
			
		||||
} // namespace Internal
 | 
			
		||||
} // namespace Git
 | 
			
		||||
 | 
			
		||||
#endif // GITSETTINGS_H
 | 
			
		||||
@@ -32,35 +32,44 @@
 | 
			
		||||
***************************************************************************/
 | 
			
		||||
 | 
			
		||||
#include "settingspage.h"
 | 
			
		||||
#include "gitsettings.h"
 | 
			
		||||
#include "gitplugin.h"
 | 
			
		||||
 | 
			
		||||
#include <coreplugin/icore.h>
 | 
			
		||||
#include <extensionsystem/pluginmanager.h>
 | 
			
		||||
 | 
			
		||||
#include <QtCore/QSettings>
 | 
			
		||||
#include <QtGui/QLineEdit>
 | 
			
		||||
#include <QtGui/QFileDialog>
 | 
			
		||||
#include <QtCore/QDebug>
 | 
			
		||||
 | 
			
		||||
using namespace Git::Internal;
 | 
			
		||||
 | 
			
		||||
static const char *groupC = "Git";
 | 
			
		||||
static const char *sysEnvKeyC = "SysEnv";
 | 
			
		||||
static const char *pathKeyC = "Path";
 | 
			
		||||
static const char *logCountKeyC = "LogCount";
 | 
			
		||||
SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
 | 
			
		||||
    QWidget(parent)
 | 
			
		||||
{
 | 
			
		||||
    m_ui.setupUi(this);
 | 
			
		||||
    connect(m_ui.adoptButton, SIGNAL(clicked()), this, SLOT(setSystemPath()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GitSettings SettingsPageWidget::settings() const
 | 
			
		||||
{
 | 
			
		||||
    GitSettings rc;
 | 
			
		||||
    rc.path = m_ui.pathLineEdit->text();
 | 
			
		||||
    rc.adoptPath = m_ui.environmentGroupBox->isChecked() && !rc.path.isEmpty();
 | 
			
		||||
    rc.logCount = m_ui.logCountSpinBox->value();
 | 
			
		||||
    return rc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsPageWidget::setSettings(const GitSettings &s)
 | 
			
		||||
{
 | 
			
		||||
    m_ui.environmentGroupBox->setChecked(s.adoptPath);
 | 
			
		||||
    m_ui.pathLineEdit->setText(s.path);
 | 
			
		||||
    m_ui.logCountSpinBox->setValue(s.logCount);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsPageWidget::setSystemPath()
 | 
			
		||||
{
 | 
			
		||||
    m_ui.pathLineEdit->setText(QLatin1String(qgetenv("PATH")));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// -------- SettingsPage
 | 
			
		||||
SettingsPage::SettingsPage()
 | 
			
		||||
{
 | 
			
		||||
    Core::ICore *coreIFace = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
 | 
			
		||||
    if (coreIFace)
 | 
			
		||||
        m_settings = coreIFace->settings();
 | 
			
		||||
 | 
			
		||||
    if (m_settings) {
 | 
			
		||||
        m_settings->beginGroup(QLatin1String(groupC));
 | 
			
		||||
        m_adopt = m_settings->value(QLatin1String(sysEnvKeyC), true).toBool();
 | 
			
		||||
        m_path = m_settings->value(QLatin1String(pathKeyC), QString()).toString();
 | 
			
		||||
        m_logCount = m_settings->value(QLatin1String(logCountKeyC), 10).toInt();
 | 
			
		||||
        m_settings->endGroup();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString SettingsPage::name() const
 | 
			
		||||
@@ -68,7 +77,7 @@ QString SettingsPage::name() const
 | 
			
		||||
    return tr("General");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString SettingsPage::category() const
 | 
			
		||||
 QString SettingsPage::category() const
 | 
			
		||||
{
 | 
			
		||||
    return QLatin1String("Git");
 | 
			
		||||
}
 | 
			
		||||
@@ -80,37 +89,17 @@ QString SettingsPage::trCategory() const
 | 
			
		||||
 | 
			
		||||
QWidget *SettingsPage::createPage(QWidget *parent)
 | 
			
		||||
{
 | 
			
		||||
    QWidget *w = new QWidget(parent);
 | 
			
		||||
    m_ui.setupUi(w);
 | 
			
		||||
    m_ui.adoptCheckBox->setChecked(m_adopt);
 | 
			
		||||
    m_ui.pathLineEdit->setText(m_path);
 | 
			
		||||
    m_ui.logLineEdit->setText(QString::number(m_logCount));
 | 
			
		||||
 | 
			
		||||
    connect(m_ui.adoptButton, SIGNAL(clicked()), this, SLOT(setSystemPath()));
 | 
			
		||||
    return w;
 | 
			
		||||
    if (!m_widget)
 | 
			
		||||
        m_widget = new SettingsPageWidget(parent);
 | 
			
		||||
    m_widget->setSettings(GitPlugin::instance()->settings());
 | 
			
		||||
    return m_widget;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsPage::finished(bool accepted)
 | 
			
		||||
{
 | 
			
		||||
    if (!accepted)
 | 
			
		||||
    if (!accepted || !m_widget)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    m_adopt = m_ui.adoptCheckBox->isChecked();
 | 
			
		||||
    m_path = m_ui.pathLineEdit->text();
 | 
			
		||||
    m_logCount = m_ui.logLineEdit->text().toInt();
 | 
			
		||||
 | 
			
		||||
    if (!m_settings)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    m_settings->beginGroup(QLatin1String(groupC));
 | 
			
		||||
    m_settings->setValue(QLatin1String(sysEnvKeyC), m_adopt);
 | 
			
		||||
    m_settings->setValue(QLatin1String(pathKeyC), m_path);
 | 
			
		||||
    m_settings->setValue(QLatin1String(logCountKeyC), m_logCount);
 | 
			
		||||
    m_settings->endGroup();
 | 
			
		||||
    GitPlugin::instance()->setSettings(m_widget->settings());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SettingsPage::setSystemPath()
 | 
			
		||||
{
 | 
			
		||||
    m_path = qgetenv("PATH");
 | 
			
		||||
    m_ui.pathLineEdit->setText(m_path);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,7 @@
 | 
			
		||||
#define SETTINGSPAGE_H
 | 
			
		||||
 | 
			
		||||
#include <QtGui/QWidget>
 | 
			
		||||
#include <QtCore/QPointer>
 | 
			
		||||
 | 
			
		||||
#include <coreplugin/dialogs/ioptionspage.h>
 | 
			
		||||
 | 
			
		||||
@@ -47,6 +48,23 @@ QT_END_NAMESPACE
 | 
			
		||||
namespace Git {
 | 
			
		||||
namespace Internal {
 | 
			
		||||
 | 
			
		||||
struct GitSettings;
 | 
			
		||||
 | 
			
		||||
class SettingsPageWidget : public QWidget {
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
    explicit SettingsPageWidget(QWidget *parent = 0);
 | 
			
		||||
 | 
			
		||||
    GitSettings settings() const;
 | 
			
		||||
    void setSettings(const GitSettings &);
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
    void setSystemPath();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Ui::SettingsPage m_ui;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class SettingsPage : public Core::IOptionsPage
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
@@ -61,20 +79,8 @@ public:
 | 
			
		||||
    QWidget *createPage(QWidget *parent);
 | 
			
		||||
    void finished(bool accepted);
 | 
			
		||||
 | 
			
		||||
    bool adoptEnvironment() const { return m_adopt; }
 | 
			
		||||
    int logCount() const { return m_logCount; }
 | 
			
		||||
    QString path() const { return m_path; }
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
    void setSystemPath();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    Ui_SettingsPage m_ui;
 | 
			
		||||
    QSettings *m_settings;
 | 
			
		||||
 | 
			
		||||
    bool m_adopt;
 | 
			
		||||
    QString m_path;
 | 
			
		||||
    int m_logCount;
 | 
			
		||||
    QPointer<SettingsPageWidget> m_widget;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace Internal
 | 
			
		||||
 
 | 
			
		||||
@@ -6,103 +6,113 @@
 | 
			
		||||
   <rect>
 | 
			
		||||
    <x>0</x>
 | 
			
		||||
    <y>0</y>
 | 
			
		||||
    <width>345</width>
 | 
			
		||||
    <height>177</height>
 | 
			
		||||
    <width>436</width>
 | 
			
		||||
    <height>186</height>
 | 
			
		||||
   </rect>
 | 
			
		||||
  </property>
 | 
			
		||||
  <property name="windowTitle">
 | 
			
		||||
   <string>Form</string>
 | 
			
		||||
  </property>
 | 
			
		||||
  <layout class="QVBoxLayout" name="verticalLayout">
 | 
			
		||||
  <layout class="QHBoxLayout" name="horizontalLayout">
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QCheckBox" name="adoptCheckBox">
 | 
			
		||||
     <property name="text">
 | 
			
		||||
      <string>Use System Environment</string>
 | 
			
		||||
     </property>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <widget class="QGroupBox" name="groupBox">
 | 
			
		||||
     <property name="enabled">
 | 
			
		||||
      <bool>true</bool>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="title">
 | 
			
		||||
      <string>Environment variables</string>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="checkable">
 | 
			
		||||
      <bool>false</bool>
 | 
			
		||||
     </property>
 | 
			
		||||
     <layout class="QGridLayout" name="gridLayout">
 | 
			
		||||
      <item row="0" column="0">
 | 
			
		||||
       <widget class="QLabel" name="label">
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>PATH:</string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item row="0" column="1">
 | 
			
		||||
       <widget class="QLineEdit" name="pathLineEdit"/>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item row="0" column="2">
 | 
			
		||||
       <widget class="QPushButton" name="adoptButton">
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string>Adopt</string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item row="1" column="0">
 | 
			
		||||
       <spacer name="horizontalSpacer">
 | 
			
		||||
        <property name="orientation">
 | 
			
		||||
         <enum>Qt::Horizontal</enum>
 | 
			
		||||
        </property>
 | 
			
		||||
        <property name="sizeHint" stdset="0">
 | 
			
		||||
         <size>
 | 
			
		||||
          <width>52</width>
 | 
			
		||||
          <height>20</height>
 | 
			
		||||
         </size>
 | 
			
		||||
        </property>
 | 
			
		||||
       </spacer>
 | 
			
		||||
      </item>
 | 
			
		||||
      <item row="1" column="1" colspan="2">
 | 
			
		||||
       <widget class="QLabel" name="label_2">
 | 
			
		||||
        <property name="text">
 | 
			
		||||
         <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
 | 
			
		||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
 | 
			
		||||
p, li { white-space: pre-wrap; }
 | 
			
		||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
 | 
			
		||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;">Note</span><span style=" font-size:8pt;"> that Git needs Perl in the environment as well</span></p></body></html></string>
 | 
			
		||||
        </property>
 | 
			
		||||
       </widget>
 | 
			
		||||
      </item>
 | 
			
		||||
     </layout>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <layout class="QHBoxLayout" name="horizontalLayout">
 | 
			
		||||
    <layout class="QVBoxLayout" name="verticalLayout">
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QLabel" name="label_3">
 | 
			
		||||
       <property name="text">
 | 
			
		||||
        <string>Commit display count:</string>
 | 
			
		||||
      <widget class="QGroupBox" name="environmentGroupBox">
 | 
			
		||||
       <property name="enabled">
 | 
			
		||||
        <bool>true</bool>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="title">
 | 
			
		||||
        <string>Environment variables</string>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="checkable">
 | 
			
		||||
        <bool>true</bool>
 | 
			
		||||
       </property>
 | 
			
		||||
       <layout class="QFormLayout" name="formLayout">
 | 
			
		||||
        <item row="0" column="0">
 | 
			
		||||
         <widget class="QLabel" name="pathlabel">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>PATH:</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item row="0" column="1">
 | 
			
		||||
         <layout class="QHBoxLayout" name="horizontalLayout_2">
 | 
			
		||||
          <item>
 | 
			
		||||
           <widget class="QLineEdit" name="pathLineEdit"/>
 | 
			
		||||
          </item>
 | 
			
		||||
          <item>
 | 
			
		||||
           <widget class="QPushButton" name="adoptButton">
 | 
			
		||||
            <property name="text">
 | 
			
		||||
             <string>From system</string>
 | 
			
		||||
            </property>
 | 
			
		||||
           </widget>
 | 
			
		||||
          </item>
 | 
			
		||||
         </layout>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item row="1" column="0">
 | 
			
		||||
         <widget class="QLabel" name="noteLabel">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string><b>Note:</b></string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
        <item row="1" column="1">
 | 
			
		||||
         <widget class="QLabel" name="noteFieldlabel">
 | 
			
		||||
          <property name="text">
 | 
			
		||||
           <string>Git needs to find Perl in the environment as well.</string>
 | 
			
		||||
          </property>
 | 
			
		||||
         </widget>
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </widget>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <widget class="QLineEdit" name="logLineEdit">
 | 
			
		||||
       <property name="toolTip">
 | 
			
		||||
        <string>Note that huge amount of commits might take some time.</string>
 | 
			
		||||
      <layout class="QFormLayout" name="logFormLayout">
 | 
			
		||||
       <property name="fieldGrowthPolicy">
 | 
			
		||||
        <enum>QFormLayout::ExpandingFieldsGrow</enum>
 | 
			
		||||
       </property>
 | 
			
		||||
      </widget>
 | 
			
		||||
       <item row="0" column="1">
 | 
			
		||||
        <widget class="QSpinBox" name="logCountSpinBox">
 | 
			
		||||
         <property name="toolTip">
 | 
			
		||||
          <string>Note that huge amount of commits might take some time.</string>
 | 
			
		||||
         </property>
 | 
			
		||||
         <property name="maximum">
 | 
			
		||||
          <number>1000</number>
 | 
			
		||||
         </property>
 | 
			
		||||
        </widget>
 | 
			
		||||
       </item>
 | 
			
		||||
       <item row="0" column="0">
 | 
			
		||||
        <widget class="QLabel" name="logCountLabel">
 | 
			
		||||
         <property name="text">
 | 
			
		||||
          <string>Log commit display count:</string>
 | 
			
		||||
         </property>
 | 
			
		||||
        </widget>
 | 
			
		||||
       </item>
 | 
			
		||||
      </layout>
 | 
			
		||||
     </item>
 | 
			
		||||
     <item>
 | 
			
		||||
      <spacer name="verticalSpacer">
 | 
			
		||||
       <property name="orientation">
 | 
			
		||||
        <enum>Qt::Vertical</enum>
 | 
			
		||||
       </property>
 | 
			
		||||
       <property name="sizeHint" stdset="0">
 | 
			
		||||
        <size>
 | 
			
		||||
         <width>20</width>
 | 
			
		||||
         <height>40</height>
 | 
			
		||||
        </size>
 | 
			
		||||
       </property>
 | 
			
		||||
      </spacer>
 | 
			
		||||
     </item>
 | 
			
		||||
    </layout>
 | 
			
		||||
   </item>
 | 
			
		||||
   <item>
 | 
			
		||||
    <spacer>
 | 
			
		||||
    <spacer name="horizontalSpacer">
 | 
			
		||||
     <property name="orientation">
 | 
			
		||||
      <enum>Qt::Vertical</enum>
 | 
			
		||||
      <enum>Qt::Horizontal</enum>
 | 
			
		||||
     </property>
 | 
			
		||||
     <property name="sizeHint" stdset="0">
 | 
			
		||||
      <size>
 | 
			
		||||
       <width>141</width>
 | 
			
		||||
       <width>40</width>
 | 
			
		||||
       <height>20</height>
 | 
			
		||||
      </size>
 | 
			
		||||
     </property>
 | 
			
		||||
@@ -114,22 +124,5 @@ p, li { white-space: pre-wrap; }
 | 
			
		||||
  <tabstop>pathLineEdit</tabstop>
 | 
			
		||||
 </tabstops>
 | 
			
		||||
 <resources/>
 | 
			
		||||
 <connections>
 | 
			
		||||
  <connection>
 | 
			
		||||
   <sender>adoptCheckBox</sender>
 | 
			
		||||
   <signal>toggled(bool)</signal>
 | 
			
		||||
   <receiver>groupBox</receiver>
 | 
			
		||||
   <slot>setDisabled(bool)</slot>
 | 
			
		||||
   <hints>
 | 
			
		||||
    <hint type="sourcelabel">
 | 
			
		||||
     <x>144</x>
 | 
			
		||||
     <y>33</y>
 | 
			
		||||
    </hint>
 | 
			
		||||
    <hint type="destinationlabel">
 | 
			
		||||
     <x>139</x>
 | 
			
		||||
     <y>65</y>
 | 
			
		||||
    </hint>
 | 
			
		||||
   </hints>
 | 
			
		||||
  </connection>
 | 
			
		||||
 </connections>
 | 
			
		||||
 <connections/>
 | 
			
		||||
</ui>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user