forked from qt-creator/qt-creator
Merge commit 'origin/1.1'
This commit is contained in:
@@ -177,6 +177,7 @@ void QrcEditor::resolveLocationIssues(QStringList &files)
|
||||
const QString dotdotSlash = QLatin1String("../");
|
||||
int i = 0;
|
||||
int count = files.count();
|
||||
int initialCount = files.count();
|
||||
|
||||
// Find first troublesome file
|
||||
for (; i < count; i++) {
|
||||
@@ -213,10 +214,14 @@ void QrcEditor::resolveLocationIssues(QStringList &files)
|
||||
message.setWindowTitle(tr("Invalid file"));
|
||||
message.setIcon(QMessageBox::Warning);
|
||||
QPushButton * const copyButton = message.addButton(tr("Copy"), QMessageBox::ActionRole);
|
||||
QPushButton * const skipButton = message.addButton(tr("Don't add"), QMessageBox::DestructiveRole);
|
||||
QPushButton * skipButton = NULL;
|
||||
if (initialCount > 1)
|
||||
{
|
||||
skipButton = message.addButton(tr("Skip"), QMessageBox::DestructiveRole);
|
||||
message.setEscapeButton(skipButton);
|
||||
}
|
||||
QPushButton * const abortButton = message.addButton(tr("Abort"), QMessageBox::RejectRole);
|
||||
message.setDefaultButton(copyButton);
|
||||
message.setEscapeButton(skipButton);
|
||||
message.setText(tr("The file %1 is not in a subdirectory of the resource file. Continuing will result in an invalid resource file.")
|
||||
.arg(QDir::toNativeSeparators(file)));
|
||||
message.exec();
|
||||
@@ -226,7 +231,12 @@ void QrcEditor::resolveLocationIssues(QStringList &files)
|
||||
i--; // Compensate i++
|
||||
} else if (message.clickedButton() == copyButton) {
|
||||
const QFileInfo fi(file);
|
||||
const QFileInfo suggestion(dir, fi.fileName());
|
||||
QFileInfo suggestion;
|
||||
QDir tmpTarget(dir.path() + QString(QDir::separator()) + QString("Resources"));;
|
||||
if (tmpTarget.exists())
|
||||
suggestion.setFile(tmpTarget, fi.fileName());
|
||||
else
|
||||
suggestion.setFile(dir, fi.fileName());
|
||||
const QString copyName = QFileDialog::getSaveFileName(this, tr("Choose copy location"),
|
||||
suggestion.absoluteFilePath());
|
||||
if (!copyName.isEmpty()) {
|
||||
|
||||
@@ -199,9 +199,8 @@ ResourceView::ResourceView(QUndoStack *history, QWidget *parent) :
|
||||
enableContextMenu(true);
|
||||
}
|
||||
|
||||
ResourceView::~ResourceView(void)
|
||||
ResourceView::~ResourceView()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ResourceView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
||||
@@ -477,7 +476,7 @@ void ResourceView::onEditAlias()
|
||||
changeAlias(index);
|
||||
}
|
||||
|
||||
bool ResourceView::load(QString fileName)
|
||||
bool ResourceView::load(const QString &fileName)
|
||||
{
|
||||
const QFileInfo fi(fileName);
|
||||
m_qrcModel->setFileName(fi.absoluteFilePath());
|
||||
@@ -488,7 +487,7 @@ bool ResourceView::load(QString fileName)
|
||||
return m_qrcModel->reload();
|
||||
}
|
||||
|
||||
bool ResourceView::save(void)
|
||||
bool ResourceView::save()
|
||||
{
|
||||
return m_qrcModel->save();
|
||||
}
|
||||
|
||||
@@ -84,10 +84,10 @@ public:
|
||||
};
|
||||
|
||||
ResourceView(QUndoStack *history, QWidget *parent = 0);
|
||||
~ResourceView(void);
|
||||
~ResourceView();
|
||||
|
||||
bool load(QString fileName);
|
||||
bool save(void);
|
||||
bool load(const QString &fileName);
|
||||
bool save();
|
||||
QString fileName() const;
|
||||
void setFileName(const QString &fileName);
|
||||
|
||||
@@ -114,9 +114,9 @@ public:
|
||||
bool defaultAddFileEnabled() const;
|
||||
|
||||
void findSamePlacePostDeletionModelIndex(int &row, QModelIndex &parent) const;
|
||||
EntryBackup * removeEntry(const QModelIndex &index);
|
||||
EntryBackup *removeEntry(const QModelIndex &index);
|
||||
void addFiles(int prefixIndex, const QStringList &fileNames, int cursorFile,
|
||||
int &firstFile, int &lastFile);
|
||||
int &firstFile, int &lastFile);
|
||||
void removeFiles(int prefixIndex, int firstFileIndex, int lastFileIndex);
|
||||
QStringList fileNamesToAdd();
|
||||
QModelIndex addPrefix();
|
||||
@@ -158,8 +158,8 @@ public:
|
||||
void changeValue(const QModelIndex &nodeIndex, NodeProperty property, const QString &value);
|
||||
|
||||
private:
|
||||
void addUndoCommand(const QModelIndex &nodeIndex, NodeProperty property, const QString &before,
|
||||
const QString &after);
|
||||
void addUndoCommand(const QModelIndex &nodeIndex, NodeProperty property,
|
||||
const QString &before, const QString &after);
|
||||
|
||||
QPoint m_releasePos;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user