int Widget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: mySignal(); break; case 1: on_toolButton_List_clicked((*reinterpret_cast< bool(*)>(_a[1]))); break; case 2: tableWidget_cellDoubleClicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 3: on_toolButton_lrcD_clicked((*reinterpret_cast< bool(*)>(_a[1]))); break; case 4: on_toolButton_next_clicked(); break; case 5: on_toolButton_stop_clicked(); break; case 6: on_toolButton_playpause_clicked(); break; case 7: on_toolButton_previous_clicked(); break; case 8: on_toolButton_open_clicked(); break; case 9: showTime((*reinterpret_cast< qint64(*)>(_a[1]))); break; case 10: Timeout(); break; case 11: musicInformationStateChanged((*reinterpret_cast< Phonon::State(*)>(_a[1])),(*reinterpret_cast< Phonon::State(*)>(_a[2]))); break; case 12: mediaObjectStateChanged((*reinterpret_cast< Phonon::State(*)>(_a[1])),(*reinterpret_cast< Phonon::State(*)>(_a[2]))); break; case 13: musicAboutToFinish(); break; case 14: currentMusicSourceChanged((*reinterpret_cast< Phonon::MediaSource(*)>(_a[1]))); break; case 15: removeSlot(); break; case 16: exitSlot(); break; case 17: iconActivated((*reinterpret_cast< QSystemTrayIcon::ActivationReason(*)>(_a[1]))); break; default: ; } _id -= 18; } return _id; }
UpdaterDialog::UpdaterDialog(bool fbMess) : QDialog() { feedbackMessage=fbMess; stateUpdate=0; ui.setupUi(this); setWindowFlags(Qt::WindowCloseButtonHint|Qt::WindowStaysOnTopHint); httpGet=new QHttp("raw.github.com",QHttp::ConnectionModeHttps,443,this); timeOutTimer=new QTimer(this); connect(timeOutTimer,SIGNAL(timeout()),this,SLOT(exitSlot())); connect(httpGet,SIGNAL(done(bool)),this,SLOT(httpDone(bool))); httpGet->get("/JulyIGHOR/QtBitcoinTrader/master/versions.txt"); timeOutTimer->start(30000); }
void Tray::createContextMenu () { menu = new QMenu(); exitAction = new QAction( tr("退出"),this ); showDlgAction = new QAction( tr("显示查找对话框"),this ); connect( exitAction,SIGNAL(triggered()),this,SLOT(exitSlot()) ); connect( showDlgAction,SIGNAL(triggered()),this,SLOT(showDlgSlot()) ); menu->addAction(showDlgAction); menu->addAction(exitAction); setContextMenu(menu); }
void MainWindow::closeEvent(QCloseEvent *) { exitSlot(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { m_item1=0; ui->setupUi(this); readSettings(); QString title=QString(APP_NAME); setWindowTitle(title); // The engine m_engine= new slideShowEngine; if(m_engine==0) { qDebug() << "error while creating the engine"; return; } // The Model m_sequence = new sequenceModel; if(m_sequence==0) { qDebug() << "error while creating the Model"; return; } connect(m_sequence,SIGNAL(dataChanged (QModelIndex,QModelIndex)),this,SLOT(modelChanged(QModelIndex,QModelIndex))); ui->listView->setModel(m_sequence); ui->listView->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->listView,SIGNAL(clicked(QModelIndex)),this,SLOT(listClicked(QModelIndex))); connect(ui->listView,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(listDoubleClicked(QModelIndex))); connect(ui->actionNew,SIGNAL(triggered()),this,SLOT(fileNewSlot())); connect(ui->actionOpen,SIGNAL(triggered()),this,SLOT(fileOpenSlot())); connect(ui->actionClose,SIGNAL(triggered()),this,SLOT(fileCloseSlot())); connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(fileSaveSlot())); connect(ui->actionSave_As,SIGNAL(triggered()),this,SLOT(fileSaveAsSlot())); connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(exitSlot())); connect(ui->actionExport,SIGNAL(triggered()),this,SLOT(exportToMovie())); connect(ui->actionOptions,SIGNAL(triggered()),this,SLOT(movieOptionsSlot())); connect(ui->actionManage_Soundtrack,SIGNAL(triggered()),this,SLOT(manageSoundtracks())); createListContextMenu(); connect(ui->listView,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(listContextMenuRequested(QPoint))); connect(ui->actionPreview,SIGNAL(triggered()),this,SLOT(startSlideShowEngine())); connect(ui->startButton,SIGNAL(released()),this,SLOT(startSlideShowEngine())); // The Delegate m_delegate = new delegate; ui->listView->setItemDelegate(m_delegate); ui->listView->setEditTriggers(QAbstractItemView::DoubleClicked); // | QAbstractItemView::SelectedClicked); ui->listView->setSelectionBehavior(QAbstractItemView::SelectItems); // The View m_scene=new QGraphicsScene; ui->graphicsView->setScene(m_scene); // set filters = all supported file formats. New plugins will automatically add new image formats QList <QByteArray> supportedFilters; QStringList filters; QString extensionFilter; QImageReader reader; supportedFilters = reader.supportedImageFormats(); for (int i = 0; i < supportedFilters.size(); ++i) // fill supported file extensions { extensionFilter.append("*."); extensionFilter.append(supportedFilters[i]); filters.append(extensionFilter); extensionFilter.clear(); } m_FileSystemModel.setRootPath(""); m_FileSystemModel.setNameFilters(QStringList(filters)); ui->dirView->setModel(&m_FileSystemModel); connect(ui->dirView,SIGNAL(clicked(QModelIndex)),this,SLOT(dirViewClickSlot(QModelIndex))); connect(ui->dirView,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(dirViewDoubleClickSlot(QModelIndex))); ui->dirView->setColumnHidden(1,true); ui->dirView->setColumnHidden(2,true); ui->dirView->setColumnHidden(3,true); ui->dirView->setHeaderHidden(true); ui->dirView->setAnimated(false); ui->dirView->setIndentation(20); ui->dirView->setSortingEnabled(true); ui->dirView->show(); }
void UpdaterDialog::httpDone(bool error) { timeOutTimer->stop(); if(error) { if(isVisible()) { if(httpGet->errorString()=="Request aborted")return; downloadError(); return; } if(feedbackMessage) QMessageBox::information(0,"Qt Bitcoin Trader",julyTr("UPDATE_ERROR","Cannot check for update. Network error: %1").arg(httpGet->errorString())); exitSlot(); return; } if(stateUpdate==0) { QByteArray dataReceived(httpGet->readAll().replace("\r","")); if(dataReceived.size()>10245)exitSlot(); QMap<QString,QString>versionsMap; QStringList dataList=QString(dataReceived).split("\n"); for(int n=0;n<dataList.count();n++) { QString varData=dataList.at(n); int splitPos=varData.indexOf('='); if(splitPos>-1) { QString varName=varData.left(splitPos); varData.remove(0,splitPos+1); versionsMap[varName]=varData; } } QString os="Src"; bool canAutoUpdate=false; #ifdef Q_OS_MAC os="Mac"; canAutoUpdate=true; #endif #ifdef Q_OS_WIN os="Win32"; canAutoUpdate=true; #endif updateVersion=versionsMap.value(os+"Ver"); updateSignature=versionsMap.value(os+"Signature").toAscii(); if(!updateSignature.isEmpty())updateSignature=QByteArray::fromBase64(updateSignature); updateChangeLog=versionsMap.value(os+"ChangeLog"); updateLink=versionsMap.value(os+"Bin"); if(updateVersion.toDouble()<=appVerReal) { if(feedbackMessage) QMessageBox::information(0,"Qt Bitcoin Trader",julyTr("UP_TO_DATE","Your version of Qt Bitcoin Trader is up to date.")); exitSlot(); return; } stateUpdate=1; ui.autoUpdateGroupBox->setVisible(canAutoUpdate); ui.changeLogText->setHtml(updateChangeLog); ui.versionLabel->setText("v"+updateVersion); #ifdef Q_OS_WIN if(QtWin::isCompositionEnabled()) QtWin::extendFrameIntoClientArea(this); #endif #ifdef GENERATE_LANGUAGE_FILE julyTranslator->loadMapFromUi(this); julyTranslator->saveToFile("LanguageDefault.lng"); #endif julyTranslator->translateUi(this); ui.iconLabel->setPixmap(QPixmap(":/Resources/QtBitcoinTrader.png")); QSize minSizeHint=minimumSizeHint(); if(mainWindow.isValidSize(&minSizeHint))setFixedSize(minimumSizeHint()); show(); } else if(stateUpdate==1) { QByteArray binData=httpGet->readAll(); QByteArray fileSha1=QCryptographicHash::hash(binData,QCryptographicHash::Sha1); QFile readPublicKey(":/Resources/Public.key"); if(!readPublicKey.open(QIODevice::ReadOnly)){QMessageBox::critical(this,windowTitle(),"Public.key is missing");return;} QByteArray publicKey=readPublicKey.readAll(); QByteArray decrypted=JulyRSA::getSignature(updateSignature,publicKey); if(decrypted==fileSha1) { QString curBin=QApplication::applicationFilePath(); QString updBin=curBin+".upd"; QString bkpBin=curBin+".bkp"; if(QFile::exists(updBin))QFile::remove(updBin); if(QFile::exists(bkpBin))QFile::remove(bkpBin); if(QFile::exists(updBin)||QFile::exists(bkpBin)){downloadError();return;} { QFile wrFile(updBin); if(wrFile.open(QIODevice::WriteOnly|QIODevice::Truncate)) { wrFile.write(binData); wrFile.close(); }else {downloadError();return;} } QByteArray fileData; { QFile opFile(updBin); if(opFile.open(QIODevice::ReadOnly))fileData=opFile.readAll(); opFile.close(); } if(QCryptographicHash::hash(fileData,QCryptographicHash::Sha1)!=fileSha1){downloadError();return;} QFile::rename(curBin,bkpBin); if(!QFile::exists(bkpBin)){downloadError();return;} QFile::rename(updBin,curBin); if(!QFile::exists(curBin)){QMessageBox::critical(this,windowTitle(),"Critical error. Please reinstall application. Download it from http://sourceforge.net/projects/bitcointrader/<br>File not exists: "+curBin+"\n"+updBin);downloadError();return;} #ifdef Q_OS_MAC QFile(curBin).setPermissions(QFile(bkpBin).permissions()); #endif QMessageBox::information(this,windowTitle(),julyTr("UPDATED_SUCCESSFULLY","Application updated successfully. Please restart application to apply changes.")); exitSlot(); } } }
void UpdaterDialog::downloadError() { QMessageBox::warning(this,windowTitle(),julyTr("DOWNLOAD_ERROR","Download error. Please try again.")+"<br>"+httpGet->errorString()); exitSlot(); }