Commit bc77a6ec authored by Denis Khachko's avatar Denis Khachko

Grasshopper pult

parent f5544641
......@@ -8,7 +8,7 @@ You should change it corresponding to functionality.
// Self include
#include "grasshoppermodule.h"
#include "pult.h"
// Kumir includes
#include "extensionsystem/kplugin.h"
......@@ -21,7 +21,7 @@ namespace ActorGrasshopper {
GrasshopperModule::GrasshopperModule(ExtensionSystem::KPlugin * parent)
: GrasshopperModuleBase(parent)
{
kuznec=new KumKuznec();
kuznec=new KumKuznec(myResourcesDir());
// Module constructor, called once on plugin load
// TODO implement me
}
......@@ -75,7 +75,8 @@ GrasshopperModule::GrasshopperModule(ExtensionSystem::KPlugin * parent)
// NOTE: the method is const and might be called at any time,
// so DO NOT create widget here, just return!
// TODO implement me
return nullptr;
return kuznec->Kpult;
}
/* public slot */ void GrasshopperModule::reloadSettings(ExtensionSystem::SettingsPtr settings, const QStringList & keys)
......@@ -91,6 +92,7 @@ GrasshopperModule::GrasshopperModule(ExtensionSystem::KPlugin * parent)
{
// Resets module to initial state before program execution
// TODO implement me
kuznec->Reset();
}
/* public slot */ void GrasshopperModule::setAnimationEnabled(bool enabled)
......@@ -99,7 +101,7 @@ GrasshopperModule::GrasshopperModule(ExtensionSystem::KPlugin * parent)
// NOTE this method just setups a flag and might be called anytime, even module not needed
// TODO implement me
Q_UNUSED(enabled); // Remove this line on implementation
kuznec->Reset();
// kuznec->Reset();
}
/* public slot */ void GrasshopperModule::runGoForward(const int distance)
......
......@@ -181,7 +181,7 @@ void KumKuznec::resizeEvent ( QResizeEvent * event )
};
//-----------------------------------------------------
KumKuznec::KumKuznec()
KumKuznec::KumKuznec(QDir mresd)
{
autoClose=false;
......@@ -195,8 +195,9 @@ if (!QDir(curDir).exists()) {
}
curMode=4;
moving=false;
MV=new QMainWindow();
Kpult=new GrasshopperPult(mresd);
MV->setAttribute(Qt::WA_KeyboardFocusChange,false);
MV->setGeometry(10,10,500,500);
QIcon icon(":/grasshopper.png");
......
......@@ -128,7 +128,7 @@ class KumKuznec
public:
// * Конструктор
KumKuznec();
KumKuznec(QDir mresd);
void PenDown();
void PenUp();
int GoVector(double x,double y);
......
......@@ -361,7 +361,9 @@ QString text;
for(int i=0;i<lines.count();i++)if(!lines[i].KumCommand().isEmpty())text+=lines[i].KumCommand()+"\n";
cp->setText(text);
};
GrasshopperPult::GrasshopperPult ( QWidget* parent, Qt::WindowFlags fl )
GrasshopperPult::GrasshopperPult( QDir resdir,QWidget* parent, Qt::WindowFlags fl )
: QWidget ( parent, fl ), Ui::TurtlePult()
{
// setStyleSheet("background-color:#7EB676;");
......@@ -384,19 +386,19 @@ GrasshopperPult::GrasshopperPult ( QWidget* parent, Qt::WindowFlags fl )
LeftB->hide();
turnLeft=new MainButton(this);
turnLeft->setGeometry(LeftB->geometry());
turnLeft->loadIcon(":/160_55l.png");
turnLeft->loadIcon(resdir.absoluteFilePath("160_55l.png"));
// RightB->hide();
turnRight=new MainButton(this);
turnRight->setGeometry(RightB->geometry());
turnRight->loadIcon(":/160_55r.png");
turnRight->loadIcon(resdir.absoluteFilePath("160_55r.png"));
// StenaB->hide();
askStena=new MainButton(this);
// askStena->move(StenaB->pos());
askStena->setCheckable(true);
askStena->setText(trUtf8(" "));
askStena->loadIcon(":/icons/stena.png");
askStena->loadIcon(resdir.absoluteFilePath("stena.png"));
askStena->setCheckable(true);
askStena->hide();
// SvobodnoB->hide();
......@@ -412,7 +414,7 @@ GrasshopperPult::GrasshopperPult ( QWidget* parent, Qt::WindowFlags fl )
recolorB=new MainButton(this);
recolorB->setGeometry(colorB->geometry());
recolorB->setText(trUtf8(" "));
recolorB->loadIcon(":/recolor.png");
recolorB->loadIcon(resdir.absoluteFilePath("recolor.png"));
colorB->hide();
......
......@@ -260,7 +260,7 @@ class GrasshopperPult : public QWidget, public Ui::TurtlePult
* @param parent ссыка на объект-владелец
* @param fl флаги окна
*/
GrasshopperPult ( QWidget* parent = 0, Qt::WindowFlags fl = 0 );
GrasshopperPult (QDir resDir=QDir(), QWidget* parent = 0, Qt::WindowFlags fl = 0 );
/**
* Деструктор
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment