summaryrefslogtreecommitdiffstats
path: root/buildtools/qmake/qmakeoptionswidget.cpp
blob: 920d2efdf336a2fa481b031142c03447aa00fa27 (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
/***************************************************************************
*   Copyright (C) 2006 by Andreas Pakulat                                 *
*   apaku@gmx.de                                                          *
*                                                                         *
*   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.                                   *
*                                                                         *
***************************************************************************/

#include "qmakeoptionswidget.h"

#include <tqcheckbox.h>
#include <kcombobox.h>
#include <tqbuttongroup.h>
#include <kurlrequester.h>

#include <domutil.h>
#include <kdebug.h>

QMakeOptionsWidget::QMakeOptionsWidget( const TQString& projectdir, TQDomDocument &dom, const TQString &configGroup,
                                      TQWidget *tqparent, const char *name )
        : QMakeOptionsWidgetBase( tqparent, name ),
        m_dom( dom ), m_configGroup( configGroup ), m_projectDir( projectdir )
{
    groupBehaviour->setButton( DomUtil::readIntEntry( dom, configGroup+"/qmake/savebehaviour", 2) );
    checkReplacePaths->setChecked( DomUtil::readBoolEntry( dom, configGroup+"/qmake/replacePaths", false ) );
    checkDisableDefaultOpts->setChecked( DomUtil::readBoolEntry( dom, configGroup+"/qmake/disableDefaultOpts", true ) );
    checkFilenamesOnly->setChecked( DomUtil::readBoolEntry( dom, configGroup+"/qmake/enableFilenamesOnly", false ) );
    showVariablesInTree->setChecked( DomUtil::readBoolEntry( dom, configGroup+"/qmake/showVariablesInTree", true ) );
    checkShowParseErrors->setChecked( DomUtil::readBoolEntry( dom,
            configGroup+"/qmake/showParseErrors", true ) );
    qmakeProjectFile->setURL( DomUtil::readEntry( dom, configGroup+"/qmake/projectfile", "" ) );
    qmakeProjectFile->setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly );
    qmakeProjectFile->setFilter( "*.pro *.pri" );
    if( qmakeProjectFile->url().isEmpty() )
    {
        qmakeProjectFile->setURL( projectdir );
    }
}


QMakeOptionsWidget::~QMakeOptionsWidget()
{}


void QMakeOptionsWidget::accept()
{
    DomUtil::writeIntEntry( m_dom, m_configGroup + "/qmake/savebehaviour", groupBehaviour->selectedId() );
    DomUtil::writeBoolEntry( m_dom, m_configGroup + "/qmake/replacePaths", checkReplacePaths->isChecked() );
    DomUtil::writeBoolEntry( m_dom, m_configGroup + "/qmake/disableDefaultOpts", checkDisableDefaultOpts->isChecked() );
    DomUtil::writeBoolEntry( m_dom, m_configGroup + "/qmake/enableFilenamesOnly", checkFilenamesOnly->isChecked() );
    DomUtil::writeBoolEntry( m_dom, m_configGroup + "/qmake/showVariablesInTree", showVariablesInTree->isChecked() );
    DomUtil::writeBoolEntry( m_dom, m_configGroup + "/qmake/showParseErrors", checkShowParseErrors->isChecked() );
    TQString projfile = qmakeProjectFile->url();
    if( projfile != m_projectDir && TQFileInfo( projfile ).isFile() && ( projfile.endsWith( ".pro" ) || projfile.endsWith( ".pri" ) ) )
        DomUtil::writeEntry( m_dom, m_configGroup + "/qmake/projectfile", projfile );
}

#include "qmakeoptionswidget.moc"

// kate: space-indent on; indent-width 4; tab-width 4; tqreplace-tabs on