mirror of https://github.com/vitalif/openscad
Fix MDI issues.
parent
1263042fc9
commit
8cf85e0987
|
@ -144,6 +144,7 @@ void Preferences::init() {
|
||||||
Preferences::~Preferences()
|
Preferences::~Preferences()
|
||||||
{
|
{
|
||||||
removeDefaultSettings();
|
removeDefaultSettings();
|
||||||
|
instance = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -501,15 +502,19 @@ void Preferences::apply() const
|
||||||
emit syntaxHighlightChanged(getValue("editor/syntaxhighlight").toString());
|
emit syntaxHighlightChanged(getValue("editor/syntaxhighlight").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::create(QWidget *parent, QStringList colorSchemes)
|
void Preferences::create(QStringList colorSchemes)
|
||||||
{
|
{
|
||||||
|
if (instance != NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::list<std::string> names = ColorMap::inst()->colorSchemeNames(true);
|
std::list<std::string> names = ColorMap::inst()->colorSchemeNames(true);
|
||||||
QStringList renderColorSchemes;
|
QStringList renderColorSchemes;
|
||||||
foreach (std::string name, names) {
|
foreach (std::string name, names) {
|
||||||
renderColorSchemes << name.c_str();
|
renderColorSchemes << name.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
instance = new Preferences(parent);
|
instance = new Preferences();
|
||||||
instance->syntaxHighlight->clear();
|
instance->syntaxHighlight->clear();
|
||||||
instance->syntaxHighlight->addItems(colorSchemes);
|
instance->syntaxHighlight->addItems(colorSchemes);
|
||||||
instance->colorSchemeChooser->clear();
|
instance->colorSchemeChooser->clear();
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Preferences : public QMainWindow, public Ui::Preferences
|
||||||
public:
|
public:
|
||||||
~Preferences();
|
~Preferences();
|
||||||
|
|
||||||
static void create(QWidget *parent, QStringList colorSchemes);
|
static void create(QStringList colorSchemes);
|
||||||
static Preferences *inst();
|
static Preferences *inst();
|
||||||
|
|
||||||
QVariant getValue(const QString &key) const;
|
QVariant getValue(const QString &key) const;
|
||||||
|
|
|
@ -201,7 +201,7 @@ MainWindow::MainWindow(const QString &filename)
|
||||||
#endif
|
#endif
|
||||||
editor = new LegacyEditor(editorDockContents);
|
editor = new LegacyEditor(editorDockContents);
|
||||||
|
|
||||||
Preferences::create(this, editor->colorSchemes());
|
Preferences::create(editor->colorSchemes());
|
||||||
|
|
||||||
editorDockContents->layout()->addWidget(editor);
|
editorDockContents->layout()->addWidget(editor);
|
||||||
|
|
||||||
|
|
|
@ -625,13 +625,14 @@ int gui(vector<string> &inputFiles, const fs::path &original_path, int argc, cha
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow *mainwin;
|
MainWindow *mainwin;
|
||||||
#ifdef ENABLE_MDI
|
bool isMdi = settings.value("advanced/mdi", true).toBool();
|
||||||
BOOST_FOREACH(const string &infile, inputFiles) {
|
if (isMdi) {
|
||||||
mainwin = new MainWindow(assemblePath(original_path, infile));
|
BOOST_FOREACH(const string &infile, inputFiles) {
|
||||||
|
mainwin = new MainWindow(assemblePath(original_path, infile));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mainwin = new MainWindow(assemblePath(original_path, inputFiles[0]));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
mainwin = new MainWindow(assemblePath(original_path, inputFiles[0]));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
|
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
|
||||||
int rc = app.exec();
|
int rc = app.exec();
|
||||||
|
@ -782,11 +783,6 @@ int main(int argc, char **argv)
|
||||||
if (vm.count("input-file")) {
|
if (vm.count("input-file")) {
|
||||||
inputFiles = vm["input-file"].as<vector<string> >();
|
inputFiles = vm["input-file"].as<vector<string> >();
|
||||||
}
|
}
|
||||||
#ifndef ENABLE_MDI
|
|
||||||
if (inputFiles.size() > 1) {
|
|
||||||
help(argv[0]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (vm.count("colorscheme")) {
|
if (vm.count("colorscheme")) {
|
||||||
arg_colorscheme = vm["colorscheme"].as<string>();
|
arg_colorscheme = vm["colorscheme"].as<string>();
|
||||||
|
@ -807,6 +803,9 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg_info || cmdlinemode) {
|
if (arg_info || cmdlinemode) {
|
||||||
|
if (inputFiles.size() > 1) {
|
||||||
|
help(argv[0]);
|
||||||
|
}
|
||||||
rc = cmdline(deps_output_file, inputFiles[0], camera, output_file, original_path, renderer, argc, argv);
|
rc = cmdline(deps_output_file, inputFiles[0], camera, output_file, original_path, renderer, argc, argv);
|
||||||
}
|
}
|
||||||
else if (QtUseGUI()) {
|
else if (QtUseGUI()) {
|
||||||
|
|
Loading…
Reference in New Issue