KDevelop API Documentation

debuggerconfigwidget.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 1999-2001 by John Birch                                 *
00003  *   jbb@kdevelop.org                                                      *
00004  *   Copyright (C) 2001 by Bernd Gehrmann                                  *
00005  *   bernd@kdevelop.org                                                    *
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  ***************************************************************************/
00013 
00014 #include "debuggerconfigwidget.h"
00015 
00016 #include "debuggerpart.h"
00017 #include "kdevproject.h"
00018 
00019 #include "domutil.h"
00020 #include <kurlrequester.h>
00021 
00022 #include <qcheckbox.h>
00023 #include <qfileinfo.h>
00024 #include <qlineedit.h>
00025 #include <qradiobutton.h>
00026 
00027 namespace GDBDebugger
00028 {
00029 
00030 DebuggerConfigWidget::DebuggerConfigWidget(DebuggerPart* part, QWidget *parent, const char *name)
00031     : DebuggerConfigWidgetBase(parent, name), dom(*part->projectDom())
00032 {
00033     QFontMetrics fm(programArgs_edit->fontMetrics());
00034     programArgs_edit->setMinimumWidth(fm.width('X')*30);
00035 
00036     gdbPath_edit->setMode(KFile::Directory);
00037 
00038     programArgs_edit->setText(  DomUtil::readEntry(dom, "/kdevdebugger/general/programargs"));
00039     gdbPath_edit->setURL(      DomUtil::readEntry(dom, "/kdevdebugger/general/gdbpath"));
00040 
00041     QString shell =             DomUtil::readEntry(dom, "/kdevdebugger/general/dbgshell","no_value");
00042     if( shell == QString("no_value") )
00043     {
00044         QFileInfo info( part->project()->buildDirectory() + "/libtool" );
00045         if( info.exists() ) {
00046             shell = "libtool";
00047         } else {
00048             // Try one directory up.
00049             info.setFile( part->project()->buildDirectory() + "/../libtool" );
00050             if( info.exists() ) {
00051                 shell = "../libtool";
00052             } else {
00053                 // Give up.
00054                 shell = QString::null;
00055             }
00056         }
00057     }
00058     debuggingShell_edit->setURL( shell );
00059 
00060     // Use setFile instead?
00061     configGdbScript_edit->setText( DomUtil::readEntry(dom, "/kdevdebugger/general/configGdbScript"));
00062     runShellScript_edit ->setText( DomUtil::readEntry(dom, "/kdevdebugger/general/runShellScript"));
00063     runGdbScript_edit   ->setText( DomUtil::readEntry(dom, "/kdevdebugger/general/runGdbScript"));
00064 
00065     displayStaticMembers_box->setChecked(  DomUtil::readBoolEntry(dom, "/kdevdebugger/display/staticmembers", false));
00066     asmDemangle_box->setChecked(           DomUtil::readBoolEntry(dom, "/kdevdebugger/display/demanglenames", true));
00067     breakOnLoadingLibrary_box->setChecked( DomUtil::readBoolEntry(dom, "/kdevdebugger/general/breakonloadinglibs", true));
00068     dbgTerminal_box->setChecked(           DomUtil::readBoolEntry(dom, "/kdevdebugger/general/separatetty", false));
00069     enableFloatingToolBar_box->setChecked( DomUtil::readBoolEntry(dom, "/kdevdebugger/general/floatingtoolbar", false));
00070     int outputRadix = DomUtil::readIntEntry(dom, "/kdevdebugger/display/outputradix", 10);
00071     
00072     switch (outputRadix)
00073     {
00074     case 8:
00075       outputRadixOctal->setChecked(true);
00076       break;
00077     case 16:
00078       outputRadixHexadecimal->setChecked(true);
00079       break;
00080     case 10:
00081     default:
00082       outputRadixDecimal->setChecked(true);
00083       break;
00084     }
00085     
00086     
00087     // ??? DomUtil::readEntry(dom, "/kdevdebugger/general/allowforcedbpset");
00088 
00089     resize(sizeHint());
00090 }
00091 
00092 
00093 DebuggerConfigWidget::~DebuggerConfigWidget()
00094 {}
00095 
00096 
00097 void DebuggerConfigWidget::accept()
00098 {
00099     DomUtil::writeEntry(dom, "/kdevdebugger/general/programargs", programArgs_edit->text());
00100     DomUtil::writeEntry(dom, "/kdevdebugger/general/gdbpath", gdbPath_edit->url());
00101     DomUtil::writeEntry(dom, "/kdevdebugger/general/dbgshell", debuggingShell_edit->url());
00102 
00103     DomUtil::writeEntry(dom, "/kdevdebugger/general/configGdbScript", configGdbScript_edit->text());
00104     DomUtil::writeEntry(dom, "/kdevdebugger/general/runShellScript", runShellScript_edit ->text());
00105     DomUtil::writeEntry(dom, "/kdevdebugger/general/runGdbScript", runGdbScript_edit   ->text());
00106 
00107     DomUtil::writeBoolEntry(dom, "/kdevdebugger/display/staticmembers", displayStaticMembers_box->isChecked());
00108     DomUtil::writeBoolEntry(dom, "/kdevdebugger/display/demanglenames", asmDemangle_box->isChecked());
00109     DomUtil::writeBoolEntry(dom, "/kdevdebugger/general/breakonloadinglibs", breakOnLoadingLibrary_box->isChecked());
00110     DomUtil::writeBoolEntry(dom, "/kdevdebugger/general/separatetty", dbgTerminal_box->isChecked());
00111     DomUtil::writeBoolEntry(dom, "/kdevdebugger/general/floatingtoolbar", enableFloatingToolBar_box->isChecked());
00112     
00113     int outputRadix;
00114     if (outputRadixOctal->isChecked())
00115       outputRadix = 8;
00116     else if (outputRadixHexadecimal->isChecked())
00117       outputRadix = 16;
00118     else
00119       outputRadix = 10;
00120       
00121    DomUtil::writeIntEntry(dom, "/kdevdebugger/display/outputradix", outputRadix);
00122 }
00123 
00124 }
00125 
00126 #include "debuggerconfigwidget.moc"
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:29 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003