Merge with develop

--HG--
branch : compatibility-develop
This commit is contained in:
kervala 2016-06-11 17:06:08 +02:00
commit 1425aad8e3
22 changed files with 241 additions and 95 deletions

View file

@ -22,13 +22,8 @@ IF(NOT TARGET_CPU)
SET(TARGET_CPU "armv7")
ENDIF()
SET(ARMV7_HARD_FLOAT OFF)
IF(TARGET_CPU STREQUAL "armv7")
SET(LIBRARY_ARCHITECTURE "armeabi-v7a")
IF(ARMV7_HARD_FLOAT)
SET(LIBRARY_ARCHITECTURE "${LIBRARY_ARCHITECTURE}-hard")
ENDIF()
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
SET(TOOLCHAIN_ARCH "arm")
SET(GCC_TOOLCHAIN_PREFIX "arm-linux-androideabi")
@ -123,6 +118,12 @@ MACRO(SEARCH_TOOLCHAIN _COMPILER)
ENDFOREACH()
ENDIF()
# try prefixes without version
SET(_TOOLCHAIN_WITHOUT_VERSION "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}")
IF(EXISTS ${_TOOLCHAIN_WITHOUT_VERSION})
LIST(APPEND ${_COMPILER}_TOOLCHAIN_VERSIONS "default")
ENDIF()
IF(NOT ${_COMPILER}_TOOLCHAIN_VERSIONS)
MESSAGE(FATAL_ERROR "No Android ${_COMPILER} toolchain found in default search path ${NDK_ROOT}/toolchains")
ENDIF()
@ -136,7 +137,15 @@ MACRO(SEARCH_TOOLCHAIN _COMPILER)
LIST(GET ${_COMPILER}_TOOLCHAIN_VERSIONS 0 ${_COMPILER}_TOOLCHAIN_VERSION)
ENDIF()
SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-${${_COMPILER}_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
MESSAGE(STATUS "TOOLCHAIN_PREFIX = ${${_COMPILER}_TOOLCHAIN_VERSION}")
IF("${${_COMPILER}_TOOLCHAIN_VERSION}" STREQUAL "default")
MESSAGE(STATUS "default")
SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}/prebuilt/${TOOLCHAIN_HOST}")
ELSE()
MESSAGE(STATUS "not default")
SET(${_COMPILER}_TOOLCHAIN_ROOT "${NDK_ROOT}/toolchains/${${_COMPILER}_TOOLCHAIN_PREFIX}-${${_COMPILER}_TOOLCHAIN_VERSION}/prebuilt/${TOOLCHAIN_HOST}")
ENDIF()
IF(NOT EXISTS "${${_COMPILER}_TOOLCHAIN_ROOT}")
FILE(GLOB _TOOLCHAIN_PREFIXES "${${_COMPILER}_TOOLCHAIN_ROOT}*")
@ -192,7 +201,7 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
MACRO(SET_TOOLCHAIN_BINARY_LLVM _NAME _BINARY)
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE )
SET(${_NAME} ${CLANG_TOOLCHAIN_ROOT}/bin/${_BINARY}${TOOLCHAIN_BIN_SUFFIX} CACHE PATH "" FORCE)
ENDMACRO()
MACRO(SET_TOOLCHAIN_BINARY_GCC _NAME _BINARY)
@ -214,6 +223,14 @@ IF(CLANG)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_ASM_COMPILER llvm-as)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_AR llvm-ar)
SET_TOOLCHAIN_BINARY_LLVM(CMAKE_LINKER clang++)
IF(NOT EXISTS "${CMAKE_ASM_COMPILER}")
SET_TOOLCHAIN_BINARY_GCC(CMAKE_ASM_COMPILER as)
ENDIF()
IF(NOT EXISTS "${CMAKE_AR}")
SET_TOOLCHAIN_BINARY_GCC(CMAKE_AR ar)
ENDIF()
ELSE()
MESSAGE(STATUS "Using GCC compiler")

