|
@@ -1,7 +1,7 @@
|
|
|
|
|
|
/**
|
|
|
- * �海辉
|
|
|
- * QQ群121376426
|
|
|
+ * Ò¶º£»Ô
|
|
|
+ * QQȺ121376426
|
|
|
* http://blog.yundiantech.com/
|
|
|
*/
|
|
|
|
|
@@ -32,10 +32,15 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
exit(1);
|
|
|
}
|
|
|
|
|
|
- setWindowFlags(Qt::WindowStaysOnTopHint|Qt::FramelessWindowHint); //使窗å�£çš„æ ‡é¢˜æ �éš�è—�
|
|
|
+ setWindowFlags(Qt::WindowStaysOnTopHint|Qt::FramelessWindowHint); //ʹ´°¿ÚµÄ±êÌâÀ¸Òþ²Ø
|
|
|
setAttribute(Qt::WA_TranslucentBackground, true);
|
|
|
|
|
|
+#if (QT_VERSION <= QT_VERSION_CHECK(5,0,0))
|
|
|
AppDataPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
|
|
+#else
|
|
|
+ AppDataPath = QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation);
|
|
|
+#endif
|
|
|
+
|
|
|
QString dirName = AppDataPath + "\\ScreenRecorder\\etc";
|
|
|
SettingFile = dirName + "\\set.conf";
|
|
|
|
|
@@ -61,7 +66,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
|
|
|
selectRectWidget = new SelectRect(NULL,SelectRect::RecordGif);
|
|
|
QDesktopWidget* desktopWidget = QApplication::desktop();
|
|
|
- deskRect = desktopWidget->screenGeometry();//获��用桌�大�
|
|
|
+ deskRect = desktopWidget->screenGeometry();//»ñÈ¡¿ÉÓÃ×ÀÃæ´óС
|
|
|
m_rate = deskRect.height() * 1.0 / deskRect.width();
|
|
|
selectRectWidget->setRate(m_rate);
|
|
|
|
|
@@ -75,7 +80,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
connect(ui->toolButton_audio,SIGNAL(clicked(bool)),this,SLOT(slotToolBtnToggled(bool)));
|
|
|
connect(ui->toolButton_file,SIGNAL(clicked(bool)),this,SLOT(slotToolBtnToggled(bool)));
|
|
|
|
|
|
- ///动画类 用�实现窗体从上方慢慢出现
|
|
|
+ ///¶¯»Àà ÓÃÀ´ÊµÏÖ´°Ìå´ÓÉÏ·½ÂýÂý³öÏÖ
|
|
|
animation = new QPropertyAnimation(this, "geometry");
|
|
|
animation->setDuration(1000);
|
|
|
|
|
@@ -93,7 +98,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
|
{
|
|
|
selectRectWidget->show();
|
|
|
selectRectWidget->setPointHide();
|
|
|
- ui->hideRectButton->setText("��");
|
|
|
+ ui->hideRectButton->setText(QStringLiteral("Òþ²Ø"));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -133,7 +138,7 @@ void MainWindow::mousePressEvent(QMouseEvent * event)
|
|
|
}
|
|
|
|
|
|
void MainWindow::mouseMoveEvent(QMouseEvent * event)
|
|
|
-{ //å®žçŽ°é¼ æ ‡ç§»åŠ¨çª—å�£
|
|
|
+{ //ʵÏÖÊó±êÒÆ¶¯´°¿Ú
|
|
|
if (event->buttons() & Qt::LeftButton)
|
|
|
{
|
|
|
if (isLeftBtnPressed)
|
|
@@ -249,7 +254,7 @@ void MainWindow::loadFile()
|
|
|
selectRectWidget->setRect(rect);
|
|
|
ui->startButton->setEnabled(true);
|
|
|
selectRectWidget->setVisible(false);
|
|
|
- ui->hideRectButton->setText("显示");
|
|
|
+ ui->hideRectButton->setText(QStringLiteral("ÏÔʾ"));
|
|
|
ui->startButton->setEnabled(true);
|
|
|
}
|
|
|
|
|
@@ -322,8 +327,8 @@ void MainWindow::initDev()
|
|
|
devFile.close();
|
|
|
}
|
|
|
|
|
|
- /// 执行ffmpeg命令行 获�音视频设备
|
|
|
- /// 请将ffmpeg.exe和程�放到�一个目录下
|
|
|
+ /// Ö´ÐÐffmpegÃüÁîÐÐ »ñÈ¡ÒôÊÓÆµÉ豸
|
|
|
+ /// Ç뽫ffmpeg.exeºÍ³ÌÐò·Åµ½Í¬Ò»¸öĿ¼ÏÂ
|
|
|
|
|
|
QString ffmpegPath = QCoreApplication::applicationDirPath() + "/ffmpeg.exe";
|
|
|
ffmpegPath.replace("/","\\\\");
|
|
@@ -459,9 +464,9 @@ void MainWindow::slotToolBtnToggled(bool isChecked)
|
|
|
else if (QObject::sender() == ui->toolButton_file)
|
|
|
{
|
|
|
QString s = QFileDialog::getSaveFileName(
|
|
|
- this, "选择ä¿�å˜æ–‡ä»¶çš„路劲",
|
|
|
- saveFileName,//�始目录
|
|
|
- "视频文件 (*.mp4);;");
|
|
|
+ this, QStringLiteral("Ñ¡Ôñ±£´æÎļþµÄ·¾¶"),
|
|
|
+ saveFileName,//³õʼĿ¼
|
|
|
+ QStringLiteral("ÊÓÆµÎļþ (*.mp4);;"));
|
|
|
if (!s.isEmpty())
|
|
|
{
|
|
|
saveFileName = s.replace("/","\\\\");
|
|
@@ -475,11 +480,11 @@ void MainWindow::slotToolBtnToggled(bool isChecked)
|
|
|
|
|
|
void MainWindow::slotSelectRectFinished(QRect re)
|
|
|
{
|
|
|
- /// 1.ä¼ ç»™ffmpegç¼–ç �的图åƒ�宽高必须是å�¶æ•°ã€‚
|
|
|
- /// 2.图��剪的起始�置和结��置也必须是�数
|
|
|
- /// 而手动选择的区域很有å�¯èƒ½ä¼šæ˜¯å¥‡æ•°ï¼Œå› æ¤éœ€è¦�处ç�†ä¸€ä¸‹ 给他弄æˆ�å�¶æ•°
|
|
|
- /// 处ç�†çš„æ–¹æ³•很简ç”:其实就是往å‰�或者往å�Žç§»ä¸€ä¸ªåƒ�ç´
|
|
|
- /// 一个åƒ�ç´ çš„å¤§å°�肉眼基本也看ä¸�出æ�¥å•¥åŒºåˆ«ã€‚
|
|
|
+ /// 1.´«¸øffmpeg±àÂëµÄͼÏñ¿í¸ß±ØÐëÊÇżÊý¡£
|
|
|
+ /// 2.ͼÏñ²Ã¼ôµÄÆðʼλÖúͽáÊøÎ»ÖÃÒ²±ØÐëÊÇżÊý
|
|
|
+ /// ¶øÊÖ¶¯Ñ¡ÔñµÄÇøÓòºÜÓпÉÄÜ»áÊÇÆæÊý£¬Òò´ËÐèÒª´¦ÀíһϠ¸øËûŪ³ÉżÊý
|
|
|
+ /// ´¦ÀíµÄ·½·¨ºÜ¼ò´ð£ºÆäʵ¾ÍÊÇÍùǰ»òÕßÍùºóÒÆÒ»¸öÏñËØ
|
|
|
+ /// Ò»¸öÏñËØµÄ´óСÈâÑÛ»ù±¾Ò²¿´²»³öÀ´É¶Çø±ð¡£
|
|
|
|
|
|
int x = re.x();
|
|
|
int y = re.y();
|
|
@@ -510,7 +515,7 @@ void MainWindow::slotSelectRectFinished(QRect re)
|
|
|
|
|
|
rect = QRect(x,y,w,h);
|
|
|
|
|
|
- QString str = QString("==当�区域==\n\n起点(%1,%2)\n\n大�(%3 x %4)")
|
|
|
+ QString str = QStringLiteral("==µ±Ç°ÇøÓò==\n\nÆðµã(%1,%2)\n\n´óС(%3 x %4)")
|
|
|
.arg(rect.left()).arg(rect.left()).arg(rect.width()).arg(rect.height());
|
|
|
|
|
|
ui->showRectInfoLabel->setText(str);
|
|
@@ -518,7 +523,7 @@ void MainWindow::slotSelectRectFinished(QRect re)
|
|
|
ui->startButton->setEnabled(true);
|
|
|
ui->editRectButton->setEnabled(true);
|
|
|
ui->hideRectButton->setEnabled(true);
|
|
|
- ui->hideRectButton->setText("��");
|
|
|
+ ui->hideRectButton->setText(QStringLiteral("Òþ²Ø"));
|
|
|
|
|
|
saveFile();
|
|
|
|
|
@@ -556,7 +561,7 @@ bool MainWindow::startRecord()
|
|
|
{
|
|
|
ret = -2;
|
|
|
msg = "filepath not set";
|
|
|
- QMessageBox::critical(this,"æ��示","请先设置ä¿�å˜æ–‡ä»¶è·¯å¾„");
|
|
|
+ QMessageBox::critical(this, QStringLiteral("Ìáʾ"), QStringLiteral("ÇëÏÈÉèÖñ£´æÎļþ·¾¶"));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -566,7 +571,7 @@ bool MainWindow::startRecord()
|
|
|
|
|
|
if (audioDevName.isEmpty())
|
|
|
{
|
|
|
- QMessageBox::critical(this,"æ��示","出错了,音频或视频设备未就绪,程åº�æ— æ³•è¿�行ï¼�");
|
|
|
+ QMessageBox::critical(this, QStringLiteral("Ìáʾ"), QStringLiteral("³ö´íÁË,ÒôƵ»òÊÓÆµÉ豸δ¾ÍÐ÷£¬³ÌÐòÎÞ·¨ÔËÐУ¡"));
|
|
|
|
|
|
ret = -3;
|
|
|
msg = "audio device not set";
|
|
@@ -589,7 +594,7 @@ bool MainWindow::startRecord()
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- QMessageBox::critical(this,"�示","出错了,�始化录�设备失败�");
|
|
|
+ QMessageBox::critical(this, QStringLiteral("Ìáʾ"), QStringLiteral("³ö´íÁË,³õʼ»¯Â¼ÆÁÉ豸ʧ°Ü£¡"));
|
|
|
|
|
|
ret = -4;
|
|
|
msg = "init screen device failed!";
|
|
@@ -607,7 +612,7 @@ bool MainWindow::startRecord()
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- QMessageBox::critical(this,"�示","出错了,�始化音频设备失败�");
|
|
|
+ QMessageBox::critical(this, QStringLiteral("Ìáʾ"), QStringLiteral("³ö´íÁË,³õʼ»¯ÒôƵÉ豸ʧ°Ü£¡"));
|
|
|
ret = -5;
|
|
|
msg = "init audio device failed!";
|
|
|
goto end;
|
|
@@ -722,12 +727,12 @@ void MainWindow::slotHideRectBtnClick()
|
|
|
if (selectRectWidget->isVisible())
|
|
|
{
|
|
|
selectRectWidget->setVisible(false);
|
|
|
- ui->hideRectButton->setText("显示");
|
|
|
+ ui->hideRectButton->setText(QStringLiteral("ÏÔʾ"));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
selectRectWidget->setVisible(true);
|
|
|
- ui->hideRectButton->setText("��");
|
|
|
+ ui->hideRectButton->setText(QStringLiteral("Òþ²Ø"));
|
|
|
}
|
|
|
}
|
|
|
|