diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /embedded/visualboyadvance/visualboyadvance_part.cpp | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'embedded/visualboyadvance/visualboyadvance_part.cpp')
-rw-r--r-- | embedded/visualboyadvance/visualboyadvance_part.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/embedded/visualboyadvance/visualboyadvance_part.cpp b/embedded/visualboyadvance/visualboyadvance_part.cpp new file mode 100644 index 00000000..ad434b43 --- /dev/null +++ b/embedded/visualboyadvance/visualboyadvance_part.cpp @@ -0,0 +1,77 @@ +#include "visualboyadvance_part.h" + +#include <qvbox.h> +#include <qwhatsthis.h> + +#include <kaction.h> +#include <kdevgenericfactory.h> +#include <kiconloader.h> +#include <klocale.h> + +#include "kdevcore.h" +#include "kdevproject.h" +#include "kdevappfrontend.h" +#include "domutil.h" +#include "kdevplugininfo.h" + +#include "vbaconfigwidget.h" + + +using namespace VisualBoyAdvance; + +typedef KDevGenericFactory<VisualBoyAdvancePart> VisualBoyAdvanceFactory; +static const KDevPluginInfo data("kdevvisualboyadvance"); +K_EXPORT_COMPONENT_FACTORY( libkdevvisualboyadvance, VisualBoyAdvanceFactory( data ) ) + +VisualBoyAdvancePart::VisualBoyAdvancePart(QObject *parent, const char *name, const QStringList &) + : KDevPlugin(&data, parent, name){ + setInstance(VisualBoyAdvanceFactory::instance()); + + setXMLFile("kdevpart_visualboyadvance.rc"); + + KAction *action; + action = new KAction( i18n("Execute Program"), "exec", Key_F9, + this, SLOT(slotExecute()), + actionCollection(), "build_execute" ); + + connect( core(), SIGNAL(projectConfigWidget(KDialogBase*)), + this, SLOT(projectConfigWidget(KDialogBase*)) ); +} + + +VisualBoyAdvancePart::~VisualBoyAdvancePart() +{ + +} +void VisualBoyAdvancePart::slotExecute(){ + KDevProject* prj = project(); + QDomDocument &doc = *projectDom(); + QString binary = DomUtil::readEntry(doc, "/kdevvisualadvance/binary"); + QString emulator = DomUtil::readEntry(doc, "/kdevvisualadvance/emulator"); + QString graphicFilter = DomUtil::readEntry(doc, "/kdevvisualadvance/graphicFilter"); + QString scaling = DomUtil::readEntry(doc, "/kdevvisualadvance/scaling"); + QString addOptions = DomUtil::readEntry(doc, "/kdevvisualadvance/addOptions"); + bool terminal = DomUtil::readBoolEntry(doc, "/kdevvisualadvance/terminal"); + bool fullscreen = DomUtil::readBoolEntry(doc, "/kdevvisualadvance/fullscreen"); + + if(emulator.isNull()) emulator = "VisualBoyAdvance"; + QString program = emulator + " " + graphicFilter +" " + scaling + " " + addOptions +" "; + if(fullscreen){ + program += "-F "; + } + + program += prj->projectDirectory() + "/" + binary; + + if (KDevAppFrontend *appFrontend = extension<KDevAppFrontend>("KDevelop/AppFrontend")) + appFrontend->startAppCommand(QString::QString(), program, terminal); +} + +void VisualBoyAdvancePart::projectConfigWidget(KDialogBase *dlg){ + QVBox *vbox; + vbox = dlg->addVBoxPage(i18n("Run Options"), i18n("Run Options"), BarIcon( "make", KIcon::SizeMedium )); + VBAConfigWidget* w = new VBAConfigWidget(this,vbox); + connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) ); +} + + +#include "visualboyadvance_part.moc" |