View file

@ -177,26 +177,26 @@ ENDIF()
# set the architecture for iOS - using ARCHS_STANDARD_32_BIT sets armv7,armv7s and appears to be XCode's standard.
# The other value that works is ARCHS_UNIVERSAL_IPHONE_OS but that sets armv7 only
IF(ARCHS)
SET(CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE string "Build architecture for iOS")
SET(CMAKE_OSX_ARCHITECTURES ${ARCHS} CACHE STRING "Build architecture for iOS")
ENDIF()
# Set the find root to the iOS developer roots and to user defined paths
set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} $ENV{EXTERNAL_IOS_PATH} CACHE string "iOS find search path root")
SET(CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX} ${CMAKE_SOURCE_DIR}/external $ENV{EXTERNAL_IOS_PATH} CACHE STRING "iOS find search path root")
# default to searching for frameworks first
set (CMAKE_FIND_FRAMEWORK FIRST)
SET(CMAKE_FIND_FRAMEWORK FIRST)
# set up the default search directories for frameworks
set (CMAKE_SYSTEM_FRAMEWORK_PATH
SET(CMAKE_SYSTEM_FRAMEWORK_PATH
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
)
# only search the iOS sdks, not the remainder of the host filesystem
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
# determinate location for bin utils based on CMAKE_FIND_ROOT_PATH
include(CMakeFindBinUtils)

View file

@ -137,8 +137,8 @@ NLMISC_COMMAND(fightDefaultRange, "Generic default fight range","")
{
if (args.size()==2)
{
CBotProfileFightHeal::fightDefaultMinRange = (float)atof(args[0].c_str());
CBotProfileFightHeal::fightDefaultMaxRange = (float)atof(args[1].c_str());
NLMISC::fromString(args[0], CBotProfileFightHeal::fightDefaultMinRange);
NLMISC::fromString(args[1], CBotProfileFightHeal::fightDefaultMaxRange);
}
log.displayNL("Generic default fight range is [%f;%f]", CBotProfileFightHeal::fightDefaultMinRange, CBotProfileFightHeal::fightDefaultMaxRange);
return true;

View file

@ -219,7 +219,7 @@ DEFINE_ACTION(ContextRegion,CELLZNE)
// if (args[i+1].get(str))
// {
// if (!str.empty())
// value=atof(str.c_str());
// NLMISC::fromString(str, value);
// }
// levelEnergy.setLevelEnergyValue(value, i);
// }
@ -241,7 +241,7 @@ DEFINE_ACTION(ContextGroupFamily,CZ_NRJ)
if (args[i].get(str))
{
if (!str.empty())
value=atof(str.c_str());
NLMISC::fromString(str, value);
}
groupFamily->setLevelEnergyValue(value, i);
}
@ -268,7 +268,7 @@ DEFINE_ACTION(ContextGroupFamily,CZ_NRJ)
// if (args[i+1].get(str))
// {
// if (!str.empty())
// value=atof(str.c_str());
// NLMISC::fromString(str, value);
// }
// levelEnergy.setLevelEnergyValue(value, i);
// }

View file

@ -1438,7 +1438,8 @@ public:
// try to parse a constant value
// var.Type = constant;
// double val = atof(str.c_str());
// double val;
// NLMISC::fromString(str, val);
// var.Value = float(val);
// return true;
}

View file

