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

« back to all changes in this revision

Viewing changes to languages/pascal/compiler/dccoptions/dccoptionsplugin.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2006-05-23 18:39:42 UTC
  • Revision ID: james.westby@ubuntu.com-20060523183942-hucifbvh68k2bwz7
Tags: upstream-3.3.2
Import upstream version 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2003 Alexander Dymo                                     *
 
3
 *   cloudtemple@mksat.net                                                 *
 
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
#include <qvbox.h>
 
12
#include <qdialog.h>
 
13
 
 
14
#include <kdebug.h>
 
15
#include <klocale.h>
 
16
#include <kgenericfactory.h>
 
17
 
 
18
#include "dccoptionsplugin.h"
 
19
 
 
20
#include "optiontabs.h"
 
21
 
 
22
K_EXPORT_COMPONENT_FACTORY( libkdevdccoptions, KGenericFactory<DccOptionsPlugin>( "kdevdccoptions" ) )
 
23
 
 
24
DccOptionsPlugin::DccOptionsPlugin(QObject *parent, const char *name, const QStringList/* &args*/)
 
25
    : KDevCompilerOptions(parent, name)
 
26
{
 
27
}
 
28
 
 
29
DccOptionsPlugin::~DccOptionsPlugin()
 
30
{
 
31
}
 
32
 
 
33
QString DccOptionsPlugin::exec(QWidget *parent, const QString &flags)
 
34
{
 
35
    DccOptionsDialog *dlg = new DccOptionsDialog(parent, "dcc options dialog");
 
36
    QString newFlags = flags;
 
37
    dlg->setFlags(flags);
 
38
    if(dlg->exec() == QDialog::Accepted)
 
39
        newFlags = dlg->flags();
 
40
    delete dlg;
 
41
    return newFlags;
 
42
}
 
43
 
 
44
 
 
45
DccOptionsDialog::DccOptionsDialog( QWidget * parent, const char * name )
 
46
    : KDialogBase(Tabbed, i18n("Delphi Compiler Options"), Ok|Cancel, Ok, parent, name, true)
 
47
{
 
48
    QVBox *vbox;
 
49
 
 
50
    vbox = addVBoxPage(i18n("General"));
 
51
    general = new GeneralTab(vbox, "general tab");
 
52
 
 
53
    vbox = addVBoxPage(i18n("Locations I"));
 
54
    locations = new LocationsTab(vbox, "locations tab");
 
55
 
 
56
    vbox = addVBoxPage(i18n("Locations II"));
 
57
    locations2 = new Locations2Tab(vbox, "locations2 tab");
 
58
 
 
59
    vbox = addVBoxPage(i18n("Code Generation"));
 
60
    codegen = new CodegenTab(vbox, "codegen tab");
 
61
 
 
62
    vbox = addVBoxPage(i18n("Debug && Optimization"));
 
63
    debug_optim = new DebugOptimTab(vbox, "debug and optim tab");
 
64
 
 
65
    vbox = addVBoxPage(i18n("Linker"));
 
66
    linker = new LinkerTab(vbox, "linker tab");
 
67
}
 
68
 
 
69
DccOptionsDialog::~DccOptionsDialog( )
 
70
{
 
71
}
 
72
 
 
73
void DccOptionsDialog::setFlags( const QString & flags )
 
74
{
 
75
    QStringList flaglist = QStringList::split(" ", flags);
 
76
 
 
77
    general->readFlags(&flaglist);
 
78
    codegen->readFlags(&flaglist);
 
79
    debug_optim->readFlags(&flaglist);
 
80
    locations->readFlags(&flaglist);
 
81
    locations2->readFlags(&flaglist);
 
82
    linker->readFlags(&flaglist);
 
83
 
 
84
    unrecognizedFlags = flaglist;
 
85
}
 
86
 
 
87
QString DccOptionsDialog::flags( ) const
 
88
{
 
89
    QStringList flaglist;
 
90
 
 
91
    general->writeFlags(&flaglist);
 
92
    locations->writeFlags(&flaglist);
 
93
    locations2->writeFlags(&flaglist);
 
94
    codegen->writeFlags(&flaglist);
 
95
    debug_optim->writeFlags(&flaglist);
 
96
    linker->writeFlags(&flaglist);
 
97
 
 
98
    QString flags;
 
99
    QStringList::ConstIterator li;
 
100
    for (li = flaglist.begin(); li != flaglist.end(); ++li) {
 
101
        flags += (*li);
 
102
        flags += " ";
 
103
    }
 
104
 
 
105
    for (li = unrecognizedFlags.begin(); li != unrecognizedFlags.end(); ++li) {
 
106
        flags += (*li);
 
107
        flags += " ";
 
108
    }
 
109
 
 
110
    flags.truncate(flags.length()-1);
 
111
    return flags;
 
112
}
 
113
 
 
114
#include "dccoptionsplugin.moc"