php 如何 闭源,如何发布一个部分使用了Qt的闭源软件

MainWindow.cpp

#include "MainWindow.h"

#include "..\__DESAlgorithm.h"

MainWindow::MainWindow(){

QTextCodec::setCodecForTr( QTextCodec::codecForName( "UTF-8" ) );

pqlMainLayout = new QVBoxLayout( this );

setLayout( pqlMainLayout );

resize( 600, 400 );

CreatMenuBar();

CreatLayouts();

}

MainWindow::~MainWindow(){

;

}

void MainWindow::CreatMenuBar(){

pmbMenuBar = new QMenuBar( this );

setMenuBar( pmbMenuBar );

pqmFile = new QMenu( tr("文件(&F)"), this );

pmbMenuBar->addMenu( pqmFile );

pqaExit = pqmFile->addAction( tr("退出(&X)") );

pqaExit->setShortcut( tr("Ctrl+Q") );

connect( pqaExit, SIGNAL( triggered() ), this, SLOT( close() ) );

pqmHelp = new QMenu( tr("帮助(&H)"), this);

pmbMenuBar->addMenu( pqmHelp );

pqaAbout = pqmHelp->addAction( tr("关于(&A)") );

pqaAbout->setShortcut( tr("Ctrl+A") );

connect( pqaAbout, SIGNAL( triggered() ), this, SLOT( About() ) );

pqaAboutQt = pqmHelp->addAction( tr("关于Qt(&Q)") );

pqaAboutQt->setShortcut( tr("Ctrl+T") );

connect( pqaAboutQt, SIGNAL( triggered() ), this, SLOT( AboutQt() ) );

}

void MainWindow::CreatLayouts(){

pqwCentralWidget = new QWidget( this );

setCentralWidget( pqwCentralWidget );

pqlMainLayout = new QVBoxLayout( this );

pqwCentralWidget -> setLayout( pqlMainLayout );

pqgbTextBox = new QGroupBox( tr("明文(&T)"), this );

pqlMainLayout->addWidget( pqgbTextBox );

pqlTextLayout = new QHBoxLayout();

pqgbTextBox->setLayout( pqlTextLayout );

pqteText = new QTextEdit;

pqlTextLayout->addWidget( pqteText );

pqgbCipherTextBox = new QGroupBox( tr("密文(&C)"), this );

pqlMainLayout->addWidget( pqgbCipherTextBox );

pqlCipherTextLayout = new QHBoxLayout();

pqgbCipherTextBox->setLayout( pqlCipherTextLayout );

pqteCipherText = new QTextEdit;

pqlCipherTextLayout->addWidget( pqteCipherText );

pqwKeyWidget = new QWidget();

pqlMainLayout->addWidget( pqwKeyWidget );

pqlKeyLayout = new QHBoxLayout();

pqwKeyWidget->setLayout( pqlKeyLayout );

pqlKeyLabel= new QLabel( tr("密钥(&K)") );

pqlKeyLayout->addWidget( pqlKeyLabel );

pqleKey = new QLineEdit();

pqlKeyLayout->addWidget( pqleKey );

pqdbbButtonBox = new QDialogButtonBox( this );

pqlMainLayout->addWidget( pqdbbButtonBox );

pqpbEncryption = pqdbbButtonBox->addButton( tr("加密(&E)"), QDialogButtonBox::ActionRole );

pqpbDecryption = pqdbbButtonBox->addButton( tr("解密(&D)"), QDialogButtonBox::ActionRole );

connect( pqpbEncryption, SIGNAL( clicked() ), this, SLOT( Encryption() ) );

connect( pqpbDecryption, SIGNAL( clicked() ), this, SLOT( Decryption() ) );

}

void MainWindow::About(){

QMessageBox::about(

this,

tr("关于本程序"),

tr("

Qt应用程序部分源代码使用了Qt库。

")

);

}

void MainWindow::AboutQt(){

QMessageBox::aboutQt(

this,

tr("关于 Qt")

);

}

void MainWindow::Encryption(){

QString

qsText = pqteText->toPlainText()/*从明文文本框获取输入的明文*/,

qsKey = pqleKey->text()/*从密钥文本框获取输出的密钥*/

;

QByteArray

qbaText = qsText.toUtf8()/*将目标转换为UTF-8串*/,

qbaKey = qsKey.toUtf8()/*将密钥转换为UTF-8串*/

;

des::CString * c_string_text = des::c_string_new( qbaText, -1 );

des::CString * c_string_key = des::c_string_new( qbaKey, -1);

//加密得到密文

des::CString * c_string_target = encryption_fun ( c_string_text, c_string_key, encryption/*加密*/ );

pqteCipherText->setPlainText ( QString::fromUtf8( c_string_target->str )/*将UTF-8串转为QString*/ );

des::c_string_free ( c_string_text );

des::c_string_free ( c_string_key );

des::c_string_free ( c_string_target );

}

void MainWindow::Decryption(){

QString

qsText = pqteCipherText->toPlainText()/*从密文文本框获取输入的密文*/,

qsKey = pqleKey->text()/*从密钥文本框获取输出的密钥*/

;

QByteArray

qbaText = qsText.toUtf8()/*将目标转换为UTF-8串*/,

qbaKey = qsKey.toUtf8()/*将密钥转换为UTF-8串*/

;

des::CString * c_string_text = des::c_string_new( qbaText, -1 );

des::CString * c_string_key = des::c_string_new( qbaKey, -1);

//解密得到明文

des::CString * c_string_target = encryption_fun ( c_string_text, c_string_key, decryption/*解密*/ );

pqteText->setPlainText ( QString::fromUtf8( c_string_target->str )/*将UTF-8串转为QString*/ );

des::c_string_free ( c_string_text );

des::c_string_free ( c_string_key );

des::c_string_free ( c_string_target );

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值