lbellonda / qxmledit

QXmlEdit XML editor. Downloads: https://sourceforge.net/projects/qxmledit/files
http://qxmledit.org
Other
164 stars 48 forks source link

FEATURE REQUEST: make manual location configurable #16

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is not a bug report, rather a wish.

When building QXmlEdit, it is hard to customize the install location of some of 
its pieces, and specifically of the manual file.

Conversely, this is important to packaging as many distributions have strict 
guidelines about what should go where.

The manual of QXmlEdit is a pdf file.
In debian based systems, this should go in /usr/share/doc/qxmledit/

However, the QXmlEdit build system installs it together with all the other 
program resources in INST_DATA_DIR.

Would be great to have an INST_DOC_DIR for documentation.
Additionally, there should be something like
DEFINES += DOC_DIR=$$INST_DOC_DIR in the pro file, to assure that the doc dir 
information is passed to the program, so that it can find the manual.

Also note that the very name of the HELP_FILE seems to be hardwired in the 
sources, when it should probably be passed to the program by another DEFINE.

Just in case they are useful, I am attaching the two patches that I use to 
build on debian (these are for 0.6.0).  They are ugly and can be very much 
improved.

--- Qxmledit-Git.orig/src/QXmlEdit.pro  2011-12-29 01:12:18.524011618 +0100
+++ Qxmledit-Git/src/QXmlEdit.pro       2012-01-01 13:00:28.271169705 +0100
@@ -22,14 +22,15 @@

-# TO CUSTOMIZE INSTALLATION DIRECTORY SET THESE TWO VARIABLES
+# TO CUSTOMIZE INSTALLATION DIRECTORY SET THESE THREE VARIABLES
 # Note:
 #  WITH SOME MORE WORK WE CAN USE VARIABLES PASSED TO MAKE LIKE THAT
 #  in pro DEFINES += UNIX_RESOURCE_PATH=\"$(QXMLEDIT_DATADIR)\"
 #  and calling make QXMLEDIT_DATADIR=/usr/share/qxmledit

-INST_DATA_DIR = /opt/qxmledit
-INST_DIR = /opt/qxmledit
+INST_DATA_DIR = /usr/share/qxmledit
+INST_DOC_DIR = /usr/share/doc/qxmledit
+INST_DIR = /usr/bin

 TEMPLATE = app
@@ -290,7 +291,7 @@

 ICON = images/mainIcon.icns
 win32:RC_FILE = win.rc
-styles.path = $$INST_DATA_DIR
+styles.path = $$INST_DATA_DIR/styles
 styles.files = data/sample.style
 snippets.path = $$INST_DATA_DIR/snippets
 snippets.files = data/snippets/{6d11b8d1-e285-46b2-8375-79e17cab9862}.xml \
@@ -300,7 +301,7 @@
     data/snippets/{e40792fb-16de-4418-9320-4feaa92c28a3}.xml \
     data/snippets/{edc60671-0ae0-401b-989d-5d0b82976bce}.xml \
     data/snippets/{f6d7ebdd-c505-4a6a-8a16-f7c99581a995}.xml
-manual.path = $$INST_DATA_DIR
+manual.path = $$INST_DOC_DIR
 manual.files = ../doc/QXmlEdit_manual.pdf

 # resources are defined in paths.h

--- Qxmledit-Git.orig/src/applicationdata.h     2012-01-05 13:31:18.905365968 
+0100
+++ Qxmledit-Git/src/applicationdata.h  2012-01-05 13:34:52.000000000 +0100
@@ -83,6 +83,7 @@
     QString snippetsLocalDir();
     QString snippetsProgramDir();
     static QString getResourceDir();
+    static QString getDocDir();

     IQXmlEditPlugIn *xsdPlugin();

--- Qxmledit-Git.orig/src/applicationdata.cpp   2012-01-05 13:31:18.961366246 
+0100
+++ Qxmledit-Git/src/applicationdata.cpp        2012-01-05 14:34:05.416043086 
+0100
@@ -232,6 +232,26 @@
 #endif
 }

+QString ApplicationData::getDocDir()
+{
+#ifdef Q_WS_MAC
+    //All the others
+    QString toReturn ;
+    toReturn = QApplication::applicationDirPath() + QDir::separator() + ".." + 
QDir::separator() + "SharedSupport" ;
+    return toReturn ;
+#else
+
+#ifdef UNIX_RESOURCES
+    QString toReturn = QString(STRINGIZE(DOC_DIR));
+    return toReturn;
+#else
+    //All the others
+    return QApplication::applicationDirPath();
+#endif
+
+#endif
+}
+
 const QMap<QString, IQXmlEditPlugIn*> &ApplicationData::plugins() const
 {
     return _plugins ;

--- Qxmledit-Git.orig/src/mainwindow.cpp        2012-01-05 13:31:18.933366107 
+0100
+++ Qxmledit-Git/src/mainwindow.cpp     2012-01-05 13:34:52.000000000 +0100
@@ -2412,7 +2412,7 @@

 void MainWindow::on_actionHelpOnQXmlEdit_triggered()
 {
-    QString resourceHelp = data->getResourceDir() + "/" + HELP_FILE ;
+    QString resourceHelp = data->getDocDir() + "/" + HELP_FILE ;
     QDesktopServices::openUrl(QUrl::fromLocalFile(resourceHelp));
 }

--- Qxmledit-Git.orig/src/QXmlEdit.pro  2012-01-05 13:34:52.000000000 +0100
+++ Qxmledit-Git/src/QXmlEdit.pro       2012-01-05 14:29:35.674705508 +0100
@@ -49,7 +49,7 @@
 ############ CONFIGURATION SENT TO THE PROGRAM ############
 # translations folder (inside the resources folder).
 DEFINES += TRANLASTION_DIR=translations
-
+DEFINES += DOC_DIR=$$INST_DOC_DIR

 HEADERS = mainwindow.h \
     regola.h \

Original issue reported on code.google.com by sergio.c...@gmail.com on 5 Jan 2012 at 2:24

GoogleCodeExporter commented 9 years ago
Changed the type of this ticket to enhancement. Scheduled the documentation 
location configuration for a next release.

Original comment by lbello...@gmail.com on 5 Jan 2012 at 9:12

GoogleCodeExporter commented 9 years ago

Original comment by lbello...@gmail.com on 11 Jan 2012 at 9:20

GoogleCodeExporter commented 9 years ago
Addressed in 0.6.2. Thanks for the suggestion.

Original comment by lbello...@gmail.com on 16 Jan 2012 at 10:43