Port to Qt4 back compatible code

NOTE: this commit contains off topic change
I needed to add inttypes.h to server source
because of my build environment settings changes.
This will not be in qt5-port final branch.

I made them Qt4/Qt5 compatible first.

As reading porting guide,
There are still a lot imcompatible changes which I should check more.
Here my process for porting:

  * follow porting guide document

  * For each topic, search on web, bug tracker, blog article and forum.
    not reading all, only found some in search results.
    There might be summary someone already worked, and
    There were some topics not documented in official porting guide, yet.

  * grep wahjam or qt5 sources, read implementation.
    make tests if needed.

Each commit will keep build success on Qt4, by commit compatible code.
and Only final commit will be pass build on Qt5/Qt4 both.

----

Thise are qt4/qt5 compatible after changed

  * toAscii() -> toLatin1()

  * Q_WS_* -> Q_OS_*

  * QUrl::addQueryItem -> QUrl::setQuery

    setQuery("format=xml") is not good change,
    because now the parameter "xml" is part of string literal.

      addQueryItem("format", FORMAT);

      setQuery("format=" FORMAT);

    Not good yet. many disadvantage are raised.

    * make code looks complex.
    * if the parameter was variable, that does not work.
    * have to escape dlimiter in value, or it would be invalid query.

    Those were worst case senario, real use in this application
    would not have so much risk. this is just note the trade-off.

    I've decided setQuery it's compatible and the change was small.

    Instead of use QUrl::addQueryItem with checking version each places,
    do it in base rest api client class, that can reduce changes costs.

Incompatible changes, Thise needs version check

  * QT += widgets in project file, now check QT_MAJOR_VERSION

  * QDesktopServices::storageLocation -> QStandardPaths::writableLocation

    Now, those duplicated codes are located in
    static QDir MainWindow::GetDataLocation()
    and the implementation is switched by preprocessor macro.

    NOTE: imcompatible behavior of QStandardPaths is reported in forum.
    That may not be problem for clean install,
    but may be problem for update version and keep previous version
    setting. I need more research about this, I will report detail later.

    I think first check path existance in the function
    but thise are rejected ideas, here notes

    * C++ ... traditional way using reference.

      bool GetDataLocation(QDir& dir)

    * C++11 ... tie() is interesting, now can return tuple like Python
      but, may incompatible for some environment, and this uses STL.

      std::tuple<bool,QDir> GetDataLocation();

      bool exists, QDir basedir;
      std::tie(exists,basedir) = GetDataLocation();

    * QPair ... like std::pair but can not used in std::tie
      the access is pair.first, pair.second.
      Qt5 also changed some API from QPair to two members struct.

      QPair<bool,QDir> GetDataLocation()

    Finally, I skip to think this.
    This looks an expanded topic for here, I should in this branch
    change minimam to make them compatible bitween Qt4 and 5

  * qInstallMsgHandler -> qInstallMessageHandler

    qtclient/logging.cpp
    server/logging.cpp

    First, I think them to be common/
    some of them can shared code, but much code to changes for
    differernt requirements. I leave it for now.
    This commit apply same changes to the two codes.

    First approach

    #if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
    #define InstallMessageHandler qInstallMessageHandler
    static void logMsgHandler(QMsgType type,
                              QMessageContext& context,
			      QString& msg)
    #else
    #define InstallMessageHandler qInstallMsgHandler
    static void logMsgHandler(QMsgType type, const char *msg)
    #endif
    {
       // But type of "msg" here is QString/const char *
       // printf requires char *
       // logging implementation had to use stream to be compatible.
    }

    This kind of macro may break C++ syntax which Editor support.
    Aliased by define, editor's function jump may not work.

    Second approach

    #if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
    #define qInstallMsgHandler qInstallMessageHandler
    void logMsgHandler(QtMsgType type,
                       const QMessageContext& context,
                       const QString& msg){
      Q_UNUSED(context);
      logMsgHandler(type, msg.toUtf8().constData());
    }
    #endif

    This was minimam change approach, if overload is allowed.
    Qt4 code does not change, but aliased by define hides information,
    readers will see qInstallMsgHandler(logMsgHandler)
    they may think it's Qt4 code. since the naming is qt global,
    no hints for them to find it's project local alias.

    Wraps message handler that make two symbols in Qt5 though,
    would not be much cost for logging.

    Another approach, I think of drop logging from server/Qt5
    Qt5 had qSetMessagePattern/QT_MESSAGE_PATTERN
    for customize debug print format. %{type} will print QtMsgType
    but it was not enough, there is no placeholder for timestamp.

I notes here, as personal working log, and explain the trade off
I wanted to make change small and I don't want many version check
macro, that increase changes/tests costs.

I will keep this branch as working log.
clean branch for pull request will come with more simple commit log.

Signed-off-by: Ikkei Shimomura (tea) <Ikkei.Shimomura@gmail.com>