mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-30 03:32:36 +00:00
Cleaned up old wizard stuff from launcher
This commit is contained in:
parent
38d825b004
commit
5af12d193a
@ -406,7 +406,7 @@ IF(NOT WIN32 AND NOT APPLE)
|
||||
IF(BUILD_WIZARD)
|
||||
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/wizard" DESTINATION "${BINDIR}" )
|
||||
ENDIF(BUILD_WIZARD)
|
||||
|
||||
|
||||
|
||||
# Install licenses
|
||||
INSTALL(FILES "DejaVu Font License.txt" DESTINATION "${LICDIR}" )
|
||||
@ -460,7 +460,7 @@ if(WIN32)
|
||||
IF(BUILD_WIZARD)
|
||||
INSTALL(PROGRAMS "${OpenMW_BINARY_DIR}/Release/openmw-wizard.exe" DESTINATION ".")
|
||||
ENDIF(BUILD_WIZARD)
|
||||
|
||||
|
||||
|
||||
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION ".")
|
||||
|
||||
@ -543,13 +543,6 @@ if (BUILD_ESMTOOL)
|
||||
endif()
|
||||
|
||||
if (BUILD_LAUNCHER)
|
||||
if(NOT WIN32)
|
||||
find_package(LIBUNSHIELD REQUIRED)
|
||||
if(NOT LIBUNSHIELD_FOUND)
|
||||
message(SEND_ERROR "Failed to find libunshield")
|
||||
endif(NOT LIBUNSHIELD_FOUND)
|
||||
endif(NOT WIN32)
|
||||
|
||||
add_subdirectory( apps/launcher )
|
||||
endif()
|
||||
|
||||
@ -562,6 +555,11 @@ if (BUILD_OPENCS)
|
||||
endif()
|
||||
|
||||
if (BUILD_WIZARD)
|
||||
find_package(LIBUNSHIELD REQUIRED)
|
||||
if(NOT LIBUNSHIELD_FOUND)
|
||||
message(FATAL_ERROR "Failed to find Unshield library")
|
||||
endif(NOT LIBUNSHIELD_FOUND)
|
||||
|
||||
add_subdirectory(apps/wizard)
|
||||
endif()
|
||||
|
||||
|
@ -9,16 +9,12 @@ set(LAUNCHER
|
||||
|
||||
settings/graphicssettings.cpp
|
||||
|
||||
utils/checkablemessagebox.cpp
|
||||
utils/profilescombobox.cpp
|
||||
utils/textinputdialog.cpp
|
||||
utils/lineedit.cpp
|
||||
|
||||
${CMAKE_SOURCE_DIR}/files/launcher/launcher.rc
|
||||
)
|
||||
if(NOT WIN32)
|
||||
LIST(APPEND LAUNCHER unshieldthread.cpp)
|
||||
endif(NOT WIN32)
|
||||
|
||||
set(LAUNCHER_HEADER
|
||||
datafilespage.hpp
|
||||
@ -30,15 +26,10 @@ set(LAUNCHER_HEADER
|
||||
|
||||
settings/graphicssettings.hpp
|
||||
|
||||
utils/checkablemessagebox.hpp
|
||||
utils/profilescombobox.hpp
|
||||
utils/textinputdialog.hpp
|
||||
utils/lineedit.hpp
|
||||
)
|
||||
if(NOT WIN32)
|
||||
LIST(APPEND LAUNCHER_HEADER unshieldthread.hpp)
|
||||
endif(NOT WIN32)
|
||||
|
||||
|
||||
# Headers that must be pre-processed
|
||||
set(LAUNCHER_HEADER_MOC
|
||||
@ -50,17 +41,11 @@ set(LAUNCHER_HEADER_MOC
|
||||
settingspage.hpp
|
||||
|
||||
utils/textinputdialog.hpp
|
||||
utils/checkablemessagebox.hpp
|
||||
utils/profilescombobox.hpp
|
||||
utils/lineedit.hpp
|
||||
|
||||
)
|
||||
|
||||
if(NOT WIN32)
|
||||
LIST(APPEND LAUNCHER_HEADER_MOC unshieldthread.hpp)
|
||||
endif(NOT WIN32)
|
||||
|
||||
|
||||
set(LAUNCHER_UI
|
||||
${CMAKE_SOURCE_DIR}/files/ui/datafilespage.ui
|
||||
${CMAKE_SOURCE_DIR}/files/ui/graphicspage.ui
|
||||
@ -119,19 +104,12 @@ target_link_libraries(omwlauncher
|
||||
${QT_LIBRARIES}
|
||||
components
|
||||
)
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(omwlauncher
|
||||
${LIBUNSHIELD_LIBRARY}
|
||||
)
|
||||
endif(NOT WIN32)
|
||||
|
||||
|
||||
|
||||
if(DPKG_PROGRAM)
|
||||
INSTALL(TARGETS omwlauncher RUNTIME DESTINATION games COMPONENT omwlauncher)
|
||||
endif()
|
||||
|
||||
if (BUILD_WITH_CODE_COVERAGE)
|
||||
if(BUILD_WITH_CODE_COVERAGE)
|
||||
add_definitions (--coverage)
|
||||
target_link_libraries(omwlauncher gcov)
|
||||
endif()
|
||||
|
@ -52,11 +52,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
Launcher::MainDialog mainWin;
|
||||
|
||||
if (mainWin.setup()) {
|
||||
mainWin.show();
|
||||
} else {
|
||||
if (!mainWin.setup()) {
|
||||
return 0;
|
||||
}
|
||||
//mainWin.show();
|
||||
}/* else {
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
int returnValue = app.exec();
|
||||
SDL_Quit();
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <QLabel>
|
||||
#include <QDate>
|
||||
#include <QTime>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QFontDatabase>
|
||||
#include <QInputDialog>
|
||||
@ -16,14 +17,6 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#ifndef WIN32
|
||||
#include "unshieldthread.hpp"
|
||||
#endif
|
||||
|
||||
#include "textslotmsgbox.hpp"
|
||||
|
||||
#include "utils/checkablemessagebox.hpp"
|
||||
|
||||
#include "playpage.hpp"
|
||||
#include "graphicspage.hpp"
|
||||
#include "datafilespage.hpp"
|
||||
@ -56,6 +49,10 @@ Launcher::MainDialog::MainDialog(QWidget *parent)
|
||||
setupUi(this);
|
||||
|
||||
mGameInvoker = new ProcessInvoker();
|
||||
mWizardInvoker = new ProcessInvoker();
|
||||
|
||||
connect(mWizardInvoker->getProcess(), SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||
this, SLOT(wizardFinished(int,QProcess::ExitStatus)));
|
||||
|
||||
iconWidget->setViewMode(QListView::IconMode);
|
||||
iconWidget->setWrapping(false);
|
||||
@ -83,13 +80,13 @@ Launcher::MainDialog::MainDialog(QWidget *parent)
|
||||
if (!revision.isEmpty() && !tag.isEmpty())
|
||||
{
|
||||
if (revision == tag) {
|
||||
versionLabel->setText(tr("OpenMW %0 release").arg(OPENMW_VERSION));
|
||||
versionLabel->setText(tr("OpenMW %1 release").arg(OPENMW_VERSION));
|
||||
} else {
|
||||
versionLabel->setText(tr("OpenMW development (%0)").arg(revision.left(10)));
|
||||
versionLabel->setText(tr("OpenMW development (%1)").arg(revision.left(10)));
|
||||
}
|
||||
|
||||
// Add the compile date and time
|
||||
versionLabel->setToolTip(tr("Compiled on %0 %1").arg(QLocale(QLocale::C).toDate(QString(__DATE__).simplified(),
|
||||
versionLabel->setToolTip(tr("Compiled on %1 %2").arg(QLocale(QLocale::C).toDate(QString(__DATE__).simplified(),
|
||||
QLatin1String("MMM d yyyy")).toString(Qt::SystemLocaleLongDate),
|
||||
QLocale(QLocale::C).toTime(QString(__TIME__).simplified(),
|
||||
QLatin1String("hh:mm:ss")).toString(Qt::SystemLocaleShortDate)));
|
||||
@ -101,6 +98,7 @@ Launcher::MainDialog::MainDialog(QWidget *parent)
|
||||
Launcher::MainDialog::~MainDialog()
|
||||
{
|
||||
delete mGameInvoker;
|
||||
delete mWizardInvoker;
|
||||
}
|
||||
|
||||
void Launcher::MainDialog::createIcons()
|
||||
@ -167,102 +165,32 @@ void Launcher::MainDialog::createPages()
|
||||
|
||||
bool Launcher::MainDialog::showFirstRunDialog()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle(tr("First run"));
|
||||
msgBox.setIcon(QMessageBox::Question);
|
||||
msgBox.setStandardButtons(QMessageBox::NoButton);
|
||||
msgBox.setText(tr("<html><head/><body><p><b>Welcome to OpenMW!</b></p> \
|
||||
<p>It is recommended to run the Installation Wizard.</p> \
|
||||
<p>The Wizard will let you select an existing Morrowind installation, \
|
||||
or install Morrowind for OpenMW to use.</p></body></html>"));
|
||||
QAbstractButton *wizardButton =
|
||||
msgBox.addButton(tr("Run &Installation Wizard"), QMessageBox::AcceptRole); // ActionRole doesn't work?!
|
||||
QAbstractButton *skipButton =
|
||||
msgBox.addButton(tr("Skip"), QMessageBox::RejectRole);
|
||||
Q_UNUSED(skipButton); // Surpress compiler unused warning
|
||||
|
||||
// CheckableMessageBox msgBox(this);
|
||||
// msgBox.setWindowTitle(tr("Morrowind installation detected"));
|
||||
msgBox.exec();
|
||||
|
||||
// QIcon icon = QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion);
|
||||
// int size = QApplication::style()->pixelMetric(QStyle::PM_MessageBoxIconSize);
|
||||
// msgBox.setIconPixmap(icon.pixmap(size, size));
|
||||
|
||||
// QAbstractButton *importerButton =
|
||||
// msgBox.addButton(tr("Import"), QDialogButtonBox::AcceptRole); // ActionRole doesn't work?!
|
||||
// QAbstractButton *skipButton =
|
||||
// msgBox.addButton(tr("Skip"), QDialogButtonBox::RejectRole);
|
||||
|
||||
// Q_UNUSED(skipButton); // Surpress compiler unused warning
|
||||
|
||||
// msgBox.setStandardButtons(QDialogButtonBox::NoButton);
|
||||
// msgBox.setText(tr("<br><b>An existing Morrowind configuration was detected</b><br> \
|
||||
// <br>Would you like to import settings from Morrowind.ini?<br> \
|
||||
// <br><b>Warning: In most cases OpenMW needs these settings to run properly</b><br>"));
|
||||
// msgBox.setCheckBoxText(tr("Include selected masters and plugins (creates a new profile)"));
|
||||
// msgBox.exec();
|
||||
|
||||
|
||||
// if (msgBox.clickedButton() == importerButton) {
|
||||
|
||||
// if (iniPaths.count() > 1) {
|
||||
// // Multiple Morrowind.ini files found
|
||||
// bool ok;
|
||||
// QString path = QInputDialog::getItem(this, tr("Multiple configurations found"),
|
||||
// tr("<br><b>There are multiple Morrowind.ini files found.</b><br><br> \
|
||||
// Please select the one you wish to import from:"), iniPaths, 0, false, &ok);
|
||||
// if (ok && !path.isEmpty()) {
|
||||
// iniPaths.clear();
|
||||
// iniPaths.append(path);
|
||||
// } else {
|
||||
// // Cancel was clicked
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Create the file if it doesn't already exist, else the importer will fail
|
||||
// QString path = QString::fromStdString(mCfgMgr.getUserConfigPath().string()) + QString("openmw.cfg");
|
||||
// QFile file(path);
|
||||
|
||||
// if (!file.exists()) {
|
||||
// if (!file.open(QIODevice::ReadWrite)) {
|
||||
// // File cannot be created
|
||||
// QMessageBox msgBox;
|
||||
// msgBox.setWindowTitle(tr("Error writing OpenMW configuration file"));
|
||||
// msgBox.setIcon(QMessageBox::Critical);
|
||||
// msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
// msgBox.setText(tr("<br><b>Could not open or create %0 for writing</b><br><br> \
|
||||
// Please make sure you have the right permissions \
|
||||
// and try again.<br>").arg(file.fileName()));
|
||||
// msgBox.exec();
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// file.close();
|
||||
// }
|
||||
|
||||
// // Construct the arguments to run the importer
|
||||
// QStringList arguments;
|
||||
|
||||
// if (msgBox.isChecked())
|
||||
// arguments.append(QString("--game-files"));
|
||||
|
||||
// arguments.append(QString("--encoding"));
|
||||
// arguments.append(mGameSettings.value(QString("encoding"), QString("win1252")));
|
||||
// arguments.append(QString("--ini"));
|
||||
// arguments.append(iniPaths.first());
|
||||
// arguments.append(QString("--cfg"));
|
||||
// arguments.append(path);
|
||||
|
||||
// ProcessInvoker invoker(this);
|
||||
|
||||
// if (!invoker.startProcess(QLatin1String("mwiniimport"), arguments, false))
|
||||
// return false;
|
||||
|
||||
// // Re-read the game settings
|
||||
// if (!setupGameSettings())
|
||||
// return false;
|
||||
|
||||
// // Add a new profile
|
||||
// if (msgBox.isChecked()) {
|
||||
// mLauncherSettings.setValue(QString("Profiles/currentprofile"), QString("Imported"));
|
||||
// mLauncherSettings.remove(QString("Profiles/Imported/content"));
|
||||
|
||||
// QStringList contents = mGameSettings.values(QString("content"));
|
||||
// foreach (const QString &content, contents) {
|
||||
// mLauncherSettings.setMultiValue(QString("Profiles/Imported/content"), content);
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
if (msgBox.clickedButton() == wizardButton)
|
||||
{
|
||||
if (!mWizardInvoker->startProcess(QLatin1String("openmw-wizard"), false)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
show();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -277,13 +205,6 @@ bool Launcher::MainDialog::setup()
|
||||
if (!setupGraphicsSettings())
|
||||
return false;
|
||||
|
||||
// Check if we need to show the importer
|
||||
if (mLauncherSettings.value(QString("General/firstrun"), QString("true")) == QLatin1String("true"))
|
||||
{
|
||||
if (!showFirstRunDialog())
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now create the pages as they need the settings
|
||||
createPages();
|
||||
|
||||
@ -292,6 +213,18 @@ bool Launcher::MainDialog::setup()
|
||||
return false;
|
||||
|
||||
loadSettings();
|
||||
|
||||
// Check if we need to run the wizard
|
||||
if (mLauncherSettings.value(QString("General/firstrun"), QString("true")) == QLatin1String("true"))
|
||||
{
|
||||
if (!showFirstRunDialog()) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
show(); // Show ourselves if the wizard is not being run
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -328,20 +261,20 @@ void Launcher::MainDialog::changePage(QListWidgetItem *current, QListWidgetItem
|
||||
|
||||
pagesWidget->setCurrentIndex(currentIndex);
|
||||
|
||||
DataFilesPage *previousPage = dynamic_cast<DataFilesPage *>(pagesWidget->widget(previousIndex));
|
||||
DataFilesPage *currentPage = dynamic_cast<DataFilesPage *>(pagesWidget->widget(currentIndex));
|
||||
// DataFilesPage *previousPage = dynamic_cast<DataFilesPage *>(pagesWidget->widget(previousIndex));
|
||||
// DataFilesPage *currentPage = dynamic_cast<DataFilesPage *>(pagesWidget->widget(currentIndex));
|
||||
|
||||
// //special call to update/save data files page list view when it's displayed/hidden.
|
||||
// if (previousPage)
|
||||
// {
|
||||
// if (previousPage->objectName() == "DataFilesPage")
|
||||
// previousPage->saveSettings();
|
||||
// }
|
||||
// else if (currentPage)
|
||||
// {
|
||||
// if (currentPage->objectName() == "DataFilesPage")
|
||||
// currentPage->loadSettings();
|
||||
// }
|
||||
// //special call to update/save data files page list view when it's displayed/hidden.
|
||||
// if (previousPage)
|
||||
// {
|
||||
// if (previousPage->objectName() == "DataFilesPage")
|
||||
// previousPage->saveSettings();
|
||||
// }
|
||||
// else if (currentPage)
|
||||
// {
|
||||
// if (currentPage->objectName() == "DataFilesPage")
|
||||
// currentPage->loadSettings();
|
||||
// }
|
||||
}
|
||||
|
||||
bool Launcher::MainDialog::setupLauncherSettings()
|
||||
@ -363,10 +296,10 @@ bool Launcher::MainDialog::setupLauncherSettings()
|
||||
msgBox.setWindowTitle(tr("Error opening OpenMW configuration file"));
|
||||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setText(QObject::tr("<br><b>Could not open %0 for reading</b><br><br> \
|
||||
Please make sure you have the right permissions \
|
||||
and try again.<br>").arg(file.fileName()));
|
||||
msgBox.exec();
|
||||
msgBox.setText(tr("<br><b>Could not open %0 for reading</b><br><br> \
|
||||
Please make sure you have the right permissions \
|
||||
and try again.<br>").arg(file.fileName()));
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
QTextStream stream(&file);
|
||||
@ -380,78 +313,6 @@ bool Launcher::MainDialog::setupLauncherSettings()
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
bool Launcher::expansions(Launcher::UnshieldThread& cd)
|
||||
{
|
||||
if(cd.BloodmoonDone())
|
||||
{
|
||||
cd.Done();
|
||||
return false;
|
||||
}
|
||||
|
||||
QMessageBox expansionsBox;
|
||||
expansionsBox.setText(QObject::tr("<br>Would you like to install expansions now ? (make sure you have the disc)<br> \
|
||||
If you want to install both Bloodmoon and Tribunal, you have to install Tribunal first.<br>"));
|
||||
|
||||
QAbstractButton* tribunalButton = NULL;
|
||||
if(!cd.TribunalDone())
|
||||
tribunalButton = expansionsBox.addButton(QObject::tr("&Tribunal"), QMessageBox::ActionRole);
|
||||
|
||||
QAbstractButton* bloodmoonButton = expansionsBox.addButton(QObject::tr("&Bloodmoon"), QMessageBox::ActionRole);
|
||||
QAbstractButton* noneButton = expansionsBox.addButton(QObject::tr("&None"), QMessageBox::ActionRole);
|
||||
|
||||
expansionsBox.exec();
|
||||
|
||||
if(expansionsBox.clickedButton() == noneButton)
|
||||
{
|
||||
cd.Done();
|
||||
return false;
|
||||
}
|
||||
else if(expansionsBox.clickedButton() == tribunalButton)
|
||||
{
|
||||
|
||||
TextSlotMsgBox cdbox;
|
||||
cdbox.setStandardButtons(QMessageBox::Cancel);
|
||||
|
||||
QObject::connect(&cd,SIGNAL(signalGUI(const QString&)), &cdbox, SLOT(setTextSlot(const QString&)));
|
||||
QObject::connect(&cd,SIGNAL(close()), &cdbox, SLOT(reject()));
|
||||
|
||||
cd.SetTribunalPath(
|
||||
QFileDialog::getOpenFileName(
|
||||
NULL,
|
||||
QObject::tr("Select data1.hdr from Tribunal Installation CD (Tribunal/data1.hdr on GOTY CDs)"),
|
||||
QDir::currentPath(),
|
||||
QString(QObject::tr("Installshield hdr file (*.hdr)"))).toUtf8().constData());
|
||||
|
||||
cd.start();
|
||||
cdbox.exec();
|
||||
}
|
||||
else if(expansionsBox.clickedButton() == bloodmoonButton)
|
||||
{
|
||||
|
||||
TextSlotMsgBox cdbox;
|
||||
cdbox.setStandardButtons(QMessageBox::Cancel);
|
||||
|
||||
QObject::connect(&cd,SIGNAL(signalGUI(const QString&)), &cdbox, SLOT(setTextSlot(const QString&)));
|
||||
QObject::connect(&cd,SIGNAL(close()), &cdbox, SLOT(reject()));
|
||||
|
||||
cd.SetBloodmoonPath(
|
||||
QFileDialog::getOpenFileName(
|
||||
NULL,
|
||||
QObject::tr("Select data1.hdr from Bloodmoon Installation CD (Bloodmoon/data1.hdr on GOTY CDs)"),
|
||||
QDir::currentPath(),
|
||||
QString(QObject::tr("Installshield hdr file (*.hdr)"))).toUtf8().constData());
|
||||
|
||||
cd.start();
|
||||
cdbox.exec();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
bool Launcher::MainDialog::setupGameSettings()
|
||||
{
|
||||
QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str());
|
||||
@ -470,7 +331,7 @@ bool Launcher::MainDialog::setupGameSettings()
|
||||
msgBox.setWindowTitle(tr("Error opening OpenMW configuration file"));
|
||||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setText(QObject::tr("<br><b>Could not open %0 for reading</b><br><br> \
|
||||
msgBox.setText(tr("<br><b>Could not open %0 for reading</b><br><br> \
|
||||
Please make sure you have the right permissions \
|
||||
and try again.<br>").arg(file.fileName()));
|
||||
msgBox.exec();
|
||||
@ -498,7 +359,7 @@ bool Launcher::MainDialog::setupGameSettings()
|
||||
msgBox.setWindowTitle(tr("Error opening OpenMW configuration file"));
|
||||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setText(QObject::tr("<br><b>Could not open %0 for reading</b><br><br> \
|
||||
msgBox.setText(tr("<br><b>Could not open %0 for reading</b><br><br> \
|
||||
Please make sure you have the right permissions \
|
||||
and try again.<br>").arg(file.fileName()));
|
||||
msgBox.exec();
|
||||
@ -530,63 +391,35 @@ bool Launcher::MainDialog::setupGameSettings()
|
||||
msgBox.setWindowTitle(tr("Error detecting Morrowind installation"));
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
msgBox.setStandardButtons(QMessageBox::Cancel);
|
||||
msgBox.setText(QObject::tr("<br><b>Could not find the Data Files location</b><br><br> \
|
||||
msgBox.setText(tr("<br><b>Could not find the Data Files location</b><br><br> \
|
||||
The directory containing the data files was not found.<br><br> \
|
||||
Press \"Browse...\" to specify the location manually.<br>"));
|
||||
|
||||
QAbstractButton *dirSelectButton =
|
||||
msgBox.addButton(QObject::tr("Browse to &Install..."), QMessageBox::ActionRole);
|
||||
QAbstractButton *browseButton =
|
||||
msgBox.addButton(tr("Browse..."), QMessageBox::ActionRole);
|
||||
|
||||
#ifndef WIN32
|
||||
QAbstractButton *cdSelectButton =
|
||||
msgBox.addButton(QObject::tr("Browse to &CD..."), QMessageBox::ActionRole);
|
||||
#endif
|
||||
QAbstractButton *wizardButton =
|
||||
msgBox.addButton(tr("Run &Installation Wizard..."), QMessageBox::ActionRole);
|
||||
|
||||
|
||||
msgBox.exec();
|
||||
msgBox.exec();
|
||||
|
||||
QString selectedFile;
|
||||
if (msgBox.clickedButton() == dirSelectButton) {
|
||||
if (msgBox.clickedButton() == browseButton)
|
||||
{
|
||||
selectedFile = QFileDialog::getOpenFileName(
|
||||
NULL,
|
||||
QObject::tr("Select master file"),
|
||||
this,
|
||||
tr("Select master file"),
|
||||
QDir::currentPath(),
|
||||
QString(tr("Morrowind master file (*.esm)")));
|
||||
tr("Morrowind master file (*.esm)"));
|
||||
}
|
||||
#ifndef WIN32
|
||||
else if(msgBox.clickedButton() == cdSelectButton) {
|
||||
UnshieldThread cd;
|
||||
|
||||
{
|
||||
TextSlotMsgBox cdbox;
|
||||
cdbox.setStandardButtons(QMessageBox::Cancel);
|
||||
|
||||
QObject::connect(&cd,SIGNAL(signalGUI(const QString&)), &cdbox, SLOT(setTextSlot(const QString&)));
|
||||
QObject::connect(&cd,SIGNAL(close()), &cdbox, SLOT(reject()));
|
||||
|
||||
cd.SetMorrowindPath(
|
||||
QFileDialog::getOpenFileName(
|
||||
NULL,
|
||||
QObject::tr("Select data1.hdr from Morrowind Installation CD"),
|
||||
QDir::currentPath(),
|
||||
QString(tr("Installshield hdr file (*.hdr)"))).toUtf8().constData());
|
||||
|
||||
cd.SetOutputPath(
|
||||
QFileDialog::getExistingDirectory(
|
||||
NULL,
|
||||
QObject::tr("Select where to extract files to"),
|
||||
QDir::currentPath(),
|
||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks).toUtf8().constData());
|
||||
|
||||
cd.start();
|
||||
cdbox.exec();
|
||||
else if (msgBox.clickedButton() == wizardButton)
|
||||
{
|
||||
if (!mWizardInvoker->startProcess(QLatin1String("openmw-wizard"), false)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
while(expansions(cd));
|
||||
|
||||
selectedFile = QString::fromUtf8(cd.GetMWEsmPath().c_str());
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
if (selectedFile.isEmpty())
|
||||
return false; // Cancel was clicked;
|
||||
@ -616,7 +449,7 @@ bool Launcher::MainDialog::setupGraphicsSettings()
|
||||
msgBox.setWindowTitle(tr("Error reading OpenMW configuration file"));
|
||||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setText(QObject::tr("<br><b>Could not find settings-default.cfg</b><br><br> \
|
||||
msgBox.setText(tr("<br><b>Could not find settings-default.cfg</b><br><br> \
|
||||
The problem may be due to an incomplete installation of OpenMW.<br> \
|
||||
Reinstalling OpenMW may resolve the problem."));
|
||||
msgBox.exec();
|
||||
@ -638,7 +471,7 @@ bool Launcher::MainDialog::setupGraphicsSettings()
|
||||
msgBox.setWindowTitle(tr("Error opening OpenMW configuration file"));
|
||||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setText(QObject::tr("<br><b>Could not open %0 for reading</b><br><br> \
|
||||
msgBox.setText(tr("<br><b>Could not open %0 for reading</b><br><br> \
|
||||
Please make sure you have the right permissions \
|
||||
and try again.<br>").arg(file.fileName()));
|
||||
msgBox.exec();
|
||||
@ -705,8 +538,8 @@ bool Launcher::MainDialog::writeSettings()
|
||||
msgBox.setText(tr("<br><b>Could not create %0</b><br><br> \
|
||||
Please make sure you have the right permissions \
|
||||
and try again.<br>").arg(userPath));
|
||||
msgBox.exec();
|
||||
return false;
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -722,8 +555,8 @@ bool Launcher::MainDialog::writeSettings()
|
||||
msgBox.setText(tr("<br><b>Could not open or create %0 for writing</b><br><br> \
|
||||
Please make sure you have the right permissions \
|
||||
and try again.<br>").arg(file.fileName()));
|
||||
msgBox.exec();
|
||||
return false;
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
QTextStream stream(&file);
|
||||
@ -744,8 +577,8 @@ bool Launcher::MainDialog::writeSettings()
|
||||
msgBox.setText(tr("<br><b>Could not open or create %0 for writing</b><br><br> \
|
||||
Please make sure you have the right permissions \
|
||||
and try again.<br>").arg(file.fileName()));
|
||||
msgBox.exec();
|
||||
return false;
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
stream.setDevice(&file);
|
||||
@ -766,8 +599,8 @@ bool Launcher::MainDialog::writeSettings()
|
||||
msgBox.setText(tr("<br><b>Could not open or create %0 for writing</b><br><br> \
|
||||
Please make sure you have the right permissions \
|
||||
and try again.<br>").arg(file.fileName()));
|
||||
msgBox.exec();
|
||||
return false;
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
stream.setDevice(&file);
|
||||
@ -786,26 +619,38 @@ void Launcher::MainDialog::closeEvent(QCloseEvent *event)
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void Launcher::MainDialog::wizardStarted()
|
||||
{
|
||||
qDebug() << "wizard started!";
|
||||
}
|
||||
|
||||
void Launcher::MainDialog::wizardFinished(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
if (exitCode != 0 || exitStatus == QProcess::CrashExit)
|
||||
return qApp->quit();
|
||||
|
||||
reloadSettings();
|
||||
show();
|
||||
}
|
||||
|
||||
void Launcher::MainDialog::play()
|
||||
{
|
||||
if (!writeSettings()) {
|
||||
qApp->quit();
|
||||
return;
|
||||
}
|
||||
if (!writeSettings())
|
||||
return qApp->quit();
|
||||
|
||||
if(!mGameSettings.hasMaster()) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle(tr("No game file selected"));
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setText(tr("<br><b>You do not have a game file selected.</b><br><br> \
|
||||
OpenMW will not start without a game file selected.<br>"));
|
||||
msgBox.exec();
|
||||
return;
|
||||
if (!mGameSettings.hasMaster()) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle(tr("No game file selected"));
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setText(tr("<br><b>You do not have a game file selected.</b><br><br> \
|
||||
OpenMW will not start without a game file selected.<br>"));
|
||||
msgBox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
// Launch the game detached
|
||||
|
||||
if (mGameInvoker->startProcess(QLatin1String("openmw"), true))
|
||||
qApp->quit();
|
||||
return qApp->quit();
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
#define MAINDIALOG_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QProcess>
|
||||
|
||||
#ifndef Q_MOC_RUN
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
#endif
|
||||
@ -51,6 +53,10 @@ namespace Launcher
|
||||
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
|
||||
void play();
|
||||
|
||||
private slots:
|
||||
void wizardStarted();
|
||||
void wizardFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
||||
private:
|
||||
void createIcons();
|
||||
void createPages();
|
||||
@ -73,6 +79,7 @@ namespace Launcher
|
||||
SettingsPage *mSettingsPage;
|
||||
|
||||
Process::ProcessInvoker *mGameInvoker;
|
||||
Process::ProcessInvoker *mWizardInvoker;
|
||||
|
||||
Files::ConfigurationManager mCfgMgr;
|
||||
|
||||
|
@ -172,6 +172,8 @@ void Launcher::SettingsPage::on_browseButton_clicked()
|
||||
|
||||
void Launcher::SettingsPage::wizardStarted()
|
||||
{
|
||||
mMain->hide(); // Hide the launcher
|
||||
|
||||
qDebug() << "wizard started!";
|
||||
wizardButton->setEnabled(false);
|
||||
}
|
||||
@ -180,10 +182,12 @@ void Launcher::SettingsPage::wizardFinished(int exitCode, QProcess::ExitStatus e
|
||||
{
|
||||
qDebug() << "wizard finished!";
|
||||
if (exitCode != 0 || exitStatus == QProcess::CrashExit)
|
||||
return;
|
||||
return qApp->quit();
|
||||
|
||||
mMain->reloadSettings();
|
||||
wizardButton->setEnabled(true);
|
||||
|
||||
mMain->show(); // Show the launcher again
|
||||
}
|
||||
|
||||
void Launcher::SettingsPage::importerStarted()
|
||||
|
@ -1,521 +0,0 @@
|
||||
#include "unshieldthread.hpp"
|
||||
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
namespace bfs = boost::filesystem;
|
||||
|
||||
namespace
|
||||
{
|
||||
static bool make_sure_directory_exists(bfs::path directory)
|
||||
{
|
||||
|
||||
if(!bfs::exists(directory))
|
||||
{
|
||||
bfs::create_directories(directory);
|
||||
}
|
||||
|
||||
return bfs::exists(directory);
|
||||
}
|
||||
|
||||
void fill_path(bfs::path& path, const std::string& name)
|
||||
{
|
||||
size_t start = 0;
|
||||
|
||||
size_t i;
|
||||
for(i = 0; i < name.length(); i++)
|
||||
{
|
||||
switch(name[i])
|
||||
{
|
||||
case '\\':
|
||||
path /= name.substr(start, i-start);
|
||||
start = i+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
path /= name.substr(start, i-start);
|
||||
}
|
||||
|
||||
std::string get_setting(const std::string& category, const std::string& setting, const std::string& inx)
|
||||
{
|
||||
size_t start = inx.find(category);
|
||||
start = inx.find(setting, start) + setting.length() + 3;
|
||||
|
||||
size_t end = inx.find("!", start);
|
||||
|
||||
return inx.substr(start, end-start);
|
||||
}
|
||||
|
||||
std::string read_to_string(const bfs::path& path)
|
||||
{
|
||||
bfs::ifstream strstream(path, std::ios::in | std::ios::binary);
|
||||
std::string str;
|
||||
|
||||
strstream.seekg(0, std::ios::end);
|
||||
str.resize(strstream.tellg());
|
||||
strstream.seekg(0, std::ios::beg);
|
||||
strstream.read(&str[0], str.size());
|
||||
strstream.close();
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
void add_setting(const std::string& category, const std::string& setting, const std::string& val, std::string& ini)
|
||||
{
|
||||
size_t loc;
|
||||
loc = ini.find("[" + category + "]");
|
||||
|
||||
// If category is not found, create it
|
||||
if(loc == std::string::npos)
|
||||
{
|
||||
loc = ini.size() + 2;
|
||||
ini += ("\r\n[" + category + "]\r\n");
|
||||
}
|
||||
|
||||
loc += category.length() +2 +2;
|
||||
ini.insert(loc, setting + "=" + val + "\r\n");
|
||||
}
|
||||
|
||||
#define FIX(setting) add_setting(category, setting, get_setting(category, setting, inx), ini)
|
||||
|
||||
void bloodmoon_fix_ini(std::string& ini, const bfs::path inxPath)
|
||||
{
|
||||
std::string inx = read_to_string(inxPath);
|
||||
|
||||
// Remove this one setting (the only one actually changed by bloodmoon, as opposed to just adding new ones)
|
||||
size_t start = ini.find("[Weather Blight]");
|
||||
start = ini.find("Ambient Loop Sound ID", start);
|
||||
size_t end = ini.find("\r\n", start) +2;
|
||||
ini.erase(start, end-start);
|
||||
|
||||
std::string category;
|
||||
|
||||
category = "General";
|
||||
{
|
||||
FIX("Werewolf FOV");
|
||||
}
|
||||
category = "Moons";
|
||||
{
|
||||
FIX("Script Color");
|
||||
}
|
||||
category = "Weather";
|
||||
{
|
||||
FIX("Snow Ripples");
|
||||
FIX("Snow Ripple Radius");
|
||||
FIX("Snow Ripples Per Flake");
|
||||
FIX("Snow Ripple Scale");
|
||||
FIX("Snow Ripple Speed");
|
||||
FIX("Snow Gravity Scale");
|
||||
FIX("Snow High Kill");
|
||||
FIX("Snow Low Kill");
|
||||
}
|
||||
category = "Weather Blight";
|
||||
{
|
||||
FIX("Ambient Loop Sound ID");
|
||||
}
|
||||
category = "Weather Snow";
|
||||
{
|
||||
FIX("Sky Sunrise Color");
|
||||
FIX("Sky Day Color");
|
||||
FIX("Sky Sunset Color");
|
||||
FIX("Sky Night Color");
|
||||
FIX("Fog Sunrise Color");
|
||||
FIX("Fog Day Color");
|
||||
FIX("Fog Sunset Color");
|
||||
FIX("Fog Night Color");
|
||||
FIX("Ambient Sunrise Color");
|
||||
FIX("Ambient Day Color");
|
||||
FIX("Ambient Sunset Color");
|
||||
FIX("Ambient Night Color");
|
||||
FIX("Sun Sunrise Color");
|
||||
FIX("Sun Day Color");
|
||||
FIX("Sun Sunset Color");
|
||||
FIX("Sun Night Color");
|
||||
FIX("Sun Disc Sunset Color");
|
||||
FIX("Transition Delta");
|
||||
FIX("Land Fog Day Depth");
|
||||
FIX("Land Fog Night Depth");
|
||||
FIX("Clouds Maximum Percent");
|
||||
FIX("Wind Speed");
|
||||
FIX("Cloud Speed");
|
||||
FIX("Glare View");
|
||||
FIX("Cloud Texture");
|
||||
FIX("Ambient Loop Sound ID");
|
||||
FIX("Snow Threshold");
|
||||
FIX("Snow Diameter");
|
||||
FIX("Snow Height Min");
|
||||
FIX("Snow Height Max");
|
||||
FIX("Snow Entrance Speed");
|
||||
FIX("Max Snowflakes");
|
||||
}
|
||||
category = "Weather Blizzard";
|
||||
{
|
||||
FIX("Sky Sunrise Color");
|
||||
FIX("Sky Day Color");
|
||||
FIX("Sky Sunset Color");
|
||||
FIX("Sky Night Color");
|
||||
FIX("Fog Sunrise Color");
|
||||
FIX("Fog Day Color");
|
||||
FIX("Fog Sunset Color");
|
||||
FIX("Fog Night Color");
|
||||
FIX("Ambient Sunrise Color");
|
||||
FIX("Ambient Day Color");
|
||||
FIX("Ambient Sunset Color");
|
||||
FIX("Ambient Night Color");
|
||||
FIX("Sun Sunrise Color");
|
||||
FIX("Sun Day Color");
|
||||
FIX("Sun Sunset Color");
|
||||
FIX("Sun Night Color");
|
||||
FIX("Sun Disc Sunset Color");
|
||||
FIX("Transition Delta");
|
||||
FIX("Land Fog Day Depth");
|
||||
FIX("Land Fog Night Depth");
|
||||
FIX("Clouds Maximum Percent");
|
||||
FIX("Wind Speed");
|
||||
FIX("Cloud Speed");
|
||||
FIX("Glare View");
|
||||
FIX("Cloud Texture");
|
||||
FIX("Ambient Loop Sound ID");
|
||||
FIX("Storm Threshold");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void fix_ini(const bfs::path& output_dir, bfs::path cdPath, bool tribunal, bool bloodmoon)
|
||||
{
|
||||
bfs::path ini_path = output_dir;
|
||||
ini_path /= "Morrowind.ini";
|
||||
|
||||
std::string ini = read_to_string(ini_path.string());
|
||||
|
||||
if(tribunal)
|
||||
{
|
||||
add_setting("Game Files", "GameFile1", "Tribunal.esm", ini);
|
||||
add_setting("Archives", "Archive 0", "Tribunal.bsa", ini);
|
||||
}
|
||||
if(bloodmoon)
|
||||
{
|
||||
bloodmoon_fix_ini(ini, cdPath / "setup.inx");
|
||||
add_setting("Game Files", "GameFile2", "Bloodmoon.esm", ini);
|
||||
add_setting("Archives", "Archive 1", "Bloodmoon.bsa", ini);
|
||||
}
|
||||
|
||||
bfs::ofstream inistream((ini_path));
|
||||
inistream << ini;
|
||||
inistream.close();
|
||||
}
|
||||
|
||||
void installToPath(const bfs::path& from, const bfs::path& to, bool copy = false)
|
||||
{
|
||||
make_sure_directory_exists(to);
|
||||
|
||||
for ( bfs::directory_iterator end, dir(from); dir != end; ++dir )
|
||||
{
|
||||
if(bfs::is_directory(dir->path()))
|
||||
installToPath(dir->path(), to / dir->path().filename(), copy);
|
||||
else
|
||||
{
|
||||
if(copy)
|
||||
{
|
||||
bfs::path dest = to / dir->path().filename();
|
||||
if(bfs::exists(dest))
|
||||
bfs::remove_all(dest);
|
||||
bfs::copy_file(dir->path(), dest);
|
||||
}
|
||||
else
|
||||
bfs::rename(dir->path(), to / dir->path().filename());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bfs::path findFile(const bfs::path& in, std::string filename, bool recursive = true)
|
||||
{
|
||||
if(recursive)
|
||||
{
|
||||
for ( bfs::recursive_directory_iterator end, dir(in); dir != end; ++dir )
|
||||
{
|
||||
if(Misc::StringUtils::ciEqual(dir->path().filename().string(), filename))
|
||||
return dir->path();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( bfs::directory_iterator end, dir(in); dir != end; ++dir )
|
||||
{
|
||||
if(Misc::StringUtils::ciEqual(dir->path().filename().string(), filename))
|
||||
return dir->path();
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
bool contains(const bfs::path& in, std::string filename)
|
||||
{
|
||||
for(bfs::directory_iterator end, dir(in); dir != end; ++dir)
|
||||
{
|
||||
if(Misc::StringUtils::ciEqual(dir->path().filename().string(), filename))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
time_t getTime(const char* time)
|
||||
{
|
||||
struct tm tms;
|
||||
memset(&tms, 0, sizeof(struct tm));
|
||||
strptime(time, "%d %B %Y", &tms);
|
||||
return mktime(&tms);
|
||||
}
|
||||
|
||||
// Some cds have cab files which have the Data Files subfolders outside the Data Files folder
|
||||
void install_dfiles_outside(const bfs::path& from, const bfs::path& dFiles)
|
||||
{
|
||||
bfs::path fonts = findFile(from, "fonts", false);
|
||||
if(fonts.string() != "")
|
||||
installToPath(fonts, dFiles / "Fonts");
|
||||
|
||||
bfs::path music = findFile(from, "music", false);
|
||||
if(music.string() != "")
|
||||
installToPath(music, dFiles / "Music");
|
||||
|
||||
bfs::path sound = findFile(from, "sound", false);
|
||||
if(sound.string() != "")
|
||||
installToPath(sound, dFiles / "Sound");
|
||||
|
||||
bfs::path splash = findFile(from, "splash", false);
|
||||
if(splash.string() != "")
|
||||
installToPath(splash, dFiles / "Splash");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool Launcher::UnshieldThread::SetMorrowindPath(const std::string& path)
|
||||
{
|
||||
mMorrowindPath = path;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Launcher::UnshieldThread::SetTribunalPath(const std::string& path)
|
||||
{
|
||||
mTribunalPath = path;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Launcher::UnshieldThread::SetBloodmoonPath(const std::string& path)
|
||||
{
|
||||
mBloodmoonPath = path;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Launcher::UnshieldThread::SetOutputPath(const std::string& path)
|
||||
{
|
||||
mOutputPath = path;
|
||||
}
|
||||
|
||||
bool Launcher::UnshieldThread::extract_file(Unshield* unshield, bfs::path output_dir, const char* prefix, int index)
|
||||
{
|
||||
bool success;
|
||||
bfs::path dirname;
|
||||
bfs::path filename;
|
||||
int directory = unshield_file_directory(unshield, index);
|
||||
|
||||
dirname = output_dir;
|
||||
|
||||
if (prefix && prefix[0])
|
||||
dirname /= prefix;
|
||||
|
||||
if (directory >= 0)
|
||||
{
|
||||
const char* tmp = unshield_directory_name(unshield, directory);
|
||||
if (tmp && tmp[0])
|
||||
fill_path(dirname, tmp);
|
||||
}
|
||||
|
||||
make_sure_directory_exists(dirname);
|
||||
|
||||
filename = dirname;
|
||||
filename /= unshield_file_name(unshield, index);
|
||||
|
||||
emit signalGUI(QString("Extracting: ") + QString(filename.c_str()));
|
||||
|
||||
success = unshield_file_save(unshield, index, filename.c_str());
|
||||
|
||||
if (!success)
|
||||
bfs::remove(filename);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void Launcher::UnshieldThread::extract_cab(const bfs::path& cab, const bfs::path& output_dir, bool extract_ini)
|
||||
{
|
||||
Unshield * unshield;
|
||||
unshield = unshield_open(cab.c_str());
|
||||
|
||||
int i;
|
||||
for (i = 0; i < unshield_file_group_count(unshield); i++)
|
||||
{
|
||||
UnshieldFileGroup* file_group = unshield_file_group_get(unshield, i);
|
||||
|
||||
for (size_t j = file_group->first_file; j <= file_group->last_file; j++)
|
||||
{
|
||||
if (unshield_file_is_valid(unshield, j))
|
||||
extract_file(unshield, output_dir, file_group->name, j);
|
||||
}
|
||||
}
|
||||
unshield_close(unshield);
|
||||
}
|
||||
|
||||
|
||||
bool Launcher::UnshieldThread::extract()
|
||||
{
|
||||
bfs::path outputDataFilesDir = mOutputPath;
|
||||
outputDataFilesDir /= "Data Files";
|
||||
bfs::path extractPath = mOutputPath;
|
||||
extractPath /= "extract-temp";
|
||||
|
||||
if(!mMorrowindDone && mMorrowindPath.string().length() > 0)
|
||||
{
|
||||
mMorrowindDone = true;
|
||||
|
||||
bfs::path mwExtractPath = extractPath / "morrowind";
|
||||
extract_cab(mMorrowindPath, mwExtractPath, true);
|
||||
|
||||
bfs::path dFilesDir = findFile(mwExtractPath, "morrowind.esm").parent_path();
|
||||
|
||||
installToPath(dFilesDir, outputDataFilesDir);
|
||||
|
||||
install_dfiles_outside(mwExtractPath, outputDataFilesDir);
|
||||
|
||||
// Videos are often kept uncompressed on the cd
|
||||
bfs::path videosPath = findFile(mMorrowindPath.parent_path(), "video", false);
|
||||
if(videosPath.string() != "")
|
||||
{
|
||||
emit signalGUI(QString("Installing Videos..."));
|
||||
installToPath(videosPath, outputDataFilesDir / "Video", true);
|
||||
}
|
||||
|
||||
bfs::path cdDFiles = findFile(mMorrowindPath.parent_path(), "data files", false);
|
||||
if(cdDFiles.string() != "")
|
||||
{
|
||||
emit signalGUI(QString("Installing Uncompressed Data files from CD..."));
|
||||
installToPath(cdDFiles, outputDataFilesDir, true);
|
||||
}
|
||||
|
||||
|
||||
bfs::rename(findFile(mwExtractPath, "morrowind.ini"), outputDataFilesDir / "Morrowind.ini");
|
||||
|
||||
mTribunalDone = contains(outputDataFilesDir, "tribunal.esm");
|
||||
mBloodmoonDone = contains(outputDataFilesDir, "bloodmoon.esm");
|
||||
|
||||
}
|
||||
|
||||
else if(!mTribunalDone && mTribunalPath.string().length() > 0)
|
||||
{
|
||||
mTribunalDone = true;
|
||||
|
||||
bfs::path tbExtractPath = extractPath / "tribunal";
|
||||
extract_cab(mTribunalPath, tbExtractPath, true);
|
||||
|
||||
bfs::path dFilesDir = findFile(tbExtractPath, "tribunal.esm").parent_path();
|
||||
|
||||
installToPath(dFilesDir, outputDataFilesDir);
|
||||
|
||||
install_dfiles_outside(tbExtractPath, outputDataFilesDir);
|
||||
|
||||
// Mt GOTY CD has Sounds in a seperate folder from the rest of the data files
|
||||
bfs::path soundsPath = findFile(tbExtractPath, "sounds", false);
|
||||
if(soundsPath.string() != "")
|
||||
installToPath(soundsPath, outputDataFilesDir / "Sounds");
|
||||
|
||||
bfs::path cdDFiles = findFile(mTribunalPath.parent_path(), "data files", false);
|
||||
if(cdDFiles.string() != "")
|
||||
{
|
||||
emit signalGUI(QString("Installing Uncompressed Data files from CD..."));
|
||||
installToPath(cdDFiles, outputDataFilesDir, true);
|
||||
}
|
||||
|
||||
mBloodmoonDone = contains(outputDataFilesDir, "bloodmoon.esm");
|
||||
|
||||
fix_ini(outputDataFilesDir, bfs::path(mTribunalPath).parent_path(), mTribunalDone, mBloodmoonDone);
|
||||
}
|
||||
|
||||
else if(!mBloodmoonDone && mBloodmoonPath.string().length() > 0)
|
||||
{
|
||||
mBloodmoonDone = true;
|
||||
|
||||
bfs::path bmExtractPath = extractPath / "bloodmoon";
|
||||
extract_cab(mBloodmoonPath, bmExtractPath, true);
|
||||
|
||||
bfs::path dFilesDir = findFile(bmExtractPath, "bloodmoon.esm").parent_path();
|
||||
|
||||
installToPath(dFilesDir, outputDataFilesDir);
|
||||
|
||||
install_dfiles_outside(bmExtractPath, outputDataFilesDir);
|
||||
|
||||
// My GOTY CD contains a folder within cab files called Tribunal patch,
|
||||
// which contains Tribunal.esm
|
||||
bfs::path tbPatchPath = findFile(bmExtractPath, "tribunal.esm");
|
||||
if(tbPatchPath.string() != "")
|
||||
bfs::rename(tbPatchPath, outputDataFilesDir / "Tribunal.esm");
|
||||
|
||||
bfs::path cdDFiles = findFile(mBloodmoonPath.parent_path(), "data files", false);
|
||||
if(cdDFiles.string() != "")
|
||||
{
|
||||
emit signalGUI(QString("Installing Uncompressed Data files from CD..."));
|
||||
installToPath(cdDFiles, outputDataFilesDir, true);
|
||||
}
|
||||
|
||||
fix_ini(outputDataFilesDir, bfs::path(mBloodmoonPath).parent_path(), false, mBloodmoonDone);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Launcher::UnshieldThread::Done()
|
||||
{
|
||||
// Get rid of unnecessary files
|
||||
bfs::remove_all(mOutputPath / "extract-temp");
|
||||
|
||||
// Set modified time to release dates, to preserve load order
|
||||
if(mMorrowindDone)
|
||||
bfs::last_write_time(findFile(mOutputPath, "morrowind.esm"), getTime("1 May 2002"));
|
||||
|
||||
if(mTribunalDone)
|
||||
bfs::last_write_time(findFile(mOutputPath, "tribunal.esm"), getTime("6 November 2002"));
|
||||
|
||||
if(mBloodmoonDone)
|
||||
bfs::last_write_time(findFile(mOutputPath, "bloodmoon.esm"), getTime("3 June 2003"));
|
||||
}
|
||||
|
||||
std::string Launcher::UnshieldThread::GetMWEsmPath()
|
||||
{
|
||||
return findFile(mOutputPath / "Data Files", "morrowind.esm").string();
|
||||
}
|
||||
|
||||
bool Launcher::UnshieldThread::TribunalDone()
|
||||
{
|
||||
return mTribunalDone;
|
||||
}
|
||||
|
||||
bool Launcher::UnshieldThread::BloodmoonDone()
|
||||
{
|
||||
return mBloodmoonDone;
|
||||
}
|
||||
|
||||
void Launcher::UnshieldThread::run()
|
||||
{
|
||||
extract();
|
||||
emit close();
|
||||
}
|
||||
|
||||
Launcher::UnshieldThread::UnshieldThread()
|
||||
{
|
||||
unshield_set_log_level(0);
|
||||
mMorrowindDone = false;
|
||||
mTribunalDone = false;
|
||||
mBloodmoonDone = false;
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
#ifndef UNSHIELD_THREAD_H
|
||||
#define UNSHIELD_THREAD_H
|
||||
|
||||
#include <QThread>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <libunshield.h>
|
||||
|
||||
namespace Launcher
|
||||
{
|
||||
class UnshieldThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
bool SetMorrowindPath(const std::string& path);
|
||||
bool SetTribunalPath(const std::string& path);
|
||||
bool SetBloodmoonPath(const std::string& path);
|
||||
|
||||
void SetOutputPath(const std::string& path);
|
||||
|
||||
bool extract();
|
||||
|
||||
bool TribunalDone();
|
||||
bool BloodmoonDone();
|
||||
|
||||
void Done();
|
||||
|
||||
std::string GetMWEsmPath();
|
||||
|
||||
UnshieldThread();
|
||||
|
||||
private:
|
||||
|
||||
void extract_cab(const boost::filesystem::path& cab, const boost::filesystem::path& output_dir, bool extract_ini = false);
|
||||
bool extract_file(Unshield* unshield, boost::filesystem::path output_dir, const char* prefix, int index);
|
||||
|
||||
boost::filesystem::path mMorrowindPath;
|
||||
boost::filesystem::path mTribunalPath;
|
||||
boost::filesystem::path mBloodmoonPath;
|
||||
|
||||
bool mMorrowindDone;
|
||||
bool mTribunalDone;
|
||||
bool mBloodmoonDone;
|
||||
|
||||
boost::filesystem::path mOutputPath;
|
||||
|
||||
|
||||
protected:
|
||||
virtual void run();
|
||||
|
||||
signals:
|
||||
void signalGUI(QString);
|
||||
void close();
|
||||
};
|
||||
}
|
||||
#endif
|
@ -1,258 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "checkablemessagebox.hpp"
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include <QButtonGroup>
|
||||
#include <QCheckBox>
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QHeaderView>
|
||||
#include <QLabel>
|
||||
#include <QSpacerItem>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
|
||||
/*!
|
||||
\class Utils::CheckableMessageBox
|
||||
|
||||
\brief A messagebox suitable for questions with a
|
||||
"Do not ask me again" checkbox.
|
||||
|
||||
Emulates the QMessageBox API with
|
||||
static conveniences. The message label can open external URLs.
|
||||
*/
|
||||
Launcher::CheckableMessageBoxPrivate::CheckableMessageBoxPrivate(QDialog *q)
|
||||
: clickedButton(0)
|
||||
{
|
||||
QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
|
||||
|
||||
pixmapLabel = new QLabel(q);
|
||||
sizePolicy.setHorizontalStretch(0);
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(pixmapLabel->sizePolicy().hasHeightForWidth());
|
||||
pixmapLabel->setSizePolicy(sizePolicy);
|
||||
pixmapLabel->setVisible(false);
|
||||
|
||||
QSpacerItem *pixmapSpacer =
|
||||
new QSpacerItem(0, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||
|
||||
messageLabel = new QLabel(q);
|
||||
messageLabel->setMinimumSize(QSize(300, 0));
|
||||
messageLabel->setWordWrap(true);
|
||||
messageLabel->setOpenExternalLinks(true);
|
||||
messageLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse);
|
||||
|
||||
QSpacerItem *checkBoxRightSpacer =
|
||||
new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||
QSpacerItem *buttonSpacer =
|
||||
new QSpacerItem(0, 1, QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
|
||||
checkBox = new QCheckBox(q);
|
||||
checkBox->setText(Launcher::CheckableMessageBox::tr("Do not ask again"));
|
||||
|
||||
buttonBox = new QDialogButtonBox(q);
|
||||
buttonBox->setOrientation(Qt::Horizontal);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||
|
||||
QVBoxLayout *verticalLayout = new QVBoxLayout();
|
||||
verticalLayout->addWidget(pixmapLabel);
|
||||
verticalLayout->addItem(pixmapSpacer);
|
||||
|
||||
QHBoxLayout *horizontalLayout_2 = new QHBoxLayout();
|
||||
horizontalLayout_2->addLayout(verticalLayout);
|
||||
horizontalLayout_2->addWidget(messageLabel);
|
||||
|
||||
QHBoxLayout *horizontalLayout = new QHBoxLayout();
|
||||
horizontalLayout->addWidget(checkBox);
|
||||
horizontalLayout->addItem(checkBoxRightSpacer);
|
||||
|
||||
QVBoxLayout *verticalLayout_2 = new QVBoxLayout(q);
|
||||
verticalLayout_2->addLayout(horizontalLayout_2);
|
||||
verticalLayout_2->addLayout(horizontalLayout);
|
||||
verticalLayout_2->addItem(buttonSpacer);
|
||||
verticalLayout_2->addWidget(buttonBox);
|
||||
}
|
||||
|
||||
Launcher::CheckableMessageBox::CheckableMessageBox(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
d(new Launcher::CheckableMessageBoxPrivate(this))
|
||||
{
|
||||
setModal(true);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
connect(d->buttonBox, SIGNAL(accepted()), SLOT(accept()));
|
||||
connect(d->buttonBox, SIGNAL(rejected()), SLOT(reject()));
|
||||
connect(d->buttonBox, SIGNAL(clicked(QAbstractButton*)),
|
||||
SLOT(slotClicked(QAbstractButton*)));
|
||||
}
|
||||
|
||||
Launcher::CheckableMessageBox::~CheckableMessageBox()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void Launcher::CheckableMessageBox::slotClicked(QAbstractButton *b)
|
||||
{
|
||||
d->clickedButton = b;
|
||||
}
|
||||
|
||||
QAbstractButton *Launcher::CheckableMessageBox::clickedButton() const
|
||||
{
|
||||
return d->clickedButton;
|
||||
}
|
||||
|
||||
QDialogButtonBox::StandardButton Launcher::CheckableMessageBox::clickedStandardButton() const
|
||||
{
|
||||
if (d->clickedButton)
|
||||
return d->buttonBox->standardButton(d->clickedButton);
|
||||
return QDialogButtonBox::NoButton;
|
||||
}
|
||||
|
||||
QString Launcher::CheckableMessageBox::text() const
|
||||
{
|
||||
return d->messageLabel->text();
|
||||
}
|
||||
|
||||
void Launcher::CheckableMessageBox::setText(const QString &t)
|
||||
{
|
||||
d->messageLabel->setText(t);
|
||||
}
|
||||
|
||||
QPixmap Launcher::CheckableMessageBox::iconPixmap() const
|
||||
{
|
||||
if (const QPixmap *p = d->pixmapLabel->pixmap())
|
||||
return QPixmap(*p);
|
||||
return QPixmap();
|
||||
}
|
||||
|
||||
void Launcher::CheckableMessageBox::setIconPixmap(const QPixmap &p)
|
||||
{
|
||||
d->pixmapLabel->setPixmap(p);
|
||||
d->pixmapLabel->setVisible(!p.isNull());
|
||||
}
|
||||
|
||||
bool Launcher::CheckableMessageBox::isChecked() const
|
||||
{
|
||||
return d->checkBox->isChecked();
|
||||
}
|
||||
|
||||
void Launcher::CheckableMessageBox::setChecked(bool s)
|
||||
{
|
||||
d->checkBox->setChecked(s);
|
||||
}
|
||||
|
||||
QString Launcher::CheckableMessageBox::checkBoxText() const
|
||||
{
|
||||
return d->checkBox->text();
|
||||
}
|
||||
|
||||
void Launcher::CheckableMessageBox::setCheckBoxText(const QString &t)
|
||||
{
|
||||
d->checkBox->setText(t);
|
||||
}
|
||||
|
||||
bool Launcher::CheckableMessageBox::isCheckBoxVisible() const
|
||||
{
|
||||
return d->checkBox->isVisible();
|
||||
}
|
||||
|
||||
void Launcher::CheckableMessageBox::setCheckBoxVisible(bool v)
|
||||
{
|
||||
d->checkBox->setVisible(v);
|
||||
}
|
||||
|
||||
QDialogButtonBox::StandardButtons Launcher::CheckableMessageBox::standardButtons() const
|
||||
{
|
||||
return d->buttonBox->standardButtons();
|
||||
}
|
||||
|
||||
void Launcher::CheckableMessageBox::setStandardButtons(QDialogButtonBox::StandardButtons s)
|
||||
{
|
||||
d->buttonBox->setStandardButtons(s);
|
||||
}
|
||||
|
||||
QPushButton *Launcher::CheckableMessageBox::button(QDialogButtonBox::StandardButton b) const
|
||||
{
|
||||
return d->buttonBox->button(b);
|
||||
}
|
||||
|
||||
QPushButton *Launcher::CheckableMessageBox::addButton(const QString &text, QDialogButtonBox::ButtonRole role)
|
||||
{
|
||||
return d->buttonBox->addButton(text, role);
|
||||
}
|
||||
|
||||
QDialogButtonBox::StandardButton Launcher::CheckableMessageBox::defaultButton() const
|
||||
{
|
||||
foreach (QAbstractButton *b, d->buttonBox->buttons())
|
||||
if (QPushButton *pb = qobject_cast<QPushButton *>(b))
|
||||
if (pb->isDefault())
|
||||
return d->buttonBox->standardButton(pb);
|
||||
return QDialogButtonBox::NoButton;
|
||||
}
|
||||
|
||||
void Launcher::CheckableMessageBox::setDefaultButton(QDialogButtonBox::StandardButton s)
|
||||
{
|
||||
if (QPushButton *b = d->buttonBox->button(s)) {
|
||||
b->setDefault(true);
|
||||
b->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
QDialogButtonBox::StandardButton
|
||||
Launcher::CheckableMessageBox::question(QWidget *parent,
|
||||
const QString &title,
|
||||
const QString &question,
|
||||
const QString &checkBoxText,
|
||||
bool *checkBoxSetting,
|
||||
QDialogButtonBox::StandardButtons buttons,
|
||||
QDialogButtonBox::StandardButton defaultButton)
|
||||
{
|
||||
CheckableMessageBox mb(parent);
|
||||
mb.setWindowTitle(title);
|
||||
mb.setIconPixmap(QMessageBox::standardIcon(QMessageBox::Question));
|
||||
mb.setText(question);
|
||||
mb.setCheckBoxText(checkBoxText);
|
||||
mb.setChecked(*checkBoxSetting);
|
||||
mb.setStandardButtons(buttons);
|
||||
mb.setDefaultButton(defaultButton);
|
||||
mb.exec();
|
||||
*checkBoxSetting = mb.isChecked();
|
||||
return mb.clickedStandardButton();
|
||||
}
|
||||
|
||||
QMessageBox::StandardButton Launcher::CheckableMessageBox::dialogButtonBoxToMessageBoxButton(QDialogButtonBox::StandardButton db)
|
||||
{
|
||||
return static_cast<QMessageBox::StandardButton>(int(db));
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CHECKABLEMESSAGEBOX_HPP
|
||||
#define CHECKABLEMESSAGEBOX_HPP
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QMessageBox>
|
||||
#include <QDialog>
|
||||
|
||||
class QCheckBox;
|
||||
|
||||
namespace Launcher
|
||||
{
|
||||
class CheckableMessageBoxPrivate
|
||||
{
|
||||
public:
|
||||
|
||||
QLabel *pixmapLabel;
|
||||
QLabel *messageLabel;
|
||||
QCheckBox *checkBox;
|
||||
QDialogButtonBox *buttonBox;
|
||||
QAbstractButton *clickedButton;
|
||||
|
||||
public:
|
||||
CheckableMessageBoxPrivate(QDialog *q);
|
||||
};
|
||||
|
||||
class CheckableMessageBox : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString text READ text WRITE setText)
|
||||
Q_PROPERTY(QPixmap iconPixmap READ iconPixmap WRITE setIconPixmap)
|
||||
Q_PROPERTY(bool isChecked READ isChecked WRITE setChecked)
|
||||
Q_PROPERTY(QString checkBoxText READ checkBoxText WRITE setCheckBoxText)
|
||||
Q_PROPERTY(QDialogButtonBox::StandardButtons buttons READ standardButtons WRITE setStandardButtons)
|
||||
Q_PROPERTY(QDialogButtonBox::StandardButton defaultButton READ defaultButton WRITE setDefaultButton)
|
||||
|
||||
public:
|
||||
explicit CheckableMessageBox(QWidget *parent);
|
||||
virtual ~CheckableMessageBox();
|
||||
|
||||
static QDialogButtonBox::StandardButton
|
||||
question(QWidget *parent,
|
||||
const QString &title,
|
||||
const QString &question,
|
||||
const QString &checkBoxText,
|
||||
bool *checkBoxSetting,
|
||||
QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Yes|QDialogButtonBox::No,
|
||||
QDialogButtonBox::StandardButton defaultButton = QDialogButtonBox::No);
|
||||
|
||||
QString text() const;
|
||||
void setText(const QString &);
|
||||
|
||||
bool isChecked() const;
|
||||
void setChecked(bool s);
|
||||
|
||||
QString checkBoxText() const;
|
||||
void setCheckBoxText(const QString &);
|
||||
|
||||
bool isCheckBoxVisible() const;
|
||||
void setCheckBoxVisible(bool);
|
||||
|
||||
QDialogButtonBox::StandardButtons standardButtons() const;
|
||||
void setStandardButtons(QDialogButtonBox::StandardButtons s);
|
||||
QPushButton *button(QDialogButtonBox::StandardButton b) const;
|
||||
QPushButton *addButton(const QString &text, QDialogButtonBox::ButtonRole role);
|
||||
|
||||
QDialogButtonBox::StandardButton defaultButton() const;
|
||||
void setDefaultButton(QDialogButtonBox::StandardButton s);
|
||||
|
||||
// See static QMessageBox::standardPixmap()
|
||||
QPixmap iconPixmap() const;
|
||||
void setIconPixmap (const QPixmap &p);
|
||||
|
||||
// Query the result
|
||||
QAbstractButton *clickedButton() const;
|
||||
QDialogButtonBox::StandardButton clickedStandardButton() const;
|
||||
|
||||
// Conversion convenience
|
||||
static QMessageBox::StandardButton dialogButtonBoxToMessageBoxButton(QDialogButtonBox::StandardButton);
|
||||
|
||||
private slots:
|
||||
void slotClicked(QAbstractButton *b);
|
||||
|
||||
private:
|
||||
CheckableMessageBoxPrivate *d;
|
||||
};
|
||||
}
|
||||
#endif // CHECKABLEMESSAGEBOX_HPP
|
Loading…
x
Reference in New Issue
Block a user