~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to buildtools/custommakefiles/custombuildoptionswidget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright (C) 2002 by Bernd Gehrmann                                  *
3
 
 *   bernd@kdevelop.org                                                    *
4
 
 *                                                                         *
5
 
 *   This program is free software; you can redistribute it and/or modify  *
6
 
 *   it under the terms of the GNU General Public License as published by  *
7
 
 *   the Free Software Foundation; either version 2 of the License, or     *
8
 
 *   (at your option) any later version.                                   *
9
 
 *                                                                         *
10
 
 ***************************************************************************/
11
 
 
12
 
#include "custombuildoptionswidget.h"
13
 
 
14
 
#include <qcheckbox.h>
15
 
#include <klineedit.h>
16
 
#include <kurlrequester.h>
17
 
#include <kurlcompletion.h>
18
 
#include <kfiledialog.h>
19
 
#include <qradiobutton.h>
20
 
#include <qtabwidget.h>
21
 
#include "domutil.h"
22
 
 
23
 
 
24
 
CustomBuildOptionsWidget::CustomBuildOptionsWidget(QDomDocument &dom,
25
 
                                                   QWidget *parent, const char *name)
26
 
    : CustomBuildOptionsWidgetBase(parent, name),
27
 
      m_dom(dom)
28
 
{
29
 
    ant_button->setChecked(DomUtil::readEntry(dom, "/kdevcustomproject/build/buildtool") == "ant");
30
 
    other_button->setChecked(DomUtil::readEntry(dom, "/kdevcustomproject/build/buildtool") == "other");
31
 
    if( !DomUtil::readEntry(dom, "/kdevcustomproject/build/builddir").isEmpty()
32
 
            && QFileInfo( DomUtil::readEntry(dom, "/kdevcustomproject/build/builddir") ).exists() )
33
 
    {
34
 
        builddir_edit->setURL(DomUtil::readEntry(dom, "/kdevcustomproject/build/builddir"));
35
 
        builddir_edit->fileDialog()->setURL( DomUtil::readEntry(dom, "/kdevcustomproject/build/builddir") );
36
 
    }
37
 
    else
38
 
    {
39
 
        builddir_edit->setURL( QString() );
40
 
        builddir_edit->fileDialog()->setURL( QString() );
41
 
    }
42
 
    builddir_edit->completionObject()->setMode(KURLCompletion::DirCompletion);
43
 
    builddir_edit->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly );
44
 
 
45
 
    // This connection must not be made before the ant->setChecked() line,
46
 
    // because at this time makeToggled() would crash
47
 
    connect( make_button, SIGNAL(toggled(bool)),
48
 
            this, SLOT(makeToggled(bool)) );
49
 
    connect( other_button, SIGNAL(toggled(bool)),
50
 
             this, SLOT(otherToggled(bool)) );
51
 
}
52
 
 
53
 
 
54
 
CustomBuildOptionsWidget::~CustomBuildOptionsWidget()
55
 
{}
56
 
 
57
 
 
58
 
void CustomBuildOptionsWidget::accept()
59
 
{
60
 
    QString buildtool;
61
 
    if (ant_button->isChecked())
62
 
    {
63
 
        buildtool = "ant";
64
 
    }
65
 
    else if (other_button->isChecked())
66
 
    {
67
 
        buildtool = "other";
68
 
    }
69
 
    else
70
 
    {
71
 
        buildtool = "make";
72
 
    }
73
 
    DomUtil::writeEntry(m_dom, "/kdevcustomproject/build/buildtool", buildtool);
74
 
    DomUtil::writeEntry(m_dom, "/kdevcustomproject/build/builddir", builddir_edit->url());
75
 
}
76
 
 
77
 
 
78
 
void CustomBuildOptionsWidget::setMakeOptionsWidget(QTabWidget *tw, QWidget *mow, QWidget* oow)
79
 
{
80
 
    m_tabWidget = tw;
81
 
    m_makeOptions = mow;
82
 
    m_otherOptions = oow;
83
 
    makeToggled(make_button->isChecked());
84
 
    otherToggled(other_button->isChecked());
85
 
}
86
 
 
87
 
void CustomBuildOptionsWidget::otherToggled(bool b)
88
 
{
89
 
    m_tabWidget->setTabEnabled(m_otherOptions, b);
90
 
}
91
 
 
92
 
void CustomBuildOptionsWidget::makeToggled(bool b)
93
 
{
94
 
    m_tabWidget->setTabEnabled(m_makeOptions, b);
95
 
}
96
 
 
97
 
#include "custombuildoptionswidget.moc"
98
 
 
99
 
// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on