⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 custtooldlg.cpp

📁 Linux下的C、C++ IDE
💻 CPP
字号:
#include "custtooldlg.h"#include "custtoolmgr.h"#include "portdef.h"#include "addtooldlg.h"#include <qlayout.h>#include <qhbox.h>#include <qpushbutton.h>#include <qmessagebox.h>#include <cstdlib>CustToolDlg::CustToolDlg(QWidget *parent, CustToolMgr *pCTM)	: QDialog(parent, 0, true){	pCustToolMgr = pCTM;	QVBoxLayout *vbox = new QVBoxLayout(this);	vbox->setSpacing(5);	QHBox *hbox = new QHBox(this);	m_listTools = new QListView(this);	m_listTools->setSorting(-1);	m_listTools->addColumn("Tool", 100);	m_listTools->addColumn("Menu Alias", 100);	QListViewItem *item = NULL;	for (unsigned i=0; i < pCTM->getToolList()->count(); i++)	{		item = new QListViewItem(m_listTools, m_listTools->lastItem());		item->setText(0, (*pCTM->getToolList())[i]);		item->setText(1, (*pCTM->getAliasList())[i]);	}	QPushButton *add = new QPushButton("Add..", hbox);	QPushButton *rem = new QPushButton("Remove", hbox);	QPushButton *close = new QPushButton("Close", hbox);	vbox->addWidget(m_listTools);	vbox->addWidget(hbox);	setCaption("Custom Tool Settings");	QObject::connect(add, SIGNAL(clicked()), this, SLOT(onAddBttn()));	QObject::connect(rem, SIGNAL(clicked()), this, SLOT(onRemBttn()));	QObject::connect(close, SIGNAL(clicked()), this, SLOT(accept()));}int CustToolDlg::exec(){	return QDialog::exec();}void CustToolDlg::onAddBttn(){	AddToolDlg dlg(this);	if (m_listTools->childCount() == 8)	{		QMessageBox::information(this,			"Maximum Tools",			"No more custom tools can be added. The maximum has been reached.");		return;	}	if (dlg.exec() == QDialog::Accepted)	{		QListViewItem *item = 			new QListViewItem(m_listTools, m_listTools->lastItem());		QString path = (QString)			getenv("HOME") + FILE_SEP + ".hide" + FILE_SEP + 			"conf" + FILE_SEP + "custtools";		item->setText(0, dlg.m_editTool->text());		item->setText(1, dlg.m_editAlias->text());		pCustToolMgr->add(dlg.m_editTool->text(), dlg.m_editAlias->text());		pCustToolMgr->save(path);	}}void CustToolDlg::onRemBttn(){	QListViewItem *item = m_listTools->currentItem();		if (item)	{		QString path = (QString)			getenv("HIDEPATH") + FILE_SEP + 			"conf" + FILE_SEP + "custtools";		pCustToolMgr->remove(item->text(0));		pCustToolMgr->save(path);		m_listTools->takeItem(item);	}}

⌨️ 快捷键说明

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