sendstate.cpp

来自「robocuo相关资料robocuo相关资料」· C++ 代码 · 共 44 行

CPP
44
字号
#include <QTextStream>#include "SendState.h"#include "ui_SendState.h"#include "../common.h"#include "ActionWindow.h"#include <fcntl.h>#include <stddef.h>#include <stdio.h> #include <dirent.h>#include <sstream>using namespace std;SendState::SendState(ActionWindow *a,int *p){	ui = new Ui_SendState;	ui->setupUi(this);	pipe = p;	parent = a;}void SendState::on_send_clicked(){	if(*pipe == 0)		*pipe=open("/tmp/trainer_pipe", O_RDWR | O_NONBLOCK);	ostringstream oss;	action *a = new action, *act=parent->act;	for(int i = ui->from->value(); i<=ui->to->value(); i++)		a->arr.push_back(act->arr[i]);	a->repeat = act->repeat - ui->from->value();	if(a->repeat < 0)		a->repeat = 0;	a->save(oss);	a->name = act->name;	string s=oss.str();	write(*pipe, s.c_str(), s.length());}void SendState::on_from_valueChanged(int a){	ui->to->setMinimum(a);	if(ui->to->value() < a)		ui->to->setValue(a);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?