1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
|
/***************************************************************************
main.cpp - description
-------------------
begin : Sat Dec 1 2001
copyright : (C) 2001 by Richard Groult, 2003 OGINO Tomonori
email : rgroult@jalix.org ogino@nn.iij4u.or.jp
***************************************************************************/
/***************************************************************************
* *
* 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 2 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, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA. *
* *
* For license exceptions see LICENSE.EXC file, attached with the source *
* code. *
* *
***************************************************************************/
// Local
#include <showimg/kstartuplogo.h>
#include <showimg/mainwindow.h>
// KDE
#include <kimageio.h>
#include <kprocess.h>
#include <kmainwindow.h>
#include <klocale.h>
#include <kconfig.h>
#include <kcmdlineargs.h>
#include <kapplication.h>
#include <kuniqueapplication.h>
#include <kaboutdata.h>
#include <kstandarddirs.h>
#include <kwin.h>
#include <kdebug.h>
#include <dcopclient.h>
// Qt
#include <qpixmapcache.h>
#include <qfile.h>
#include <qimage.h>
static const char *description =
I18N_NOOP ("Viewer for your desktop");
static KCmdLineOptions options[] = {
{"+file", I18N_NOOP ("Name of the image file to view"), 0},
{"+directory", I18N_NOOP ("Name of the directory to browse"), 0},
{0, 0, 0}};
static MainWindow *frame=NULL;
static const char* SHOWIMG_DATE="0.9.4.1";
class ShowImgApplication : public KUniqueApplication
{
public:
ShowImgApplication() : KUniqueApplication() { };
virtual int newInstance()
{
// process args:
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if(frame)
{
#ifndef Q_WS_WIN
KWin::deIconifyWindow(frame->winId());
KWin::setOnDesktop(frame->winId(), KWin::currentDesktop());
#endif
if (args->count() == 1)
frame->openDir(QFile::decodeName(args->arg (0)));
}
args->clear();
return 0;
};
};
int
main (int argc, char **argv)
{
KAboutData* aboutData = new KAboutData("showimg", I18N_NOOP("showimg"),
SHOWIMG_DATE, description, KAboutData::License_GPL,
"(c) 2001-2004, Richard Groult", I18N_NOOP("(Please e-mail any bug reports...\nor encouragements to me :)"),
"http://www.jalix.org/projects/showimg/",
"rgroult@jalix.org" );
aboutData->addAuthor ("Richard Groult", I18N_NOOP("Developer"), "rgroult@jalix.org", "http://ric.jalix.org");
aboutData->addAuthor ("Dominik Seichter", I18N_NOOP("to allow me to use his great software krename for showimg, and patch writing"), "domseichter@web.de", "http://www.freshmeat.net/projects/krename" );
aboutData->addAuthor ("Tomonori Ogino", I18N_NOOP("patch for archives"), "ogino@nn.iij4u.or.jp");
aboutData->addCredit ("Valérie", I18N_NOOP("for the original logo"));
aboutData->addCredit ("Benoist", I18N_NOOP("Beta tester, translation, and help for the zoom feature"), "b.gaston@laposte.net");
aboutData->addCredit ("Romain Vallet", I18N_NOOP("Documentation and spelling corrector"), "rom@jalix.org");
aboutData->addCredit ("Guillaume Duhamel",I18N_NOOP("Beginning of Japanese translation and beginning of the http/ftp protocol support") , "Guillaume.Duhamel@gmail.com");
aboutData->addCredit ("Alain Bidaud and the Jalix team", I18N_NOOP("for the web site"));
aboutData->addCredit ("André Pascual ", I18N_NOOP("for the current logo and additional icons"), "andre@linuxgraphic.org");
aboutData->addCredit ("Jean-Philippe Martin",I18N_NOOP("for icons and advice about features and design") , "jeanphilippemartin@club-internet.fr");
aboutData->addCredit ("Hape Schaal ", I18N_NOOP("German translator and a great help for debugging"), "hp.news@gmx.de");
//FIXME I18N_NOOP
aboutData->addCredit ("Jarosław Staniek", "win32 port", "js@iidea.pl", "http://www.kexi-project.org/pjs.html");
aboutData->addCredit ("Matthias Wandel", I18N_NOOP("to allow me to use jhead for JPEG-EXIF format support"), "MWandel@rim.net");
aboutData->addCredit ("Andrew Richards", I18N_NOOP("to allow me to use his printImageDialog class"), "ajr@users.sourceforge.net");
aboutData->addCredit ("Lots of people", I18N_NOOP("for bugs reports, advice\nand encouragement :)"));
//FIXME I18N_NOOP
aboutData->addCredit ("kipi team", "for the kipi plugins", "https://mail.kde.org/mailman/listinfo/kde-imaging", "http://extragear.kde.org/apps/kipi" );
//
KCmdLineArgs::init (argc, argv, aboutData);
KCmdLineArgs::addCmdLineOptions (options);
ShowImgApplication::addCmdLineOptions();
bool alreadyRunning=!ShowImgApplication::start();
if (alreadyRunning)
{
kdWarning() << "ShowImg is already running!" << endl;
return 0;
}
ShowImgApplication kApp;
KConfig *config = new KConfig("showimgrc");
config->setGroup("confirm");
KStartupLogo* logo=NULL;
if(config->readBoolEntry("showSP", true))
{
logo = new KStartupLogo();
logo->show();
}
delete config;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs ();
if (args->count() == 0)
{
frame = new MainWindow ("MainFrame");
}
else
{
frame = new MainWindow (QFile::decodeName (args->arg (0)), "MainFrame");
}
frame->setIcon(kApp.icon());
kApp.setMainWidget (frame);
if(logo)
{
logo->hide();
delete logo;
}
int ret = kApp.exec ();
return ret;
}
|