@ -1488,7 +1488,8 @@ CCaseTracer::CCaseTracer(const CSmartPtr<CSubRuleTracer> &tracer, const string &
if (valChldTracer=chldTracer->getChildForName(s_kw_NUMBER))
{
const string &strRef=valChldTracer->_TextValue;
const float f=(float)atof(strRef.c_str());
float f;
NLMISC::fromString(strRef, f);
_sortValue=*((size_t*)&f);
break;
}
@ -1954,7 +1955,8 @@ void CSubRuleTracer::generateCode(CSmartPtr<AIVM::CByteCode> &cByteCode) const
NLMISC::fromString(param, index);
--index;
string &strRef=_childTracers[index]->_TextValue;
const float f=(float)atof(strRef.c_str());
float f;
NLMISC::fromString(strRef, f);
byteCode.push_back(*((size_t*)&f));
jumpTable.newCodeBlock();
break;

View file

@ -118,7 +118,8 @@ onchildren { return TOKEN_ONCHILDREN; }
{double} {
const float f=(float)atof(yytext);
float f;
NLMISC::fromString(yytext, f);
INIT(*((size_t*)&f));
return TOKEN_NUMBER;
}

View file

@ -4473,7 +4473,8 @@ case 23:
YY_RULE_SETUP
#line 120 "ai_service/script_parser.lex"
{
const float f=(float)atof(yytext);
float f;
NLMISC::fromString(yytext, f);
INIT(*((size_t*)&f));
return TOKEN_NUMBER;
}

View file

@ -304,7 +304,7 @@ void CScriptVM::interpretCode(
case CScriptStack::EString:
{
string &str=stack.top();
f=(float)atof(str.c_str());
NLMISC::fromString(str, f);
}
break;
case CScriptStack::EFloat:
@ -406,7 +406,7 @@ void CScriptVM::interpretCode(
case CScriptStack::EString:
{
string& str = stack.top();
f = (float)atof(str.c_str());
NLMISC::fromString(str, f);
}
break;
case CScriptStack::EFloat:
@ -601,7 +601,7 @@ void CScriptVM::interpretCode(
case CScriptStack::EString:
{
string& str = stack.top();
f = (float)atof(str.c_str());
NLMISC::fromString(str, f);
}
break;
case CScriptStack::EFloat:

View file

@ -1122,7 +1122,8 @@ NLMISC_COMMAND(setSheetProperty,"change a value read from a sheet","<sheet> leve
}
// get the value
float val = (float)atof(args[2].c_str());
float val;
NLMISC::fromString(args[2], val);
if (val==0 && args[2]!="0" && args[2]!="0.0")
{
log.displayNL("'%s' is not a valid value",args[2].c_str());

View file

@ -127,7 +127,6 @@ bool CConfigFile::load(const QString &filename)
profile.id = settings.value("id").toString();
profile.name = settings.value("name").toString();
profile.account = settings.value("account").toString();
profile.server = settings.value("server").toString();
profile.executable = settings.value("executable").toString();
profile.arguments = settings.value("arguments").toString();
@ -216,7 +215,6 @@ bool CConfigFile::save() const
settings.setValue("id", profile.id);
settings.setValue("name", profile.name);
settings.setValue("account", profile.account);
settings.setValue("server", profile.server);
settings.setValue("executable", profile.executable);
settings.setValue("arguments", profile.arguments);
@ -577,13 +575,33 @@ bool CConfigFile::shouldCreateDesktopShortcut() const
return profile.desktopShortcut && !QFile::exists(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + "/Ryzom.lnk");
}
QString CConfigFile::getClientFullPath() const
QString CConfigFile::getProfileClientFullPath(int profileIndex) const
{
QString path = getProfile().executable;
const CProfile &profile = getProfile(profileIndex);
QString path = profile.executable;
if (!path.isEmpty()) return path;
return getInstallationDirectory() + "/" + getServer().id + "/" + getServer().clientFilename;
return getServerClientFullPath(profile.server);
}
QString CConfigFile::getServerClientFullPath(const QString &serverId) const
{
const CServer &server = getServer(serverId);
if (server.clientFilename.isEmpty()) return "";
return getInstallationDirectory() + "/" + server.id + "/" + server.clientFilename;
}
QString CConfigFile::getServerConfigurationFullPath(const QString &serverId) const
{
const CServer &server = getServer(serverId);
if (server.configurationFilename.isEmpty()) return "";
return getInstallationDirectory() + "/" + server.id + "/" + server.configurationFilename;
}
QString CConfigFile::getSrcServerClientBNPFullPath() const

View file

@ -54,7 +54,6 @@ struct CProfile
}
QString id;
QString account;
QString name;
QString server;
QString executable;
@ -172,7 +171,9 @@ public:
QString getClientArch() const;
QString getClientFullPath() const;
QString getProfileClientFullPath(int profileIndex = -1) const;
QString getServerClientFullPath(const QString &serverId = "") const;
QString getServerConfigurationFullPath(const QString &serverId = "") const;
QString getSrcServerClientBNPFullPath() const;

View file

@ -123,6 +123,7 @@ void CFilesCopier::getFilesList(FilesToCopy &files)
file.dst = dstPath;
file.size = entry.size();
file.date = entry.lastModified().toTime_t();
file.permissions = entry.permissions();
files << file;
}
@ -141,6 +142,7 @@ void CFilesCopier::getFilesList(FilesToCopy &files)
file.dst = m_destinationDirectory + "/" + fileInfo.fileName();
file.size = fileInfo.size();
file.date = fileInfo.lastModified().toTime_t();
file.permissions = fileInfo.permissions();
files << file;
}
@ -187,6 +189,11 @@ bool CFilesCopier::copyFiles(const FilesToCopy &files)
return false;
}
if (!QFile::setPermissions(file.dst, file.permissions))
{
qDebug() << "Unable to change permissions of " << file.dst;
}
if (!NLMISC::CFile::setFileModificationDate(qToUtf8(file.dst), file.date))
{
qDebug() << "Unable to change date of " << file.dst;

View file

@ -49,6 +49,7 @@ protected:
QString dst;
qint64 size;
uint date;
QFile::Permissions permissions;
};
typedef QList<FileToCopy> FilesToCopy;

