summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/mpegencoder/checkbinprog.cpp
blob: 23aeb017f394fb0d4380fced43dd2c4b67fdadbb (plain)
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
//////////////////////////////////////////////////////////////////////////////
//
//    CHECKBINPROG.CPP
//
//    Copyright (C) 2003 Gilles CAULIER <caulier dot gilles at gmail dot 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 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., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
//
//////////////////////////////////////////////////////////////////////////////

#include "checkbinprog.h"

// TQt includes

#include <tqwidget.h>
#include <tqdir.h>
#include <tqfile.h>
#include <tqfileinfo.h>

// KDElib includes

#include <klocale.h>
#include <kconfig.h>
#include <kapplication.h>
#include <kurl.h>
#include <kmessagebox.h>
#include <kstandarddirs.h>

namespace KIPIMPEGEncoderPlugin
{

///////////////////////////////// CONSTRUCTOR ///////////////////////////////////////////////

CheckBinProg::CheckBinProg(TQObject *parent)
{
  config = new TDEConfig("kipirc");
  config->setGroup("MPEGEncoder Settings");
  ImageMagickPath = config->readPathEntry("ImageMagickBinFolder");
  MjpegToolsPath = config->readPathEntry("MjpegToolsBinFolder");
}


/////////////////////////////// DESTRUCTOR //////////////////////////////////////////////////

CheckBinProg::~CheckBinProg()
{
}


/////////////////////////////////////////////////////////////////////////////////////////////

int CheckBinProg::findExecutables( void )
{
  TQFile montage, composite, convert, identify, ppmtoy4m, yuvscaler, mpeg2enc, mp2enc, mplex;
  int ValRet = 0;

  if (ImageMagickPath.isEmpty())
        {
        KMessageBox::error(TQT_TQWIDGET(kapp->activeWindow()), i18n("Your 'ImageMagick' binary program path is empty.\nSetting to default value. Check option's setting."));
        return (ValRet);
        }

if (MjpegToolsPath.isEmpty())
        {
        KMessageBox::error(TQT_TQWIDGET(kapp->activeWindow()), i18n("Your 'MjpegTools' binary programs path is empty.\nSetting to default value. Check option's setting."));
        return (ValRet);
        }

  TQString str = "";

  // ImageMagick external programs.

  if (montage.exists(TQString (ImageMagickPath+"/montage")) == FALSE)
    str = i18n("Cannot find 'montage' binary program from ImageMagick package. Please install it.");

  if (composite.exists(TQString (ImageMagickPath+"/composite")) == FALSE)
    str = i18n("Cannot find 'composite' binary program from ImageMagick package. Please install it.");

  if (convert.exists(TQString (ImageMagickPath+"/convert")) == FALSE)
    str = i18n("Cannot find 'convert' binary program from ImageMagick package. Please install it.");

  if (identify.exists(TQString (ImageMagickPath+"/identify")) == FALSE)
    str = i18n("Cannot find 'identify' binary program from ImageMagick package. Please install it.");

  // MjpegTools external programs.

  if (ppmtoy4m.exists(TQString (MjpegToolsPath+"/ppmtoy4m")) == FALSE)
    str = i18n("Cannot find 'ppmtoy4m' binary program from MjpegTools package. Please install it.");

  if (yuvscaler.exists(TQString (MjpegToolsPath+"/yuvscaler")) == FALSE)
    str = i18n("Cannot find 'yuvscaler' binary program from MjpegTools package. Please install it.");

  if (mpeg2enc.exists(TQString (MjpegToolsPath+"/mpeg2enc")) == FALSE)
    str = i18n("Cannot find 'mpeg2enc' binary program from MjpegTools package. Please install it.");

  if (  mplex.exists(TQString (MjpegToolsPath+"/mplex")) == FALSE)
    str = i18n("Cannot find 'mplex' binary program from MjpegTools package. Please install it.");

  if (mp2enc.exists(TQString (MjpegToolsPath+"/mp2enc")) == FALSE)
    {
    str = i18n("Cannot find 'mp2enc' binary program from MjpegTools package. Please install it.\n"
               "Audio capabilities will be disabled.");
    ValRet = 2;
    }

  if ( !str.isEmpty() )
    {
    str += i18n("\nCheck your installation and this plugin's options settings."
                 "\n\nVisit these URLs for more information:"
                 "\nImageMagick package: http://www.imagemagick.org/"
                 "\nMjpegTools package: http://mjpeg.sourceforge.net/");
    KMessageBox::error(TQT_TQWIDGET(kapp->activeWindow()), str);
    return (ValRet);
    }

  return (1);
}

}  // NameSpace KIPIMPEGEncoderPlugin

#include "checkbinprog.moc"