fpcoptionsplugin.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <qvbox.h>
00012
00013 #include <klocale.h>
00014 #include <kgenericfactory.h>
00015
00016 #include "optiontabs.h"
00017 #include "fpcoptionsplugin.h"
00018
00019 K_EXPORT_COMPONENT_FACTORY( libkdevfpcoptions, KGenericFactory<FpcOptionsPlugin>( "kdevfpcoptions" ) )
00020
00021 FpcOptionsPlugin::FpcOptionsPlugin(QObject *parent, const char *name, const QStringList& )
00022 : KDevCompilerOptions(parent, name)
00023 {
00024 }
00025
00026 FpcOptionsPlugin::~FpcOptionsPlugin()
00027 {
00028 }
00029
00030 QString FpcOptionsPlugin::exec(QWidget *parent, const QString &flags)
00031 {
00032 FpcOptionsDialog *dlg = new FpcOptionsDialog(parent, "fpc options dialog");
00033 QString newFlags = flags;
00034 dlg->setFlags(flags);
00035 if (dlg->exec() == QDialog::Accepted)
00036 newFlags = dlg->flags();
00037 delete dlg;
00038 return newFlags;
00039 }
00040
00041
00042
00043 FpcOptionsDialog::FpcOptionsDialog( QWidget *parent, const char *name )
00044 : KDialogBase(Tabbed, i18n("Free Pascal Compiler Options"), Ok|Cancel, Ok, parent, name, true)
00045 {
00046 QVBox *vbox;
00047
00048 vbox = addVBoxPage(i18n("Language"));
00049 language = new LanguageTab(vbox, "language tab");
00050
00051 vbox = addVBoxPage(i18n("Locations I"));
00052 directories = new FilesAndDirectoriesTab(vbox, "directories tab");
00053
00054 vbox = addVBoxPage(i18n("Locations II"));
00055 directories2 = new FilesAndDirectoriesTab2(vbox, "directories2 tab");
00056
00057 vbox = addVBoxPage(i18n("Debug && Optimization"));
00058 debug_optim = new DebugOptimTab(vbox, "debug_optim tab");
00059
00060 vbox = addVBoxPage(i18n("Code Generation"));
00061 codegen = new CodegenTab(vbox, "codegen tab");
00062
00063 vbox = addVBoxPage(i18n("Assembler"));
00064 assembler = new AssemblerTab(vbox, "assembler tab");
00065
00066 vbox = addVBoxPage(i18n("Linker"));
00067 linker = new LinkerTab(vbox, "linker tab");
00068
00069 vbox = addVBoxPage(i18n("Feedback"));
00070 feedback = new FeedbackTab(vbox, "feedback tab");
00071
00072 vbox = addVBoxPage(i18n("Miscellaneous"));
00073 misc = new MiscTab(vbox, "miscellaneous tab");
00074 }
00075
00076 FpcOptionsDialog::~FpcOptionsDialog()
00077 {
00078 }
00079
00080 void FpcOptionsDialog::setFlags(const QString &flags)
00081 {
00082 QStringList flaglist = QStringList::split(" ", flags);
00083
00084 feedback->readFlags(&flaglist);
00085 language->readFlags(&flaglist);
00086 assembler->readFlags(&flaglist);
00087 linker->readFlags(&flaglist);
00088 codegen->readFlags(&flaglist);
00089 debug_optim->readFlags(&flaglist);
00090 directories->readFlags(&flaglist);
00091 directories2->readFlags(&flaglist);
00092 misc->readFlags(&flaglist);
00093 unrecognizedFlags = flaglist;
00094 }
00095
00096 QString FpcOptionsDialog::flags() const
00097 {
00098 QStringList flaglist;
00099
00100 language->writeFlags(&flaglist);
00101 directories->writeFlags(&flaglist);
00102 directories2->writeFlags(&flaglist);
00103 debug_optim->writeFlags(&flaglist);
00104 codegen->writeFlags(&flaglist);
00105 assembler->writeFlags(&flaglist);
00106 linker->writeFlags(&flaglist);
00107 feedback->writeFlags(&flaglist);
00108 misc->writeFlags(&flaglist);
00109
00110 QString flags;
00111 QStringList::ConstIterator li;
00112 for (li = flaglist.begin(); li != flaglist.end(); ++li) {
00113 flags += (*li);
00114 flags += " ";
00115 }
00116
00117 for (li = unrecognizedFlags.begin(); li != unrecognizedFlags.end(); ++li) {
00118 flags += (*li);
00119 flags += " ";
00120 }
00121
00122 flags.truncate(flags.length()-1);
00123 return flags;
00124 }
00125
00126 #include "fpcoptionsplugin.moc"
This file is part of the documentation for KDevelop Version 3.1.2.