Fri, 21 Jun 2013 18:41:44 +0300
Added support for launching external programs with Wine
changelog.txt | file | annotate | diff | comparison | revisions | |
src/config.cpp | file | annotate | diff | comparison | revisions | |
src/configDialog.cpp | file | annotate | diff | comparison | revisions | |
src/extprogs.cpp | file | annotate | diff | comparison | revisions |
--- a/changelog.txt Fri Jun 21 17:52:44 2013 +0300 +++ b/changelog.txt Fri Jun 21 18:41:44 2013 +0300 @@ -13,6 +13,7 @@ - Replace coords: allow replacing all coords regardless of original value, plus relative moving (offset) - Objects can now be edited by double-clicking on them. - Changed default keys for Y-axis moving from PgUp/PgDown to Home and End ala MLCAD. +- [Linux] External programs can now be launched with Wine. - Added a progress box for file loading to respond to desktops while loading files. With large files the no-response policy could be a bad thing. - Fixed: Recent files should behave coherently now.
--- a/src/config.cpp Fri Jun 21 17:52:44 2013 +0300 +++ b/src/config.cpp Fri Jun 21 18:41:44 2013 +0300 @@ -121,6 +121,8 @@ return true; } +extern_cfg (str, io_ldpath); + // ============================================================================= // Save the configuration to disk bool config::save () { @@ -148,9 +150,12 @@ fprint (f, "# Configuration file for " APPNAME "\n"); for (config* cfg : g_configPointers) { - if (!cfg || cfg->isDefault ()) + if (!cfg) break; + if (cfg->isDefault ()) + continue; + str valstring; switch (cfg->getType ()) { case CONFIG_int:
--- a/src/configDialog.cpp Fri Jun 21 17:52:44 2013 +0300 +++ b/src/configDialog.cpp Fri Jun 21 18:41:44 2013 +0300 @@ -316,17 +316,32 @@ extern_cfg (str, prog_intersector); extern_cfg (str, prog_coverer); extern_cfg (str, prog_isecalc); +extern_cfg (bool, prog_ytruder_wine); +extern_cfg (bool, prog_rectifier_wine); +extern_cfg (bool, prog_intersector_wine); +extern_cfg (bool, prog_coverer_wine); +extern_cfg (bool, prog_isecalc_wine); static const struct extProgInfo { - const char* const name, *iconname; + const str name, iconname; strconfig* const path; mutable QLineEdit* input; mutable QPushButton* setPathButton; +#ifndef _WIN32 + boolconfig* const wine; + mutable QCheckBox* wineBox; +#endif // _WIN32 } g_extProgInfo[] = { - { "Ytruder", "ytruder", &prog_ytruder, null, null }, - { "Rectifier", "rectifier", &prog_rectifier, null, null }, - { "Intersector", "intersector", &prog_intersector, null, null }, - { "Isecalc", "isecalc", &prog_isecalc, null, null }, - { "Coverer", "coverer", &prog_coverer, null, null }, +#ifndef _WIN32 +# define EXTPROG(NAME, LOWNAME) { #NAME, #LOWNAME, &prog_##LOWNAME, null, null, &prog_##LOWNAME##_wine, null }, +#else +# define EXTPROG(NAME, LOWNAME) { #NAME, #LOWNAME, &prog_##LOWNAME, null, null }, +#endif + EXTPROG (Ytruder, ytruder) + EXTPROG (Rectifir, rectifier) + EXTPROG (Intersector, intersector) + EXTPROG (Isecalc, isecalc) + EXTPROG (Coverer, coverer) +#undef EXTPROG }; void ConfigDialog::initExtProgTab () { @@ -340,7 +355,7 @@ QLabel* icon = new QLabel, *progLabel = new QLabel (info.name); QLineEdit* input = new QLineEdit; - QPushButton* setPathButton = new QPushButton (); + QPushButton* setPathButton = new QPushButton; icon->setPixmap (getIcon (info.iconname)); input->setText (info.path->value); @@ -354,6 +369,14 @@ pathsLayout->addWidget (progLabel, row, 1); pathsLayout->addWidget (input, row, 2); pathsLayout->addWidget (setPathButton, row, 3); + +#ifndef _WIN32 + QCheckBox* wineBox = new QCheckBox ("Wine"); + wineBox->setChecked (*info.wine); + info.wineBox = wineBox; + pathsLayout->addWidget (wineBox, row, 4); +#endif + ++row; } @@ -628,7 +651,7 @@ filter = "Applications (*.exe)(*.exe);;All files (*.*)(*.*)"; #endif // WIN32 - str fpath = QFileDialog::getOpenFileName (this, fmt ("Path to %1", info->name), "", filter); + str fpath = QFileDialog::getOpenFileName (this, fmt ("Path to %1", info->name), *info->path, filter); if (fpath.length () == 0) return;
--- a/src/extprogs.cpp Fri Jun 21 17:52:44 2013 +0300 +++ b/src/extprogs.cpp Fri Jun 21 18:41:44 2013 +0300 @@ -42,6 +42,22 @@ cfg (str, prog_ytruder, ""); cfg (str, prog_rectifier, ""); +#ifndef _WIN32 +cfg (bool, prog_isecalc_wine, false); +cfg (bool, prog_intersector_wine, false); +cfg (bool, prog_coverer_wine, false); +cfg (bool, prog_ytruder_wine, false); +cfg (bool, prog_rectifier_wine, false); + +boolconfig* const g_extProgWine[] = { + &prog_isecalc_wine, + &prog_intersector_wine, + &prog_coverer_wine, + &prog_ytruder_wine, + &prog_rectifier_wine, +}; +#endif // _WIN32 + const char* g_extProgNames[] = { "Isecalc", "Intersector", @@ -161,7 +177,14 @@ str inputname, outputname; QStringList argv = argvstr.split (" ", QString::SkipEmptyParts); - printf ("cmdline: %s %s\n", qchars (path), qchars (argvstr)); + print ("cmdline: %1 %2\n", path, argvstr); + +#ifndef _WIN32 + if (g_extProgWine[prog]) { + argv.insert (0, path); + path = "wine"; + } +#endif // _WIN32 if (!mkTempFile (input, inputname) || !mkTempFile (output, outputname)) return;