[Qt4] Custom Looks using Qt Style Sheets
Ref :
http://doc.qt.digia.com/qq/qq20-qss.html
2014年1月27日 星期一
2014年1月26日 星期日
[Qt4] Removing buttons from QWizard
[Qt4] Removing buttons from QWizard
QList<QWizard::WizardButton> layout;
QList<QWizard::WizardButton> layout;
//layout << QWizard::Stretch << QWizard::NextButton << QWizard::CancelButton << QWizard::FinishButton;
setButtonLayout(layout);
Ref : http://www.qtforum.org/article/32938/removing-buttons-from-qwizard.html
Ref : http://www.qtforum.org/article/32938/removing-buttons-from-qwizard.html
2014年1月12日 星期日
[Qt4] Using Qt to create and execute vbscript
[Qt4] Using Qt to create and execute vbscript
QString iconPath = QDesktopServices::storageLocation(QDesktopServices::PicturesLocation);
iconPath.append("\\").append(IPCameraList[configIPCameraIdx].modelName).append(".ico");
/* 00 check file exist and remove */
QFile lfile(pathLink);
if (lfile.exists()){
qDebug() << "remove .lnk file !!";
lfile.remove();
}
/* 01 create vbscript file */
// 01-01 open file for write
bool startprocess = false;
bool removefile = false;
QFile sfile(QCoreApplication::applicationDirPath()+"//shortcut.vbs");
if(!sfile.open(QIODevice::WriteOnly)){
qDebug() << "file open error!!";
}
// 01-02 writing file content and close finish
QTextStream wrcontent(&sfile);
wrcontent << "Set oWS = WScript.CreateObject(\"WScript.Shell\")\n";
wrcontent << "sLinkFileLocation = \"" << pathLink << "\"\n";
wrcontent << "browserLink = \"%windir%\\explorer.exe \"\n";
wrcontent << "webLink = \"\"\"https://"<< portal.right(portal.length()-7) << "device#" <<IPCameraList[configIPCameraIdx].myNo << "?lang=" << lang << "\"\"\"\n";
wrcontent << "Set oLink = oWS.CreateShortcut(sLinkFileLocation)\n";
wrcontent << " oLink.TargetPath = browserLink\n";
wrcontent << " oLink.Arguments = webLink\n";
wrcontent << " oLink.IconLocation = \""<< iconPath << "\"\n";
wrcontent << " oLink.Save\n";
wrcontent << "Wscript.Quit 0\n";
sfile.close();
if (sfile.exists()){
startprocess=true;
qDebug()<< "create vbscript file success !!";
}else{
qDebug()<< "create vbscript file fail !!";
}
/* 02 run qprocess */
// 02-01 create procees execute vbscript
QProcess process;
QString script ="wscript";
QStringList args;
args << QString(QCoreApplication::applicationDirPath()+ "//shortcut.vbs");
// 02-02 procees wait while file writing
do{
qDebug() << "start procees !!";
process.execute(script, args);
removefile = true;
break;
}while(startprocess);
/* 03 remove vbscript file */
do{
qDebug() << "delete vbscript file !!";
QFile dfile(QCoreApplication::applicationDirPath()+"//shortcut.vbs");
//dfile.remove();
break;
}while(removefile);
QProcess process2;
QString script2 = QString(QCoreApplication::applicationDirPath()+ "//run.bat");
process2.execute(script2);
QString iconPath = QDesktopServices::storageLocation(QDesktopServices::PicturesLocation);
iconPath.append("\\").append(IPCameraList[configIPCameraIdx].modelName).append(".ico");
/* 00 check file exist and remove */
QFile lfile(pathLink);
if (lfile.exists()){
qDebug() << "remove .lnk file !!";
lfile.remove();
}
/* 01 create vbscript file */
// 01-01 open file for write
bool startprocess = false;
bool removefile = false;
QFile sfile(QCoreApplication::applicationDirPath()+"//shortcut.vbs");
if(!sfile.open(QIODevice::WriteOnly)){
qDebug() << "file open error!!";
}
// 01-02 writing file content and close finish
QTextStream wrcontent(&sfile);
wrcontent << "Set oWS = WScript.CreateObject(\"WScript.Shell\")\n";
wrcontent << "sLinkFileLocation = \"" << pathLink << "\"\n";
wrcontent << "browserLink = \"%windir%\\explorer.exe \"\n";
wrcontent << "webLink = \"\"\"https://"<< portal.right(portal.length()-7) << "device#" <<IPCameraList[configIPCameraIdx].myNo << "?lang=" << lang << "\"\"\"\n";
wrcontent << "Set oLink = oWS.CreateShortcut(sLinkFileLocation)\n";
wrcontent << " oLink.TargetPath = browserLink\n";
wrcontent << " oLink.Arguments = webLink\n";
wrcontent << " oLink.IconLocation = \""<< iconPath << "\"\n";
wrcontent << " oLink.Save\n";
wrcontent << "Wscript.Quit 0\n";
sfile.close();
if (sfile.exists()){
startprocess=true;
qDebug()<< "create vbscript file success !!";
}else{
qDebug()<< "create vbscript file fail !!";
}
/* 02 run qprocess */
// 02-01 create procees execute vbscript
QProcess process;
QString script ="wscript";
QStringList args;
args << QString(QCoreApplication::applicationDirPath()+ "//shortcut.vbs");
// 02-02 procees wait while file writing
do{
qDebug() << "start procees !!";
process.execute(script, args);
removefile = true;
break;
}while(startprocess);
/* 03 remove vbscript file */
do{
qDebug() << "delete vbscript file !!";
QFile dfile(QCoreApplication::applicationDirPath()+"//shortcut.vbs");
//dfile.remove();
break;
}while(removefile);
QProcess process2;
QString script2 = QString(QCoreApplication::applicationDirPath()+ "//run.bat");
process2.execute(script2);
2014年1月6日 星期一
[git] Git Reference
[git] Git Reference
01 http://gitref.org/
02 http://git-scm.com/book/zh-tw/Git-%E5%9F%BA%E7%A4%8E-%E8%88%87%E9%81%A0%E7%AB%AF%E5%8D%94%E5%90%8C%E5%B7%A5%E4%BD%9C
[git] Git Shell lost shortcut
1. Running the Git Shell via the command line (Since you lost the shortcut)
cd source.git
git push --mirror https://github-url/target.git
[git] Git Usage
git clone ssh://username@gerrit-url:gerritport/target.git
cd target.git
git remote add mygithub https://github-url/source.git
git fetch mygithub
git checkout --track -b my-newbranch mygithub/master
git checkout master
git merge my-newbranch
git push origin master:refs/for/master
Example :
git clone ssh://kenlin@adelphos.mydlink.com:29418/device_setup_wizard.git
cd device_setup_wizard
git remote add mygithub https://github.com/mydlink/SetupWizardinQT.git
git fetch github
git checkout --track -b mywizard mygithub/master
git checkout master
git merge mywizard
git push origin master:refs/heads/master
01 http://gitref.org/
02 http://git-scm.com/book/zh-tw/Git-%E5%9F%BA%E7%A4%8E-%E8%88%87%E9%81%A0%E7%AB%AF%E5%8D%94%E5%90%8C%E5%B7%A5%E4%BD%9C
[git] Git Shell lost shortcut
1. Running the Git Shell via the command line (Since you lost the shortcut)
- C:\Users\Username\AppData\Local\GitHub\GitHub.appref-ms --open-shell
2. Once youre in the Git Shell run the command in the previous answer
- github --reinstall-shortcuts
You'll find the Git Shell with the grey cat icon that originally came with the GitHub setup in the desktop.
Ref :
http://stackoverflow.com/questions/17457182/how-to-install-git-shell
[git] Git Clone
git clone --mirror https://github-url/source.git[git] Git Clone
cd source.git
git push --mirror https://github-url/target.git
[git] Git Usage
git clone ssh://username@gerrit-url:gerritport/target.git
cd target.git
git remote add mygithub https://github-url/source.git
git fetch mygithub
git checkout --track -b my-newbranch mygithub/master
git checkout master
git merge my-newbranch
git push origin master:refs/for/master
Example :
git clone ssh://kenlin@adelphos.mydlink.com:29418/device_setup_wizard.git
cd device_setup_wizard
git remote add mygithub https://github.com/mydlink/SetupWizardinQT.git
git fetch github
git checkout --track -b mywizard mygithub/master
git checkout master
git merge mywizard
git push origin master:refs/heads/master
訂閱:
文章 (Atom)