KDevelop API Documentation

dccoptionsplugin.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2003 Alexander Dymo                                     *
00003  *   cloudtemple@mksat.net                                                 *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  ***************************************************************************/
00011 #include <qvbox.h>
00012 #include <qdialog.h>
00013 
00014 #include <kdebug.h>
00015 #include <klocale.h>
00016 #include <kgenericfactory.h>
00017 
00018 #include "dccoptionsplugin.h"
00019 
00020 #include "optiontabs.h"
00021 
00022 K_EXPORT_COMPONENT_FACTORY( libkdevdccoptions, KGenericFactory<DccOptionsPlugin>( "kdevdccoptions" ) )
00023 
00024 DccOptionsPlugin::DccOptionsPlugin(QObject *parent, const char *name, const QStringList/* &args*/)
00025     : KDevCompilerOptions(parent, name)
00026 {
00027 }
00028 
00029 DccOptionsPlugin::~DccOptionsPlugin()
00030 {
00031 }
00032 
00033 QString DccOptionsPlugin::exec(QWidget *parent, const QString &flags)
00034 {
00035     DccOptionsDialog *dlg = new DccOptionsDialog(parent, "dcc options dialog");
00036     QString newFlags = flags;
00037     dlg->setFlags(flags);
00038     if(dlg->exec() == QDialog::Accepted)
00039         newFlags = dlg->flags();
00040     delete dlg;
00041     return newFlags;
00042 }
00043 
00044 
00045 DccOptionsDialog::DccOptionsDialog( QWidget * parent, const char * name )
00046     : KDialogBase(Tabbed, i18n("Delphi Compiler Options"), Ok|Cancel, Ok, parent, name, true)
00047 {
00048     QVBox *vbox;
00049 
00050     vbox = addVBoxPage(i18n("General"));
00051     general = new GeneralTab(vbox, "general tab");
00052 
00053     vbox = addVBoxPage(i18n("Locations I"));
00054     locations = new LocationsTab(vbox, "locations tab");
00055 
00056     vbox = addVBoxPage(i18n("Locations II"));
00057     locations2 = new Locations2Tab(vbox, "locations2 tab");
00058 
00059     vbox = addVBoxPage(i18n("Code Generation"));
00060     codegen = new CodegenTab(vbox, "codegen tab");
00061 
00062     vbox = addVBoxPage(i18n("Debug && Optimization"));
00063     debug_optim = new DebugOptimTab(vbox, "debug and optim tab");
00064 
00065     vbox = addVBoxPage(i18n("Linker"));
00066     linker = new LinkerTab(vbox, "linker tab");
00067 }
00068 
00069 DccOptionsDialog::~DccOptionsDialog( )
00070 {
00071 }
00072 
00073 void DccOptionsDialog::setFlags( const QString & flags )
00074 {
00075     QStringList flaglist = QStringList::split(" ", flags);
00076 
00077     general->readFlags(&flaglist);
00078     codegen->readFlags(&flaglist);
00079     debug_optim->readFlags(&flaglist);
00080     locations->readFlags(&flaglist);
00081     locations2->readFlags(&flaglist);
00082     linker->readFlags(&flaglist);
00083 
00084     unrecognizedFlags = flaglist;
00085 }
00086 
00087 QString DccOptionsDialog::flags( ) const
00088 {
00089     QStringList flaglist;
00090 
00091     general->writeFlags(&flaglist);
00092     locations->writeFlags(&flaglist);
00093     locations2->writeFlags(&flaglist);
00094     codegen->writeFlags(&flaglist);
00095     debug_optim->writeFlags(&flaglist);
00096     linker->writeFlags(&flaglist);
00097 
00098     QString flags;
00099     QStringList::ConstIterator li;
00100     for (li = flaglist.begin(); li != flaglist.end(); ++li) {
00101         flags += (*li);
00102         flags += " ";
00103     }
00104 
00105     for (li = unrecognizedFlags.begin(); li != unrecognizedFlags.end(); ++li) {
00106         flags += (*li);
00107         flags += " ";
00108     }
00109 
00110     flags.truncate(flags.length()-1);
00111     return flags;
00112 }
00113 
00114 #include "dccoptionsplugin.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 Wed Mar 23 00:03:48 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003