Make lib path chooser case-insensitive on Windows

Clear the old maemo stuff.

Task-number: QTCREATORBUG-16057
Change-Id: Ib349683e979a202c2244d6cdeec18a20517be4f6
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Jarek Kobus
2016-08-08 15:16:24 +02:00
committed by Jarek Kobus
parent b4ca04346e
commit 02937fdc4b
3 changed files with 12 additions and 38 deletions

View File

@@ -28,18 +28,18 @@
#include "librarydetailscontroller.h" #include "librarydetailscontroller.h"
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/fileutils.h>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QRadioButton> #include <QRadioButton>
#include <QLabel> #include <QLabel>
#include <QFileInfo> #include <QFileInfo>
#include <QDebug> #include <QTextStream>
using namespace QmakeProjectManager; using namespace QmakeProjectManager;
using namespace QmakeProjectManager::Internal; using namespace QmakeProjectManager::Internal;
const char qt_file_dialog_filter_reg_exp[] = const char qt_file_dialog_filter_reg_exp[] =
"^(.*)\\(([a-zA-Z0-9_.*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$"; "^(.*)\\(([a-zA-Z0-9_.*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$";
@@ -54,19 +54,20 @@ QStringList qt_clean_filter_list(const QString &filter)
return f.split(QLatin1Char(' '), QString::SkipEmptyParts); return f.split(QLatin1Char(' '), QString::SkipEmptyParts);
} }
static bool validateLibraryPath(const QString &path, const Utils::PathChooser *pathChooser, static bool validateLibraryPath(const Utils::FileName &filePath,
const Utils::PathChooser *pathChooser,
QString *errorMessage) QString *errorMessage)
{ {
Q_UNUSED(errorMessage); Q_UNUSED(errorMessage);
QFileInfo fi(path); if (!filePath.exists())
if (!fi.exists())
return false; return false;
const QString fileName = fi.fileName(); const QString fileName = filePath.fileName();
QStringList filters = qt_clean_filter_list(pathChooser->promptDialogFilter()); QStringList filters = qt_clean_filter_list(pathChooser->promptDialogFilter());
for (int i = 0; i < filters.count(); i++) { for (int i = 0; i < filters.count(); i++) {
QRegExp regExp(filters.at(i)); QRegExp regExp(filters.at(i));
regExp.setCaseSensitivity(Utils::HostOsInfo::fileNameCaseSensitivity());
regExp.setPatternSyntax(QRegExp::Wildcard); regExp.setPatternSyntax(QRegExp::Wildcard);
if (regExp.exactMatch(fileName)) if (regExp.exactMatch(fileName))
return true; return true;
@@ -195,8 +196,8 @@ DetailsPage::DetailsPage(AddLibraryWizard *parent)
const auto pathValidator = [libPathChooser](Utils::FancyLineEdit *edit, QString *errorMessage) { const auto pathValidator = [libPathChooser](Utils::FancyLineEdit *edit, QString *errorMessage) {
return libPathChooser->defaultValidationFunction()(edit, errorMessage) return libPathChooser->defaultValidationFunction()(edit, errorMessage)
&& validateLibraryPath(libPathChooser->fileName().toString(), libPathChooser, && validateLibraryPath(libPathChooser->fileName(),
errorMessage); libPathChooser, errorMessage);
}; };
libPathChooser->setValidationFunction(pathValidator); libPathChooser->setValidationFunction(pathValidator);
setProperty(Utils::SHORT_TITLE_PROPERTY, tr("Details")); setProperty(Utils::SHORT_TITLE_PROPERTY, tr("Details"));

View File

@@ -31,10 +31,7 @@
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
#include <projectexplorer/project.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
@@ -53,41 +50,16 @@ LibraryDetailsController::LibraryDetailsController(
m_proFile(proFile), m_proFile(proFile),
m_libraryDetailsWidget(libraryDetails) m_libraryDetailsWidget(libraryDetails)
{ {
m_creatorPlatform = CreatorLinux;
switch (Utils::HostOsInfo::hostOs()) { switch (Utils::HostOsInfo::hostOs()) {
case Utils::OsTypeMac: case Utils::OsTypeMac:
m_creatorPlatform = CreatorMac; m_creatorPlatform = CreatorMac;
break;
case Utils::OsTypeLinux:
m_creatorPlatform = CreatorLinux;
break;
case Utils::OsTypeWindows: case Utils::OsTypeWindows:
m_creatorPlatform = CreatorWindows; m_creatorPlatform = CreatorWindows;
break;
default: default:
break; break;
} }
if (!Utils::HostOsInfo::isLinuxHost()) {
// project for which we are going to insert the snippet
const Project *project = SessionManager::projectForFile(Utils::FileName::fromString(proFile));
if (project && project->activeTarget()) {
// if its tool chain is maemo behave the same as we would be on linux
ProjectExplorer::ToolChain *tc = ToolChainKitInformation::toolChain(project->activeTarget()->kit(), ToolChain::Language::Cxx);
if (tc) {
switch (tc->targetAbi().os()) {
case Abi::WindowsOS:
m_creatorPlatform = CreatorWindows;
break;
case Abi::DarwinOS:
m_creatorPlatform = CreatorMac;
break;
default:
m_creatorPlatform = CreatorLinux;
break;
}
}
}
}
setPlatformsVisible(true); setPlatformsVisible(true);
setLinkageGroupVisible(true); setLinkageGroupVisible(true);
setMacLibraryGroupVisible(true); setMacLibraryGroupVisible(true);

View File

@@ -42,10 +42,11 @@ public:
QObject *parent = 0); QObject *parent = 0);
virtual bool isComplete() const = 0; virtual bool isComplete() const = 0;
virtual QString snippet() const = 0; virtual QString snippet() const = 0;
signals: signals:
void completeChanged(); void completeChanged();
protected:
protected:
enum CreatorPlatform { enum CreatorPlatform {
CreatorLinux, CreatorLinux,
CreatorMac, CreatorMac,