Fix command queue stepping.

Also add instanceDescription to Command class to allow for more verbose command information reporting
This commit is contained in:
nemerle 2016-05-01 18:45:22 +02:00
parent 0391f67109
commit 60a4fefe95
4 changed files with 12 additions and 2 deletions

View File

@ -33,6 +33,7 @@ class Command
public: public:
Command(QString n,CommandLevel level) : m_command_name(n),m_level(level) {} Command(QString n,CommandLevel level) : m_command_name(n),m_level(level) {}
QString name() const { return m_command_name;} QString name() const { return m_command_name;}
virtual QString instanceDescription() const { return m_command_name; }
virtual bool execute(CommandContext *) { return false; } virtual bool execute(CommandContext *) { return false; }
}; };
class CompoundCommand : public Command { class CompoundCommand : public Command {

View File

@ -34,6 +34,12 @@ void CommandQueueView::onCommandListChanged() {
ui->lstQueuedCommands->clear(); ui->lstQueuedCommands->clear();
const CommandStream& cs(project.m_project_command_stream); const CommandStream& cs(project.m_project_command_stream);
for(const Command * cmd : cs.m_commands) { for(const Command * cmd : cs.m_commands) {
ui->lstQueuedCommands->addItem(cmd->name()); ui->lstQueuedCommands->addItem(cmd->instanceDescription());
} }
} }
void CommandQueueView::on_btnStep_clicked()
{
Project &project(*Project::get());
project.processCommands(1);
}

View File

@ -21,6 +21,9 @@ public slots:
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
private slots:
void on_btnStep_clicked();
private: private:
Ui::CommandQueueView *ui; Ui::CommandQueueView *ui;
}; };

View File

@ -19,7 +19,7 @@
<widget class="QListWidget" name="lstQueuedCommands"/> <widget class="QListWidget" name="lstQueuedCommands"/>
</item> </item>
<item> <item>
<widget class="QPushButton" name="pushButton"> <widget class="QPushButton" name="btnStep">
<property name="text"> <property name="text">
<string>Step</string> <string>Step</string>
</property> </property>