forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.8'
Conflicts: src/plugins/coreplugin/documentmanager.cpp Change-Id: I6dc025bc0f31eb694c8d9e2dd4ea5cc888ee8a94
This commit is contained in:
@@ -232,6 +232,7 @@ QtcPlugin {
|
||||
]
|
||||
|
||||
Group {
|
||||
name: "ProgressManager_win"
|
||||
condition: qbs.targetOS == "windows"
|
||||
files: [
|
||||
"progressmanager/progressmanager_win.cpp",
|
||||
@@ -239,6 +240,7 @@ QtcPlugin {
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "ProgressManager_mac"
|
||||
condition: qbs.targetOS == "mac"
|
||||
files: [
|
||||
"macfullscreen.h",
|
||||
@@ -248,6 +250,7 @@ QtcPlugin {
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "ProgressManager_x11"
|
||||
condition: qbs.targetPlatform.indexOf("unix") != -1 && qbs.targetOS != "mac"
|
||||
files: [
|
||||
"progressmanager/progressmanager_x11.cpp",
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QSet>
|
||||
#include <QSettings>
|
||||
#include <QTimer>
|
||||
#include <QAction>
|
||||
@@ -156,6 +157,7 @@ struct DocumentManagerPrivate
|
||||
QString m_projectsDirectory;
|
||||
bool m_useProjectsDirectory;
|
||||
QString m_buildDirectory;
|
||||
QSet<QString> m_expectedDirectories;
|
||||
// When we are callling into a IDocument
|
||||
// we don't want to receive a changed()
|
||||
// signal
|
||||
@@ -547,6 +549,47 @@ void DocumentManager::unexpectFileChange(const QString &fileName)
|
||||
updateExpectedState(fixedResolvedName);
|
||||
}
|
||||
|
||||
static QString dirWithTrailingSlash(const QString &directory)
|
||||
{
|
||||
static const QChar slash(QLatin1Char('/'));
|
||||
return directory.endsWith(slash) ? directory : directory + slash;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Any subsequent change to any file inside \a directory is treated as
|
||||
* an expected file change.
|
||||
*
|
||||
* \see DocumentManager::unexpectDirectoryChange(const QString &directory)
|
||||
*/
|
||||
void DocumentManager::expectDirectoryChange(const QString &directory)
|
||||
{
|
||||
QTC_ASSERT(!directory.isEmpty(), return);
|
||||
d->m_expectedDirectories.insert(dirWithTrailingSlash(directory));
|
||||
}
|
||||
|
||||
/*!
|
||||
* Any subsequent change to any file inside \a directory is unexpected again.
|
||||
*
|
||||
* \see DocumentManager::expectDirectoryChange(const QString &directory)
|
||||
*/
|
||||
void DocumentManager::unexpectDirectoryChange(const QString &directory)
|
||||
{
|
||||
QTimer *timer = new QTimer;
|
||||
timer->setProperty("directory", QString(dirWithTrailingSlash(directory)));
|
||||
connect(timer, SIGNAL(timeout()), instance(), SLOT(clearExpectedDirectory()));
|
||||
timer->setSingleShot(true);
|
||||
timer->start(300);
|
||||
}
|
||||
|
||||
|
||||
void DocumentManager::clearExpectedDirectory()
|
||||
{
|
||||
if (QTimer *timer = qobject_cast<QTimer *>(sender())) {
|
||||
d->m_expectedDirectories.remove(timer->property("directory").toString());
|
||||
timer->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Tries to save the files listed in \a documents. The \a cancelled argument is set to true
|
||||
if the user cancelled the dialog. Returns the files that could not be saved. If the files
|
||||
@@ -902,9 +945,18 @@ void DocumentManager::checkForReload()
|
||||
continue;
|
||||
|
||||
// was the change unexpected?
|
||||
if ((currentState.modified != expectedState.modified || currentState.permissions != expectedState.permissions)
|
||||
if ((currentState.modified != expectedState.modified
|
||||
|| currentState.permissions != expectedState.permissions)
|
||||
&& !expectedFileNames.contains(fileName)) {
|
||||
trigger = IDocument::TriggerExternal;
|
||||
bool expectedDir = false;
|
||||
foreach (const QString &expectedDirectory, d->m_expectedDirectories) {
|
||||
if (fileName.startsWith(expectedDirectory)) {
|
||||
expectedDir = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!expectedDir)
|
||||
trigger = IDocument::TriggerExternal;
|
||||
}
|
||||
|
||||
// find out the type
|
||||
|
||||
@@ -74,6 +74,9 @@ public:
|
||||
static void expectFileChange(const QString &fileName);
|
||||
static void unexpectFileChange(const QString &fileName);
|
||||
|
||||
static void expectDirectoryChange(const QString &directory);
|
||||
static void unexpectDirectoryChange(const QString &directory);
|
||||
|
||||
// recent files
|
||||
static void addToRecentFiles(const QString &fileName, const Id &editorId = Id());
|
||||
Q_SLOT void clearRecentFiles();
|
||||
@@ -150,6 +153,7 @@ private slots:
|
||||
void changedFile(const QString &file);
|
||||
void mainWindowActivated();
|
||||
void syncWithEditor(const QList<Core::IContext *> &context);
|
||||
void clearExpectedDirectory();
|
||||
};
|
||||
|
||||
/*! The FileChangeBlocker blocks all change notifications to all IDocument * that
|
||||
|
||||
@@ -510,6 +510,7 @@ void EditorView::goForwardInNavigationHistory()
|
||||
SplitterOrView::SplitterOrView(Core::IEditor *editor)
|
||||
{
|
||||
m_layout = new QStackedLayout(this);
|
||||
m_layout->setSizeConstraint(QLayout::SetNoConstraint);
|
||||
m_view = new EditorView(this);
|
||||
if (editor)
|
||||
m_view->addEditor(editor);
|
||||
|
||||
@@ -101,11 +101,13 @@ public:
|
||||
tab->icon = icon;
|
||||
tab->text = label;
|
||||
m_tabs.insert(index, tab);
|
||||
updateGeometry();
|
||||
}
|
||||
void setEnabled(int index, bool enabled);
|
||||
void removeTab(int index) {
|
||||
FancyTab *tab = m_tabs.takeAt(index);
|
||||
delete tab;
|
||||
updateGeometry();
|
||||
}
|
||||
void setCurrentIndex(int index);
|
||||
int currentIndex() const { return m_currentIndex; }
|
||||
|
||||
@@ -504,6 +504,13 @@ QString ICore::userResourcePath()
|
||||
return urp;
|
||||
}
|
||||
|
||||
QString ICore::documentationPath()
|
||||
{
|
||||
const QString docPath = QLatin1String(Utils::HostOsInfo::isMacHost()
|
||||
? "/../Resources/doc" : "/../share/doc/qtcreator");
|
||||
return QDir::cleanPath(QCoreApplication::applicationDirPath() + docPath);
|
||||
}
|
||||
|
||||
static QString compilerString()
|
||||
{
|
||||
#if defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too
|
||||
|
||||
@@ -112,6 +112,7 @@ public:
|
||||
|
||||
static QString resourcePath();
|
||||
static QString userResourcePath();
|
||||
static QString documentationPath();
|
||||
|
||||
static QString versionString();
|
||||
static QString buildCompatibilityString();
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDataStream>
|
||||
#include <QHash>
|
||||
#include <QVariant>
|
||||
|
||||
|
||||
@@ -35,7 +35,10 @@
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QVariant)
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QDataStream;
|
||||
class QVariant;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
|
||||
|
||||
@@ -5,48 +5,56 @@ Product {
|
||||
name: "LogoImages"
|
||||
|
||||
Group {
|
||||
name: "16x16"
|
||||
qbs.install: true
|
||||
qbs.installDir: "share/icons/hicolor/16x16/apps"
|
||||
files: ["16/QtProject-qtcreator.png"]
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "24x24"
|
||||
qbs.install: true
|
||||
qbs.installDir: "share/icons/hicolor/24x24/apps"
|
||||
files: ["24/QtProject-qtcreator.png"]
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "32x32"
|
||||
qbs.install: true
|
||||
qbs.installDir: "share/icons/hicolor/32x32/apps"
|
||||
files: ["32/QtProject-qtcreator.png"]
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "48x48"
|
||||
qbs.install: true
|
||||
qbs.installDir: "share/icons/hicolor/48x48/apps"
|
||||
files: ["48/QtProject-qtcreator.png"]
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "64x64"
|
||||
qbs.install: true
|
||||
qbs.installDir: "share/icons/hicolor/64x64/apps"
|
||||
files: ["64/QtProject-qtcreator.png"]
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "128x128"
|
||||
qbs.install: true
|
||||
qbs.installDir: "share/icons/hicolor/128x128/apps"
|
||||
files: ["128/QtProject-qtcreator.png"]
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "256x256"
|
||||
qbs.install: true
|
||||
qbs.installDir: "share/icons/hicolor/256x256/apps"
|
||||
files: ["256/QtProject-qtcreator.png"]
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "512x512"
|
||||
qbs.install: true
|
||||
qbs.installDir: "share/icons/hicolor/512x512/apps"
|
||||
files: ["512/QtProject-qtcreator.png"]
|
||||
|
||||
@@ -31,6 +31,12 @@
|
||||
#include "iversioncontrol.h"
|
||||
#include "icore.h"
|
||||
#include "documentmanager.h"
|
||||
#include "editormanager.h"
|
||||
#include "ieditor.h"
|
||||
#include "idocument.h"
|
||||
#include "infobar.h"
|
||||
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -74,6 +80,9 @@ public:
|
||||
QString topLevel;
|
||||
};
|
||||
|
||||
VcsManagerPrivate() : m_unconfiguredVcs(0)
|
||||
{ }
|
||||
|
||||
~VcsManagerPrivate()
|
||||
{
|
||||
qDeleteAll(m_vcsInfoList);
|
||||
@@ -165,6 +174,7 @@ public:
|
||||
|
||||
QMap<QString, VcsInfo *> m_cachedMatches;
|
||||
QList<VcsInfo *> m_vcsInfoList;
|
||||
IVersionControl *m_unconfiguredVcs;
|
||||
};
|
||||
|
||||
VcsManager::VcsManager(QObject *parent) :
|
||||
@@ -231,10 +241,8 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
|
||||
|
||||
foreach (IVersionControl * versionControl, versionControls) {
|
||||
QString topLevel;
|
||||
if (versionControl->isConfigured()
|
||||
&& versionControl->managesDirectory(directory, &topLevel)) {
|
||||
if (versionControl->managesDirectory(directory, &topLevel))
|
||||
allThatCanManage.push_back(StringVersionControlPair(topLevel, versionControl));
|
||||
}
|
||||
}
|
||||
|
||||
// To properly find a nested repository (say, git checkout inside SVN),
|
||||
@@ -265,7 +273,26 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
|
||||
// return result
|
||||
if (topLevelDirectory)
|
||||
*topLevelDirectory = allThatCanManage.first().first;
|
||||
return allThatCanManage.first().second;
|
||||
IVersionControl *versionControl = allThatCanManage.first().second;
|
||||
if (!versionControl->isConfigured()) {
|
||||
if (IEditor *curEditor = EditorManager::currentEditor()) {
|
||||
if (IDocument *curDocument = curEditor->document()) {
|
||||
Id vcsWarning("VcsNotConfiguredWarning");
|
||||
InfoBar *infoBar = curDocument->infoBar();
|
||||
if (infoBar->canInfoBeAdded(vcsWarning)) {
|
||||
InfoBarEntry info(vcsWarning,
|
||||
tr("%1 repository was detected but %1 is not configured.")
|
||||
.arg(versionControl->displayName()),
|
||||
InfoBarEntry::GlobalSuppressionEnabled);
|
||||
d->m_unconfiguredVcs = versionControl;
|
||||
info.setCustomButtonInfo(tr("Configure"), this, SLOT(configureVcs()));
|
||||
infoBar->addInfo(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
versionControl = 0;
|
||||
}
|
||||
return versionControl;
|
||||
}
|
||||
|
||||
QStringList VcsManager::repositories(const IVersionControl *vc) const
|
||||
@@ -386,6 +413,11 @@ void VcsManager::promptToAdd(const QString &directory, const QStringList &fileNa
|
||||
}
|
||||
}
|
||||
|
||||
void VcsManager::emitRepositoryChanged(const QString &repository)
|
||||
{
|
||||
emit repositoryChanged(repository);
|
||||
}
|
||||
|
||||
void VcsManager::clearVersionControlCache()
|
||||
{
|
||||
QStringList repoList = d->m_cachedMatches.keys();
|
||||
@@ -394,4 +426,11 @@ void VcsManager::clearVersionControlCache()
|
||||
emit repositoryChanged(repo);
|
||||
}
|
||||
|
||||
void VcsManager::configureVcs()
|
||||
{
|
||||
QTC_ASSERT(d->m_unconfiguredVcs, return);
|
||||
ICore::showOptionsDialog(Id(VcsBase::Constants::VCS_SETTINGS_CATEGORY),
|
||||
d->m_unconfiguredVcs->id());
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
||||
@@ -86,6 +86,8 @@ public:
|
||||
// added to revision control. Calls vcsAdd for each file.
|
||||
void promptToAdd(const QString &directory, const QStringList &fileNames);
|
||||
|
||||
void emitRepositoryChanged(const QString &repository);
|
||||
|
||||
// Utility messages for adding files
|
||||
static QString msgAddToVcsTitle();
|
||||
static QString msgPromptToAddToVcs(const QStringList &files, const IVersionControl *vc);
|
||||
@@ -98,6 +100,9 @@ signals:
|
||||
public slots:
|
||||
void clearVersionControlCache();
|
||||
|
||||
private slots:
|
||||
void configureVcs();
|
||||
|
||||
private:
|
||||
VcsManagerPrivate *d;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user