本文整理汇总了C++中CNotify类的典型用法代码示例。如果您正苦于以下问题:C++ CNotify类的具体用法?C++ CNotify怎么用?C++ CNotify使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CNotify类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: link
void CFileBrowser::formatFilesystem(void){
QString filename;
struct link_stat st;
int err;
int fmt;
QTreeWidgetItem* item;
CNotify notify;
item = ui->tree->currentItem();
filename = item->text(1);
//check to see if this is a directory or a file
err = link()->stat( item->text(1).toLocal8Bit().constData(),
&st);
if ( err < 0 ){
qDebug("Stat failed");
notify.execLinkError(link_errno);
return;
}
fmt = st.st_mode & LINK_S_IFMT;
switch(fmt){
case LINK_S_IFDIR:
err = link()->format(filename.toLocal8Bit().constData());
break;
default:
qDebug("Unknown file type");
break;
}
if ( err ){
notify.execLinkError(link_errno);
}
this->refresh();
CNotify::updateStatus("Formatted " + filename);
}
示例2: refresh
void CFileBrowser::refresh(void){
//Update the tree
CNotify notify;
if ( link()->get_is_connected() == false ){
//Error::showNotConnected();
return;
}
ui->tree->clear();
topItem = new QTreeWidgetItem();
if ( topItem == NULL ){
notify.execError("Top Item is NULL");
return;
}
if ( ui->gotoLine->text() == "" ){
//Goto to "/" as the default directory
ui->gotoLine->setText("/");
}
topItem->setText(0, ui->gotoLine->text() );
topItem->setText(1, ui->gotoLine->text() );
topItem->setText(2, "false" );
ui->tree->addTopLevelItem(topItem);
ui->tree->setCurrentItem(topItem, 0);
loadDirectory(topItem);
}
示例3: signalProcess
int Monitor::signalProcess(int signo){
int row;
int pid;
int err;
QTableWidgetItem * item;
CNotify notify;
if ( link()->isConnected() == false ){
notify.execNotConnected();
return -1;
}
row = ui->table->currentRow();
if ( row != 0 ){
item = ui->table->item(row, PROCESS_ID_COL);
if ( item == NULL ){
return -1;
}
pid = item->text().replace(" (thread)", "").toInt();
if( pid != 0 ){
if ( (err = link()->kill_pid(pid, signo)) < 0 ){
notify.execError(errorMessage());
} else {
ui->table->removeRow(row);
}
}
}
return 0;
}
示例4: while
void * ThreadPool::work(void *p)
{
ThreadPool* pool = (ThreadPool*)p;
int fd = 0;
while(1)
{cout << "test\n";
fd = 0;
while(!fd)
{
cout << "pth_id" << pthread_self() << endl;
fd = pool->m_socketList.pop();
}
//接收请求
CSockApi cs(fd);
CNotify notify;
cs.receive_notify(notify);
studentInfo stu;
stu = *(studentInfo*)notify.get_data(&stu);
LOG_DEBUG("sockid:%d",fd);
LOG_ERROR("id:%d\nname:%s",stu.m_id,stu.m_name);
//SQL sql;
//sql.Connect();
sleep(2);
//sql.Insert(buf+16);
}
return pool;
}//线程函数
示例5: runApp
void CFileBrowser::runApp(void){
struct link_stat st;
int err;
CNotify notify;
QTreeWidgetItem* item;
item = ui->tree->currentItem();
if( item == 0 ){
notify.execError("Invalid Selection");
return;
}
err = link()->stat( item->text(1).toLocal8Bit().constData(),
&st);
if ( err < 0 ){
notify.execLinkError(link_errno);
return;
}
if ( (st.st_mode & LINK_S_IFMT) != LINK_S_IFREG ){
notify.execError("File is not executable");
return;
}
if( st.st_mode & (LINK_S_IXGRP|LINK_S_IXOTH|LINK_S_IXUSR) ){
//Execute a program on the target device
emit runApplication( ui->tree->currentItem()->text(1) );
} else {
notify.execError("File is not executable");
}
}
示例6: on_downloadButton_clicked
void CFileBrowser::on_downloadButton_clicked(){
CNotify notify;
if( topItem != 0 ){
this->saveFileToDevice();
} else {
notify.execInfo("No Target Folder Selected");
}
}
示例7: on_uploadButton_clicked
void CFileBrowser::on_uploadButton_clicked(){
CNotify notify;
if( topItem != 0 ){
this->loadFileFromDevice();
} else {
notify.execInfo("No Source File Selected");
}
}
示例8: on_deleteButton_clicked
void CFileBrowser::on_deleteButton_clicked(){
CNotify notify;
if( topItem != 0 ){
this->deleteFile();
} else {
notify.execInfo("No File Selected");
}
}
示例9: receive_notify
int CSockApi::receive_notify(CNotify& pNotify)
{
readN((char*)&pNotify,16);
pNotify.n2h();
pNotify.resize(pNotify.get_len());
char *pdata = pNotify.get_data();
return readN(pdata,pNotify.get_len());
}
示例10: on_tree_itemActivated
void CFileBrowser::on_tree_itemActivated(QTreeWidgetItem* item, int column){
CNotify notify;
qDebug("item activated %s %s", item->text(0).toLocal8Bit().constData(), item->text(1).toLocal8Bit().constData());
if ( column != 0 ){
notify.execError("Invalid Column");
return;
}
loadDirectory(item);
item->setExpanded(true);
}
示例11: saveFileToDeviceSelected
void CFileBrowser::saveFileToDeviceSelected(QStringList filenames){
CNotify notify;
if( copyFilesToDevice(link(), filenames, ui->tree->currentItem()->text(1)) == false ){
notify.execLinkError(link_errno);
} else {
notify.updateStatus("File Saved");
refresh();
}
}
示例12: operationComplete
void CaosIsp::operationComplete(QString msg, bool err){
CNotify notify;
if ( err == true ){
notify.execError(msg);
} else if ( msg != "" ){
if ( currentMessage != "" ){
msg += ", " + currentMessage;
}
ui->statusBar->showMessage(" " + msg, 3000);
}
}
示例13: connect
void CApplicationInstaller::on_uninstallButton_clicked()
{
CNotify notify;
QString projectName = ui->installer->project();
int pid;
if( CNotify::notification() != 0 ){
if( (pid = link()->get_is_executing(projectName.toStdString())) >= 0 ){
connect(CNotify::notification(), SIGNAL(dismissed(int)), this, SLOT(uninstallPrompt(int)));
notify.execPrompt("Kill " + ui->installer->project() + "?");
return;
}
} else {
示例14: on_formatButton_clicked
void CFileBrowser::on_formatButton_clicked()
{
QString filename;
QTreeWidgetItem* item;
CNotify notify;
if( topItem != 0 ){
item = ui->tree->currentItem();
filename = item->text(1);
qDebug("format %s", filename.toLocal8Bit().constData());
link()->format(filename.toStdString());
this->refresh();
} else {
notify.execInfo("No Mount Selected to Format");
}
}
示例15: QMainWindow
/*! \details This is the main window constructor. It initializes the GUI as
* as well as the USB Link driver.
*
*
*/
Caoslink::Caoslink(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Caoslink)
{
CNotify notify;
notify.updateStatus("");
qDebug("CAOS Init");
CLink * linkDevice;
QCoreApplication::setOrganizationName("CoActionOS, Inc");
QCoreApplication::setOrganizationDomain("coactionos.com");
QCoreApplication::setApplicationName("CoActionOS Link");
QCoreApplication::setApplicationVersion(COACTIONOS_LINK_VERSION);
CFont::init();
link_set_debug(1);
ui->setupUi(this);
linkDevice = ui->connectWidget->clink();
ui->caosInterface->setLink(linkDevice);
ui->progressBar->setVisible(false);
//Connect link thread
connect(linkDevice, SIGNAL(reconnectSignal(bool)), ui->connectWidget, SLOT(connectRequested(bool)));
ui->connectWidget->setObjectName("connectWidget");
ui->statusBar->setObjectName("statusBar");
QFile file(":/data/CStyle.css");
if(file.open(QFile::ReadOnly)) {
QString StyleSheet = QLatin1String(file.readAll());
file.close();
#ifdef Q_WS_WIN
file.setFileName(":/data/CStyle-win32.css");
if( file.open(QFile::ReadOnly)){
StyleSheet += QLatin1String(file.readAll());
file.close();
}
#endif
qApp->setStyleSheet(StyleSheet);
}
CNotify::setUpdateObjects(ui->statusBar, ui->progressBar);
qDebug("CAOS Init Complete");
}