view gui/src/octave-gui.cc @ 15081:d02b229ce693 gui

Cleaned up icon positions. Removed icon loading from resource manager. * chat.png: Moved to gui/src/icons. * help_index.png: Moved to gui/src/icons. * icons_license: Moved to gui/src/icons. * jabber_protocol.png: Moved to gui/src/icons. * logo.png: Moved to gui/src/icons. * terminal.png: Moved to gui/src/icons. * main-window.cc: Removed retrieveing icons from resource manager. * octave-gui.cc: Removed loading icons with resource manager. * resource-manager: Removed code for loading and retrieving icons. * resource.qrc: Added icons to resource file.
author Jacob Dawid <jacob.dawid@gmail.com>
date Thu, 02 Aug 2012 12:12:00 +0200
parents a6c44c28dabe
children 16a6b0a6855d
line wrap: on
line source

/* OctaveGUI - A graphical user interface for Octave
 * Copyright (C) 2011 Jacob Dawid (jacob.dawid@googlemail.com)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#include <QtGui/QApplication>
#include <QTranslator>
#include <QSettings>
#include "welcome-wizard.h"
#include "resource-manager.h"
#include "main-window.h"

int
main (int argc, char *argv[])
{
  /* dissociate from the controlling terminal, if any */

  pid_t pid = fork ();
  if (pid < 0)
    {
      //fprintf (stderr, "fork failed\n");
      return 1;
    }
  else if (pid == 0)
    {
      /* child */
      //fprintf (stderr, "in child, calling setsid ()\n");

      if (setsid () < 0)
        {
          //fprintf (stderr, "setsid error\n");
          return 1;
        }
    }
  else
    {
      /* parent */
      //fprintf (stderr, "in parent, exiting\n");
      exit (0);
    }

  QApplication application (argc, argv);
  while (true)
    {
      if (resource_manager::instance ()->is_first_run ())
        {
          welcome_wizard welcomeWizard;
          welcomeWizard.exec ();
          resource_manager::instance ()->reload_settings ();
        }
      else
        {
          QSettings *settings = resource_manager::instance ()->get_settings ();
          QString language = settings->value ("language").toString ();

          QString translatorFile = resource_manager::instance ()->find_translator_file (language);
          QTranslator translator;
          translator.load (translatorFile);
          application.installTranslator (&translator);

          resource_manager::instance ()->update_network_settings ();

          main_window w;
          w.show ();
          return application.exec ();
        }
    }
}