View file

@ -41,6 +41,7 @@ CMainWindow::CMainWindow():QMainWindow()
connect(actionProfiles, SIGNAL(triggered()), SLOT(onProfiles()));
connect(actionUninstall, SIGNAL(triggered()), SLOT(onUninstall()));
connect(actionQuit, SIGNAL(triggered()), SLOT(onQuit()));
connect(playButton, SIGNAL(clicked()), SLOT(onPlayClicked()));
connect(configureButton, SIGNAL(clicked()), SLOT(onConfigureClicked()));
@ -80,16 +81,20 @@ void CMainWindow::onPlayClicked()
if (profileIndex < 0) return;
CProfile profile = CConfigFile::getInstance()->getProfile(profileIndex);
CConfigFile *config = CConfigFile::getInstance();
if (profile.executable.isEmpty()) return;
const CProfile &profile = config->getProfile(profileIndex);
QString executable = config->getProfileClientFullPath(profileIndex);
if (executable.isEmpty() || !QFile::exists(executable)) return;
QStringList arguments;
arguments << "-p";
arguments << QString::number(profileIndex);
arguments << profile.id;
arguments << profile.arguments.split(' ');
bool started = QProcess::startDetached(profile.executable, arguments);
bool started = QProcess::startDetached(executable, arguments);
CConfigFile::getInstance()->setDefaultProfileIndex(profileIndex);
}
@ -100,19 +105,19 @@ void CMainWindow::onConfigureClicked()
if (profileIndex < 0) return;
CProfile profile = CConfigFile::getInstance()->getProfile(profileIndex);
CConfigFile *config = CConfigFile::getInstance();
if (profile.server.isEmpty()) return;
const CProfile &profile = config->getProfile(profileIndex);
CServer server = CConfigFile::getInstance()->getServer(profile.server);
QString executable = config->getServerConfigurationFullPath(profile.server);
if (server.configurationFilename.isEmpty()) return;
if (executable.isEmpty() || !QFile::exists(executable)) return;
QStringList arguments;
arguments << "-p";
arguments << QString::number(profileIndex);
arguments << profile.id;
bool started = QProcess::startDetached(server.configurationFilename, arguments);
bool started = QProcess::startDetached(executable, arguments);
CConfigFile::getInstance()->setDefaultProfileIndex(profileIndex);
}
@ -159,6 +164,11 @@ void CMainWindow::onUninstall()
}
}
void CMainWindow::onQuit()
{
close();
}
void CMainWindow::onAbout()
{
QString br("<br>");

View file

@ -43,6 +43,8 @@ public slots:
void onProfiles();
void onUninstall();
void onQuit();
void onAbout();
void onAboutQt();

View file

@ -590,7 +590,6 @@ bool COperationDialog::createDefaultProfile()
CProfile profile;
profile.id = "0";
profile.executable = config->getClientFullPath();
profile.name = QString("Ryzom (%1)").arg(server.name);
profile.server = server.id;
profile.comments = "Default profile created by Ryzom Installer";

View file

@ -32,6 +32,7 @@ CProfilesDialog::CProfilesDialog(QWidget *parent):QDialog(parent), m_currentProf
connect(deleteButton, SIGNAL(clicked()), SLOT(onDeleteProfile()));
connect(profilesListView, SIGNAL(clicked(QModelIndex)), SLOT(onProfileClicked(QModelIndex)));
connect(executableBrowseButton, SIGNAL(clicked()), SLOT(onExecutableBrowseClicked()));
connect(directoryButton, SIGNAL(clicked()), SLOT(onProfileDirectoryClicked()));
m_model = new CProfilesModel(this);
m_serversModel = new CServersModel(this);
@ -60,6 +61,7 @@ void CProfilesDialog::accept()
void CProfilesDialog::onAddProfile()
{
addProfile();
}
void CProfilesDialog::onDeleteProfile()
@ -85,7 +87,6 @@ void CProfilesDialog::displayProfile(int index)
bool enabled = index > -1;
profileIdLabel->setEnabled(enabled);
accountEdit->setEnabled(enabled);
nameEdit->setEnabled(enabled);
serverComboBox->setEnabled(enabled);
argumentsEdit->setEnabled(enabled);
@ -97,18 +98,29 @@ void CProfilesDialog::displayProfile(int index)
const CProfile &profile = m_model->getProfiles()[index];
QString executable = profile.executable;
if (executable.isEmpty())
{
executable = CConfigFile::getInstance()->getServerClientFullPath(profile.server);
}
QString profileDirectory = CConfigFile::getInstance()->getProfileDirectory() + "/" + profile.id;
// update all widgets with content of profile
profileIdLabel->setText(profile.id);
accountEdit->setText(profile.account);
nameEdit->setText(profile.name);
serverComboBox->setCurrentIndex(m_serversModel->getIndexFromServerID(profile.server));
executablePathLabel->setText(QFileInfo(profile.executable).fileName());
executablePathLabel->setText(QFileInfo(executable).fileName());
argumentsEdit->setText(profile.arguments);
commentsEdit->setPlainText(profile.comments);
directoryPathLabel->setText(CConfigFile::getInstance()->getProfileDirectory());
directoryPathLabel->setText(profileDirectory);
desktopShortcutCheckBox->setChecked(profile.desktopShortcut);
menuShortcutCheckBox->setChecked(profile.menuShortcut);
// disable click on button if directory doesn't exist
directoryButton->setEnabled(QFile::exists(profileDirectory));
updateExecutableVersion(index);
m_currentProfileIndex = index;
@ -116,11 +128,10 @@ void CProfilesDialog::displayProfile(int index)
void CProfilesDialog::saveProfile(int index)
{
if (index < 0) return;
if (index < 0 || index >= m_model->rowCount()) return;
CProfile &profile = m_model->getProfiles()[index];
profile.account = accountEdit->text();
profile.name = nameEdit->text();
profile.server = m_serversModel->getServerIDFromIndex(serverComboBox->currentIndex());
profile.arguments = argumentsEdit->text();
@ -135,12 +146,62 @@ void CProfilesDialog::deleteProfile(int index)
m_model->removeRow(index);
COperationDialog dialog;
// decrement profile index
--index;
// select row and update content
profilesListView->setCurrentIndex(m_model->index(index, 0));
displayProfile(index);
// TODO: delete files for delete profile
}
void CProfilesDialog::addProfile()
{
// TODO: browse all folders in AppData/Roaming/Ryzom
int index = m_model->rowCount();
// append the new profile
m_model->insertRow(index);
CConfigFile *config = CConfigFile::getInstance();
CProfile &profile = m_model->getProfiles()[index];
const CServer &server = config->getServer(config->getDefaultServerIndex());
int nextId = 0;
// search an ID that doesn't correspond to an existing profile directory
while (QFile::exists(config->getProfileDirectory() + "/" + QString::number(nextId))) ++nextId;
// increment this ID until not used in profiles
while(nextId < 100)
{
bool found = false;
// search if this ID is already used in existing profiles
foreach(const CProfile &p, m_model->getProfiles())
{
if (p.id == QString::number(nextId))
{
found = true;
break;
}
}
if (!found) break;
// increment ID
++nextId;
}
// set default parameters
profile.id = QString::number(nextId);
profile.server = server.id;
profilesListView->setCurrentIndex(m_model->index(index, 0));
displayProfile(index);
// TODO: copy files to new server if files don't exist
}
void CProfilesDialog::updateExecutableVersion(int index)
@ -154,19 +215,11 @@ void CProfilesDialog::updateExecutableVersion(int index)
// file empty, use default one
if (executable.isEmpty())
{
executable = CConfigFile::getInstance()->getInstallationDirectory() + "/" + profile.server + "/";
#if defined(Q_OS_WIN32)
executable += "ryzom_client_r.exe";
#elif defined(Q_OS_APPLE)
executable += "Ryzom.app/Contents/MacOS/Ryzom";
#else
executable += "ryzom_client";
#endif
executable += CConfigFile::getInstance()->getServerClientFullPath(profile.server);
}
// file doesn't exist
if (!QFile::exists(executable)) return;
if (executable.isEmpty() || !QFile::exists(executable)) return;
// launch executable with --version argument
QProcess process;
@ -198,13 +251,39 @@ void CProfilesDialog::onExecutableBrowseClicked()
CProfile &profile = m_model->getProfiles()[m_currentProfileIndex];
QString file = QFileDialog::getOpenFileName(this, tr("Please choose Ryzom client executable to launch"), profile.executable, tr("Executables (*.exe)"));
QString executable = profile.executable;
if (file.isEmpty()) return;
if (executable.isEmpty())
{
executable = CConfigFile::getInstance()->getServerClientFullPath(profile.server);
}
profile.executable = file;
executable = QFileDialog::getOpenFileName(this, tr("Please choose Ryzom client executable to launch"), executable, tr("Executables (*.exe)"));
executablePathLabel->setText(QFileInfo(profile.executable).fileName());
if (executable.isEmpty()) return;
// don't need to save the new executable if the same as default one
if (executable == CConfigFile::getInstance()->getServerClientFullPath(profile.server))
{
profile.executable.clear();
}
else
{
profile.executable = executable;
}
executablePathLabel->setText(QFileInfo(executable).fileName());
updateExecutableVersion(m_currentProfileIndex);
}
void CProfilesDialog::onProfileDirectoryClicked()
{
if (m_currentProfileIndex < 0) return;
const CProfile &profile = m_model->getProfiles()[m_currentProfileIndex];
QString profileDirectory = CConfigFile::getInstance()->getProfileDirectory() + "/" + profile.id;
QDesktopServices::openUrl(QUrl::fromLocalFile(profileDirectory));
}

