~ubuntu-branches/ubuntu/edgy/digikam/edgy-proposed

« back to all changes in this revision

Viewing changes to digikam/libs/dcraw/dcrawbinary.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Achim Bohnet
  • Date: 2006-05-15 01:15:02 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060515011502-kpyuz7766hpbuia8
Tags: 0.8.2~rc1-0ubuntu1
* sync with debian (UVF see #44102)
  0.8.2~rc1-0ubuntu1 is identical to debian's 0.8.1+0.8.2-rc1-1.
  Version was changed due to latest 0.8.1.ubuntu-0ubuntu1 upload.
  This version is unfortunately bigger than debian's 0.8.1+0.8.2-rc1-1
* Merge in ubuntu changelog

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 * Author: Marcel Wiesweg <marcel.wiesweg@gmx.de>
 
3
 * Date  : 2006-04-13
 
4
 * Description : Autodetect dcraw binary
 
5
 *
 
6
 * Copyright 2006 by Marcel Wiesweg
 
7
 *
 
8
 * This program is free software; you can redistribute it
 
9
 * and/or modify it under the terms of the GNU General
 
10
 * Public License as published by the Free Software Foundation;
 
11
 * either version 2, or (at your option)
 
12
 * any later version.
 
13
 * 
 
14
 * This program is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 * GNU General Public License for more details.
 
18
 *
 
19
 * ============================================================ */
 
20
 
 
21
// Qt includes
 
22
 
 
23
#include <qprocess.h>
 
24
 
 
25
// KDE includes
 
26
 
 
27
#include <kmessagebox.h>
 
28
#include <kapplication.h>
 
29
#include <klocale.h>
 
30
#include <kglobal.h>
 
31
#include <kaboutdata.h>
 
32
 
 
33
// Local includes
 
34
 
 
35
#include "dcrawbinary.h"
 
36
 
 
37
namespace Digikam
 
38
{
 
39
 
 
40
DcrawBinary *DcrawBinary::m_instance = 0;
 
41
 
 
42
DcrawBinary::DcrawBinary()
 
43
{
 
44
    m_available = false;
 
45
}
 
46
 
 
47
DcrawBinary::~DcrawBinary()
 
48
{
 
49
    m_instance = 0;
 
50
}
 
51
 
 
52
DcrawBinary *DcrawBinary::instance()
 
53
{
 
54
    if (!m_instance)
 
55
        m_instance = new DcrawBinary;
 
56
    return m_instance;
 
57
}
 
58
 
 
59
void DcrawBinary::cleanUp()
 
60
{
 
61
    delete m_instance;
 
62
}
 
63
 
 
64
bool DcrawBinary::checkSystem()
 
65
{
 
66
    QProcess process;
 
67
 
 
68
    process.clearArguments();
 
69
    process.addArgument("dcraw");
 
70
 
 
71
    QString appName = KGlobal::instance()->aboutData()->programName();
 
72
 
 
73
    m_available = process.start();
 
74
 
 
75
    if (!m_available) {
 
76
        int ret = KMessageBox::warningContinueCancel(
 
77
                           kapp->activeWindow(),
 
78
                           i18n("<qt><p>Unable to find the dcraw executable:<br> "
 
79
                                "This program is required by %1 to support raw file formats. "
 
80
                                "You can run %1 without this, but you will not be able "
 
81
                                "to view or edit any images in raw file formats. "
 
82
                                "Please install dcraw as a package from your distributor "
 
83
                                "or <a href=\"%2\">download the source</a>.</p>"
 
84
                                "<p>Do you want to continue starting %1?</p></qt>")
 
85
                                .arg(appName)
 
86
                                .arg("http://www.cybercom.net/~dcoffin/dcraw/"),
 
87
                           QString::null,
 
88
                           KStdGuiItem::cont(),
 
89
                           QString::fromLatin1("dcrawdetection"),
 
90
                           KMessageBox::Notify | KMessageBox::AllowLink
 
91
                          );
 
92
 
 
93
        if (ret == KMessageBox::Cancel)
 
94
            return false;
 
95
    }
 
96
 
 
97
    // Veturn true even if m_available is false,
 
98
    // return value indicates whether the user wants to abort or continue
 
99
    return true;
 
100
}
 
101
 
 
102
const char *DcrawBinary::path()
 
103
{
 
104
    return "dcraw";
 
105
}
 
106
 
 
107
bool DcrawBinary::isAvailable()
 
108
{
 
109
    return m_available;
 
110
}
 
111
 
 
112
}  // namespace Digikam
 
113