Example #1
0
int main(int argc, char **argv) {
	if (argc != 3) {
		fprintf(stderr, "Usage: %s <NE file> <output directory>\n",
				argv[0]);
		return 1;
	}
	outDir = argv[2];
	readFile = fopen(argv[1], "rb");
	// XXX: 0x250 offset is currently hardcoded, should be reading the real
	// windows header offset...
	fseek(readFile, 0x250 + 0x24, SEEK_SET);
	fread(&segmentOffset, 2, 1, readFile);
	segmentOffset += 0x250;
	fseek(readFile, segmentOffset, SEEK_SET);
	u16 alignShift;
	fread(&alignShift, 2, 1, readFile);
	sizeShift = 1 << alignShift;

	TYPEINFO *t;
	while (1) {
		t = readTypeInfo();
		if (t->rtTypeID == 0)
			break;
		dumpTypeInfo(t);
		free(t->rtNameInfo);
		free(t);
	}
	free(t->rtNameInfo);
	free(t);
}
Example #2
0
CreatModel::CreatModel(QWidget* parent)
: QDialog(parent), m_flag(0), m_infos(new QStandardItemModel),m_flagName("")
{ 
	this->setFixedSize(572, 554);
	//this->resize(572, 580);
	QPixmap iconImg(QDir::currentPath() +"/image/model.png");
	QIcon icon(iconImg);
	this->setWindowIcon(icon);
	this->setWindowTitle("模型管理封装工具");

	menuBar = new QMenuBar(this);
	QMenu* menuStart = menuBar->addMenu("开始");
	QAction* actionNew = menuStart->addAction("新建");
	actionNew->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
	QAction* actionOpen = menuStart->addAction("打开");
	actionOpen->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
	QAction* actionSave = menuStart->addAction("保存");
	actionSave->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
	QAction* actionSaveAs = menuStart->addAction("另存为...");
	QAction* actionExit = menuStart->addAction("退出(Exit)");
	QMenu* menuHelp = menuBar->addMenu("帮助");

	//connect(actionSave, SIGNAL(triggered()), this, SLOT(OnSave()));
	//connect(actionSaveAs, SIGNAL(triggered()), this, SLOT(OnSaveAs()));
	//connect(actionNew, SIGNAL(triggered()), this, SLOT(OnNew()));
	//connect(actionOpen, SIGNAL(triggered()), this, SLOT(OnOpen()));
	//connect(actionExit, SIGNAL(triggered()), this, SLOT(OnQuit()));

	//btn_new = new QPushButton(this);
	//btn_new->setGeometry(QRect(19, 10, 50, 20));
	//btn_new->setIcon(QIcon("image/new.png"));
	//btn_new->setText("新建");
	//btn_new->setFlat(true);

	//btn_open = new QPushButton(this);
	//btn_open->setGeometry(QRect(90, 10, 50, 20));
	//btn_open->setIcon(QIcon("image/open.png"));
	//btn_open->setText("打开");
	//btn_open->setFlat(true);

	//btn_save = new QPushButton(this);
	//btn_save->setGeometry(QRect(160, 10, 50, 20));
	//btn_save->setIcon(QIcon("image/save.png"));
	//btn_save->setText("保存");
	//btn_save->setFlat(true);

	//btn_saveAs = new QPushButton(this);
	//btn_saveAs->setGeometry(QRect(230, 10, 65, 20));
	//btn_saveAs->setIcon(QIcon("image/saveAs.png"));
	//btn_saveAs->setText("另存为");
	//btn_saveAs->setFlat(true);

	//lb_filePath = new QLabel(this);
	//lb_filePath->setGeometry(QRect(20, 29,520 , 36));

	//connect(btn_save, SIGNAL(clicked()), this, SLOT(OnSave()));
	//connect(btn_saveAs, SIGNAL(clicked()), this, SLOT(OnSaveAs()));
	//connect(btn_new, SIGNAL(clicked()), this, SLOT(OnNew()));
	//connect(btn_open, SIGNAL(clicked()), this, SLOT(OnOpen()));
	
	gb_modelInfo = new QGroupBox(this);
	gb_modelInfo->setGeometry(QRect(9, 70, 551, 226));

	lb_modelName = new QLabel(gb_modelInfo);
	lb_modelName->setGeometry(QRect(10, 22, 60, 16));
	ledit_modelName = new QLineEdit(gb_modelInfo);
	ledit_modelName->setGeometry(QRect(76, 22, 161, 20));

	lb_modelId = new QLabel(gb_modelInfo);
	lb_modelId->setGeometry(QRect(299, 22, 48, 16));
	ledit_modelId = new QLineEdit(gb_modelInfo);
	ledit_modelId->setGeometry(QRect(365, 22, 161, 20));
	ledit_modelId->setEnabled(false);

	lb_version = new QLabel(gb_modelInfo);
	lb_version->setGeometry(QRect(10, 48, 48, 16));
	ledit_version = new QLineEdit(gb_modelInfo);
	ledit_version->setGeometry(QRect(76, 48, 161, 20));
	ledit_version->setEnabled(false);

	lb_subject = new QLabel(gb_modelInfo);
	lb_subject->setGeometry(QRect(299, 48, 60, 16));
	ledit_subject = new QLineEdit(gb_modelInfo);
	ledit_subject->setGeometry(QRect(365, 48, 161, 20));

	lb_type = new QLabel(gb_modelInfo);
	lb_type->setGeometry(QRect(10, 74, 60, 16));
	combox_type = new QComboBox(gb_modelInfo);
	combox_type->setGeometry(QRect(76, 74, 161, 20));
	readTypeInfo();
	combox_type->addItems(m_typeList);

	lb_property = new QLabel(gb_modelInfo);
	lb_property->setGeometry(QRect(299, 74, 60, 16));
	combox_property = new QComboBox(gb_modelInfo);
	combox_property->setGeometry(QRect(365, 74, 161, 20));
	combox_property->addItems(m_propertyList);

	lb_group = new QLabel(gb_modelInfo);
	lb_group->setGeometry(QRect(10, 100, 60, 16));
	combox_group = new QComboBox(gb_modelInfo);
	combox_group->setGeometry(QRect(76, 100, 161, 20));
	readGroupInfo();
	combox_group->addItems(m_groupList);

	lb_descript = new QLabel(gb_modelInfo);
	lb_descript->setGeometry(QRect(10, 126, 60, 16));
	ledit_descript = new QLineEdit(gb_modelInfo);
	ledit_descript->setGeometry(QRect(76, 126, 450, 20));

	lb_log = new QLabel(gb_modelInfo);
	lb_log->setGeometry(QRect(10, 152, 60, 16));
	tedit_log = new QTextEdit(gb_modelInfo);
	tedit_log->setGeometry(QRect(76, 152, 450, 40));

	lb_author = new QLabel(gb_modelInfo);
	lb_author->setGeometry(QRect(299, 100, 60, 16));
	ledit_author = new QLineEdit(gb_modelInfo);
	ledit_author->setGeometry(QRect(365, 100, 161, 20));

	lb_update = new QLabel(gb_modelInfo);
	lb_update->setGeometry(QRect(10, 198, 60, 16));
	date_update = new QDateTimeEdit(QDate::currentDate(), gb_modelInfo);
	date_update->setDisplayFormat("yyyy-M-d");
	date_update->setGeometry(QRect(76, 198, 161, 20));
	date_update->setCalendarPopup(true);
	
	
	gb_fileInfo = new QGroupBox(this);
	gb_fileInfo->setGeometry(QRect(9, 310, 552, 266));
	gridLayout = new QGridLayout(gb_fileInfo);
	tv_fileInfo = new QTableView(gb_fileInfo);

	gridLayout->addWidget(tv_fileInfo, 0, 0, 1, 3);
	btn_add = new QPushButton(gb_fileInfo);

	gridLayout->addWidget(btn_add, 1, 1, 1, 1);
	btn_delete = new QPushButton(gb_fileInfo);
	btn_delete->setEnabled(false);
	
	gridLayout->addWidget(btn_delete, 1, 2, 1, 1);
	hSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
	gridLayout->addItem(hSpacer, 1, 0, 1, 1);

	gb_modelInfo->setTitle("模型信息");
	gb_fileInfo->setTitle("模型文件信息");
	lb_modelName->setText("模型名称");
	lb_modelId->setText("模型id");
	lb_version->setText("版本号");
	lb_subject->setText("学科信息");
	lb_type->setText("型号");
	lb_property->setText("模型属性");
	lb_group->setText("模型分类");
	lb_descript->setText("模型描述");
	lb_log->setText("日志信息");
	lb_author->setText("创建者");
	lb_update->setText("更新日期");
	btn_add->setText("添加文件");
	btn_delete->setText("删除文件");

	QStandardItemModel *fileInfo = new QStandardItemModel();
	tbViewInit(fileInfo);
	tv_fileInfo->setModel(fileInfo);

	tv_fileInfo->horizontalHeader()->setStretchLastSection(true);
	tv_fileInfo->verticalHeader()->setHidden(true);
	tv_fileInfo->setSelectionBehavior(QAbstractItemView::SelectRows);

	//添加QTableView中的右键操作
	tv_fileInfo->setContextMenuPolicy(Qt::CustomContextMenu);
	connect(tv_fileInfo, SIGNAL(customContextMenuRequested(const QPoint&)), 
		this, SLOT(showContextMenu(const QPoint&)));

	menu_right = new QMenu(tv_fileInfo);
	QAction *actionDelete = menu_right->addAction("删除");
	connect(actionDelete, SIGNAL(triggered()), this, SLOT(OnDelete()));

	connect(btn_add, SIGNAL(clicked()), this, SLOT(OnAppend()));
	connect(btn_delete, SIGNAL(clicked()) ,this, SLOT(OnDelete()));

}