View file

@ -42,6 +42,7 @@ private slots:
void onAddProfile();
void onDeleteProfile();
void onProfileClicked(const QModelIndex &index);
void onProfileDirectoryClicked();
void displayProfile(int index);
void saveProfile(int index);

View file

@ -27,6 +27,21 @@ QVariant CProfilesModel::data(const QModelIndex &index, int role) const
return tr("#%1: %2").arg(profile.id).arg(profile.name);
}
bool CProfilesModel::insertRows(int row, int count, const QModelIndex &parent)
{
if (row < 0) return false;
beginInsertRows(parent, row, row + count - 1);
// prepend empty profiles
CProfile profile;
m_profiles.insert(row, count, profile);
endInsertRows();
return true;
}
bool CProfilesModel::removeRows(int row, int count, const QModelIndex &parent)
{
if (row < 0) return false;

View file

@ -19,6 +19,7 @@ public:
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
CProfiles& getProfiles() { return m_profiles; }

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>583</width>
<height>368</height>
<height>348</height>
</rect>
</property>
<property name="windowTitle">
@ -81,33 +81,23 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="accountLabel">
<property name="text">
<string>Account:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="accountEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="1" column="1">
<widget class="QLineEdit" name="nameEdit"/>
</item>
<item row="3" column="0">
<item row="2" column="0">
<widget class="QLabel" name="serverLabel">
<property name="text">
<string>Server:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="2" column="1">
<widget class="QComboBox" name="serverComboBox">
<item>
<property name="text">
@ -121,14 +111,14 @@
</item>
</widget>
</item>
<item row="4" column="0">
<item row="3" column="0">
<widget class="QLabel" name="executableLabel">
<property name="text">
<string>Executable:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="3" column="1">
<layout class="QHBoxLayout" name="executableLayout" stretch="1,0">
<item>
<widget class="QLabel" name="executablePathLabel">
@ -146,38 +136,38 @@
</item>
</layout>
</item>
<item row="5" column="0">
<item row="4" column="0">
<widget class="QLabel" name="clientVersionLabel">
<property name="text">
<string>Client version:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="4" column="1">
<widget class="QLabel" name="executableVersionLabel">
<property name="text">
<string>FV 3.0.0</string>
</property>
</widget>
</item>
<item row="6" column="0">
<item row="5" column="0">
<widget class="QLabel" name="argumentsLabel">
<property name="text">
<string>Arguments:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="5" column="1">
<widget class="QLineEdit" name="argumentsEdit"/>
</item>
<item row="7" column="0">
<item row="6" column="0">
<widget class="QLabel" name="commentsLabel">
<property name="text">
<string>Comments:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<item row="6" column="1">
<widget class="QPlainTextEdit" name="commentsEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -187,14 +177,14 @@
</property>
</widget>
</item>
<item row="8" column="0">
<item row="7" column="0">
<widget class="QLabel" name="directoryLabel">
<property name="text">
<string>Directory:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="7" column="1">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
<item>
<widget class="QLabel" name="directoryPathLabel">
@ -212,14 +202,14 @@
</item>
</layout>
</item>
<item row="9" column="0">
<item row="8" column="0">
<widget class="QLabel" name="shortcutsLabel">
<property name="text">
<string>Create shortcuts:</string>
</property>
</widget>
</item>
<item row="9" column="1">
<item row="8" column="1">
<layout class="QVBoxLayout" name="shortcutsLayout">
<item>
<widget class="QCheckBox" name="desktopShortcutCheckBox">
@ -257,7 +247,6 @@
<tabstop>profilesListView</tabstop>
<tabstop>addButton</tabstop>
<tabstop>deleteButton</tabstop>
<tabstop>accountEdit</tabstop>
<tabstop>nameEdit</tabstop>
<tabstop>serverComboBox</tabstop>
<tabstop>executableBrowseButton</tabstop>