Mercurial > octave-antonio
changeset 15159:098546e95a5e gui
allow location of default settings file to be configurable
* gui/default-qt-settings: Rename from default-settings.
* gui/Makefile.am (octetc_DATA): New variable.
* resource-manager.cc (default_qt_settings_file): New function.
(resource_manager::reload_settings): Call default_qt_settings_file to
find default settings file.
* run-octave.in: Set OCTAVE_DEFAULT_QT_SETTINGS in the environment for
running octave.
* gui/src/Makefile.am (liboctgui_la_CPPFLAGS): Include -I../../src,
-I../../src/interpfcn, and -I../../src/parse-tree in the list.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 11 Aug 2012 17:58:12 -0400 |
parents | 960aa8863476 |
children | 973296940c89 |
files | gui/Makefile.am gui/default-qt-settings gui/default-settings gui/src/Makefile.am gui/src/resource-manager.cc run-octave.in |
diffstat | 6 files changed, 71 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/Makefile.am Sat Aug 11 17:35:16 2012 -0400 +++ b/gui/Makefile.am Sat Aug 11 17:58:12 2012 -0400 @@ -1,1 +1,3 @@ SUBDIRS = src + +octetc_DATA = default-qt-settings
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gui/default-qt-settings Sat Aug 11 17:58:12 2012 -0400 @@ -0,0 +1,37 @@ +[General] +connectOnStartup=true +showMessageOfTheDay=true +showTopic=true +autoIdentification=false +nickServPassword= +useCustomFileEditor=false +customFileEditor=emacs +showFilenames=true +showFileSize=false +showFileType=false +showLastModified=false +showHiddenFiles=false +useAlternatingRowColors=true +useProxyServer=false +proxyType= +proxyHostName=none +proxyPort=8080 +proxyUserName= +proxyPassword= + +[editor] +showLineNumbers=true +highlightCurrentLine=true +codeCompletion=true +fontName=Ubuntu Mono +fontSize=12 +shortWindowTitle=true +longWindowTitle=true + +[terminal] +fontSize=10 +fontName=Andale Mono + +[MainWindow] +geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\x31\0\0\0\x18\0\0\x4\xff\0\0\x3\xff\0\0\0\0\0\0\0\0\xff\xff\xff\xfe\xff\xff\xff\xfe\0\0\0\0\x2\0) +windowState=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x1\0\0\0\x1\0\0\x4\xcf\0\0\x3\x91\xfc\x2\0\0\0\x1\xfc\0\0\0\x41\0\0\x3\x91\0\0\x1\xc7\0\xff\xff\xff\xfc\x1\0\0\0\x3\xfc\0\0\0\0\0\0\x1.\0\0\0R\0\xff\xff\xff\xfc\x2\0\0\0\x2\xfb\0\0\0\x1a\0W\0o\0r\0k\0s\0p\0\x61\0\x63\0\x65\0V\0i\0\x65\0w\x1\0\0\0\x41\0\0\x1\xe8\0\0\0k\0\xff\xff\xff\xfb\0\0\0\"\0H\0i\0s\0t\0o\0r\0y\0\x44\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\x1\0\0\x2/\0\0\x1\xa3\0\0\0\x8c\0\xff\xff\xff\xfc\0\0\x1\x34\0\0\x2\x81\0\0\x2\x81\0\0\x2\x81\xfa\0\0\0\0\x2\0\0\0\x2\xfb\0\0\0$\0T\0\x65\0r\0m\0i\0n\0\x61\0l\0\x44\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\x1\0\0\0\0\xff\xff\xff\xff\0\0\x1\xa9\0\xff\xff\xff\xfb\0\0\0\x14\0\x46\0i\0l\0\x65\0\x45\0\x64\0i\0t\0o\0r\x1\0\0\x1\xf0\0\0\x1\xe2\0\0\0j\0\xff\xff\xff\xfb\0\0\0\x1e\0\x46\0i\0l\0\x65\0s\0\x44\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\x1\0\0\x3\xbb\0\0\x1\x14\0\0\0P\0\xff\xff\xff\0\0\0\0\0\0\x3\x91\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\x1\0\0\0\x2\0\0\0\x1\xff\xff\xff\xff\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0)
--- a/gui/default-settings Sat Aug 11 17:35:16 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -[General] -connectOnStartup=true -showMessageOfTheDay=true -showTopic=true -autoIdentification=false -nickServPassword= -useCustomFileEditor=false -customFileEditor=emacs -showFilenames=true -showFileSize=false -showFileType=false -showLastModified=false -showHiddenFiles=false -useAlternatingRowColors=true -useProxyServer=false -proxyType= -proxyHostName=none -proxyPort=8080 -proxyUserName= -proxyPassword= - -[editor] -showLineNumbers=true -highlightCurrentLine=true -codeCompletion=true -fontName=Ubuntu Mono -fontSize=12 -shortWindowTitle=true -longWindowTitle=true - -[terminal] -fontSize=10 -fontName=Andale Mono - -[MainWindow] -geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\0\x31\0\0\0\x18\0\0\x4\xff\0\0\x3\xff\0\0\0\0\0\0\0\0\xff\xff\xff\xfe\xff\xff\xff\xfe\0\0\0\0\x2\0) -windowState=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x1\0\0\0\x1\0\0\x4\xcf\0\0\x3\x91\xfc\x2\0\0\0\x1\xfc\0\0\0\x41\0\0\x3\x91\0\0\x1\xc7\0\xff\xff\xff\xfc\x1\0\0\0\x3\xfc\0\0\0\0\0\0\x1.\0\0\0R\0\xff\xff\xff\xfc\x2\0\0\0\x2\xfb\0\0\0\x1a\0W\0o\0r\0k\0s\0p\0\x61\0\x63\0\x65\0V\0i\0\x65\0w\x1\0\0\0\x41\0\0\x1\xe8\0\0\0k\0\xff\xff\xff\xfb\0\0\0\"\0H\0i\0s\0t\0o\0r\0y\0\x44\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\x1\0\0\x2/\0\0\x1\xa3\0\0\0\x8c\0\xff\xff\xff\xfc\0\0\x1\x34\0\0\x2\x81\0\0\x2\x81\0\0\x2\x81\xfa\0\0\0\0\x2\0\0\0\x2\xfb\0\0\0$\0T\0\x65\0r\0m\0i\0n\0\x61\0l\0\x44\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\x1\0\0\0\0\xff\xff\xff\xff\0\0\x1\xa9\0\xff\xff\xff\xfb\0\0\0\x14\0\x46\0i\0l\0\x65\0\x45\0\x64\0i\0t\0o\0r\x1\0\0\x1\xf0\0\0\x1\xe2\0\0\0j\0\xff\xff\xff\xfb\0\0\0\x1e\0\x46\0i\0l\0\x65\0s\0\x44\0o\0\x63\0k\0W\0i\0\x64\0g\0\x65\0t\x1\0\0\x3\xbb\0\0\x1\x14\0\0\0P\0\xff\xff\xff\0\0\0\0\0\0\x3\x91\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\x1\0\0\0\x2\0\0\0\x1\xff\xff\xff\xff\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0)
--- a/gui/src/Makefile.am Sat Aug 11 17:35:16 2012 -0400 +++ b/gui/src/Makefile.am Sat Aug 11 17:58:12 2012 -0400 @@ -92,7 +92,10 @@ -I$(srcdir)/../../libcruft/misc \ -I../../liboctave \ -I$(srcdir)/../../liboctave \ + -I../../src \ -I../../src/interp-core \ + -I../../src/interpfcn \ + -I../../src/parse-tree \ -I$(srcdir)/../../src \ -I$(srcdir)/../../src/interp-core \ -I$(srcdir)/../../src/interpfcn \
--- a/gui/src/resource-manager.cc Sat Aug 11 17:35:16 2012 -0400 +++ b/gui/src/resource-manager.cc Sat Aug 11 17:58:12 2012 -0400 @@ -15,11 +15,22 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "resource-manager.h" +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <string> + #include <QFile> #include <QDir> +#include <QNetworkProxy> -#include <QNetworkProxy> +#include "file-ops.h" +#include "oct-env.h" + +#include "defaults.h" + +#include "resource-manager.h" resource_manager resource_manager::_singleton; @@ -47,18 +58,30 @@ return _home_path; } +static std::string +default_qt_settings_file (void) +{ + std::string dsf = octave_env::getenv ("OCTAVE_DEFAULT_QT_SETTINGS"); + + if (dsf.empty ()) + dsf = Voct_etc_dir + file_ops::dir_sep_str () + "default-qt-settings"; + + return dsf; +} + void resource_manager::reload_settings () { QDesktopServices desktopServices; _home_path = desktopServices.storageLocation (QDesktopServices::HomeLocation); - QString settings_path = _home_path + "/.config/octave-gui/"; - QString settings_file = settings_path + "settings"; + QString settings_path = _home_path + "/.config/octave/"; + QString settings_file = settings_path + "qt-settings"; if (!QFile::exists (settings_file)) { QDir("/").mkpath (settings_path); - QFile::copy ("../default-settings", settings_file); + QFile::copy (QString::fromStdString (default_qt_settings_file ()), + settings_file); _first_run = true; } else
--- a/run-octave.in Sat Aug 11 17:35:16 2012 -0400 +++ b/run-octave.in Sat Aug 11 17:58:12 2012 -0400 @@ -73,6 +73,7 @@ fi OCTAVE_SITE_INITFILE="$top_srcdir/scripts/startup/main-rcfile" \ +OCTAVE_DEFAULT_QT_SETTINGS="$top_srcdir/gui/default-qt-settings" \ exec $builddir/libtool --mode=execute $driver \ "$octave_executable" --no-init-path --path="$LOADPATH" \ --image-path="$IMAGEPATH" --doc-cache-file="$DOCFILE" \