-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
221abaa
commit 834cbd8
Showing
12 changed files
with
1,206 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#include "dialogfilechmod.h" | ||
|
||
DialogFileChmod::DialogFileChmod(QWidget *parent, int mode) : QDialog(parent), _mode(mode) | ||
{ | ||
setWindowIcon(QIcon(":/ico.png")); | ||
|
||
setFixedSize(QSize(600,150)); | ||
|
||
mainLay = new QVBoxLayout(this); | ||
le_fileName = new QLineEdit; | ||
le_mod = new QLineEdit; | ||
combox = new QComboBox; | ||
|
||
QHBoxLayout *lay_edit = new QHBoxLayout; | ||
QHBoxLayout *lay_mod = new QHBoxLayout; | ||
QHBoxLayout *lay_btns = new QHBoxLayout; | ||
|
||
mainLay->addLayout(lay_edit); | ||
mainLay->addLayout(lay_mod); | ||
mainLay->addLayout(lay_btns); | ||
|
||
lay_edit->addWidget(new QLabel("目标路径:")); | ||
lay_edit->addWidget(combox); | ||
lay_edit->addWidget(le_fileName); | ||
|
||
lay_mod->addWidget(new QLabel("目标权限:")); | ||
lay_mod->addWidget(le_mod); | ||
lay_mod->addStretch(3); | ||
|
||
combox->addItem("${srcdir}"); | ||
combox->addItem("${pkgdir}"); | ||
combox->setCurrentIndex(1); | ||
|
||
QPushButton *btn_cancel = new QPushButton("取消"); | ||
QPushButton *btn_apply = new QPushButton("确定"); | ||
|
||
lay_btns->addStretch(); | ||
lay_btns->addWidget(btn_cancel); | ||
lay_btns->addStretch(); | ||
lay_btns->addWidget(btn_apply); | ||
lay_btns->addStretch(); | ||
|
||
le_fileName->setText("/"); | ||
|
||
//file | ||
if(_mode == 0) | ||
{ | ||
setWindowTitle("更改文件权限"); | ||
} | ||
|
||
//dir | ||
if(_mode == 1) | ||
{ | ||
setWindowTitle("更改文件夹权限"); | ||
} | ||
|
||
connect(btn_cancel, &QPushButton::clicked, [=](){ | ||
int ret = QMessageBox::question(this, "确认退出", "确认退出文件权限更改吗?"); | ||
|
||
if(ret == QMessageBox::Yes) | ||
{ | ||
close(); | ||
} | ||
}); | ||
|
||
connect(btn_apply, &QPushButton::clicked, [=](){ | ||
if(le_fileName->text()=="/" || le_mod->text().isEmpty()) | ||
{ | ||
QMessageBox::critical(this, "错误!", "请填写目标路径及对应权限!"); | ||
|
||
return; | ||
} | ||
|
||
if(_mode == 0) | ||
{ | ||
emit signalAddOperation(tr("chmod 0%1 %2").arg(le_mod->text()).arg(combox->currentText()+le_fileName->text())); | ||
} | ||
|
||
if(_mode == 1) | ||
{ | ||
emit signalAddOperation(tr("chmod -R 0%1 %2").arg(le_mod->text()).arg(combox->currentText()+le_fileName->text())); | ||
} | ||
}); | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef DIALOGFILECHMOD_H | ||
#define DIALOGFILECHMOD_H | ||
|
||
#include <QWidget> | ||
#include <QDialog> | ||
#include <QPushButton> | ||
#include <QVBoxLayout> | ||
#include <QHBoxLayout> | ||
#include <QLineEdit> | ||
#include <QComboBox> | ||
#include <QLabel> | ||
#include <QMessageBox> | ||
|
||
class DialogFileChmod : public QDialog | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit DialogFileChmod(QWidget *parent = nullptr, int mode =0); | ||
|
||
QVBoxLayout *mainLay; | ||
|
||
QComboBox *combox; | ||
|
||
QLineEdit *le_fileName; | ||
|
||
QLineEdit *le_mod; | ||
|
||
|
||
private: | ||
int _mode; | ||
|
||
signals: | ||
|
||
void signalAddOperation(QString operation); | ||
|
||
}; | ||
|
||
#endif // DIALOGFILECHMOD_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
#include "dialogfilecopy.h" | ||
|
||
DialogFileCopy::DialogFileCopy(QWidget *parent, int mode) : QDialog(parent), _mode(mode) | ||
{ | ||
setWindowIcon(QIcon(":/ico.png")); | ||
|
||
setFixedSize(QSize(600,200)); | ||
|
||
mainLay = new QVBoxLayout(this); | ||
|
||
QHBoxLayout *hlay_source = new QHBoxLayout; | ||
QHBoxLayout *hlay_destination = new QHBoxLayout; | ||
QHBoxLayout *hlay_btns = new QHBoxLayout; | ||
|
||
check_binary = new QCheckBox("可执行文件"); | ||
|
||
mainLay->addWidget(check_binary); | ||
mainLay->addLayout(hlay_source); | ||
mainLay->addLayout(hlay_destination); | ||
mainLay->addLayout(hlay_btns); | ||
|
||
combox_source = new QComboBox; | ||
combox_destination = new QComboBox; | ||
le_source = new QLineEdit; | ||
le_destination = new QLineEdit; | ||
|
||
QPushButton *btn_cancel = new QPushButton("取消"); | ||
QPushButton *btn_apply = new QPushButton("确定"); | ||
|
||
hlay_source->addWidget(new QLabel("源路径:")); | ||
hlay_source->addWidget(combox_source); | ||
hlay_source->addWidget(le_source); | ||
|
||
|
||
hlay_destination->addWidget(new QLabel("目标路径:")); | ||
hlay_destination->addWidget(combox_destination); | ||
hlay_destination->addWidget(le_destination); | ||
|
||
|
||
hlay_btns->addStretch(); | ||
hlay_btns->addWidget(btn_cancel); | ||
hlay_btns->addStretch(); | ||
hlay_btns->addWidget(btn_apply); | ||
hlay_btns->addStretch(); | ||
|
||
combox_source->addItem("${srcdir}"); | ||
combox_source->addItem("${pkgdir}"); | ||
combox_source->setCurrentIndex(0); | ||
|
||
combox_destination->addItem("${srcdir}"); | ||
combox_destination->addItem("${pkgdir}"); | ||
combox_destination->setCurrentIndex(1); | ||
|
||
le_source->setText("/"); | ||
le_destination->setText("/"); | ||
|
||
check_binary->setChecked(false); | ||
|
||
if(_mode==0) //文件 | ||
{ | ||
setWindowTitle("复制文件"); | ||
|
||
check_binary->setCheckable(true); | ||
|
||
} | ||
|
||
if(_mode==1) //文件夹 | ||
{ | ||
setWindowTitle("复制文件夹"); | ||
|
||
check_binary->setCheckable(false); | ||
} | ||
|
||
|
||
connect(btn_cancel, &QPushButton::clicked, [=](){ | ||
int ret = QMessageBox::question(this, "确认退出", "确认退出文件拷贝吗?"); | ||
|
||
if(ret == QMessageBox::Yes) | ||
{ | ||
close(); | ||
} | ||
}); | ||
|
||
connect(btn_apply, &QPushButton::clicked, [=](){ | ||
if(le_source->text()=="/" || le_destination->text()=="/") | ||
{ | ||
QMessageBox::critical(this, "错误!", "请填写源路径和目标路径!"); | ||
|
||
return; | ||
} | ||
|
||
if(_mode == 0) | ||
{ | ||
|
||
if(check_binary->isChecked()) | ||
{ | ||
emit signalAddOperation(tr("install -Dm755 %1 %2").arg(combox_source->currentText()+le_source->text()).arg(combox_destination->currentText()+le_destination->text())); | ||
} | ||
else | ||
{ | ||
emit signalAddOperation(tr("install -Dm644 %1 %2").arg(combox_source->currentText()+le_source->text()).arg(combox_destination->currentText()+le_destination->text())); | ||
} | ||
} | ||
|
||
if(_mode == 1) | ||
{ | ||
|
||
if(le_source->text().at(le_source->text().length()-1)!='/') | ||
{ | ||
le_source->setText(le_source->text()+"/"); | ||
} | ||
|
||
emit signalAddOperation(tr("install -Dm644 %1* %2").arg(combox_source->currentText()+le_source->text()).arg(combox_destination->currentText()+le_destination->text())); | ||
} | ||
}); | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef DIALOGFILECOPY_H | ||
#define DIALOGFILECOPY_H | ||
|
||
#include <QWidget> | ||
#include <QDialog> | ||
#include <QPushButton> | ||
#include <QVBoxLayout> | ||
#include <QHBoxLayout> | ||
#include <QLineEdit> | ||
#include <QComboBox> | ||
#include <QLabel> | ||
#include <QCheckBox> | ||
#include <QMessageBox> | ||
|
||
class DialogFileCopy : public QDialog | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit DialogFileCopy(QWidget *parent = nullptr, int mode = 0); | ||
|
||
QVBoxLayout *mainLay; | ||
|
||
QComboBox *combox_source; | ||
QComboBox *combox_destination; | ||
QCheckBox *check_binary; | ||
|
||
QLineEdit *le_source; | ||
QLineEdit *le_destination; | ||
|
||
private: | ||
int _mode; | ||
signals: | ||
void signalAddOperation(QString operation); | ||
|
||
}; | ||
|
||
#endif // DIALOGFILECOPY_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include "dialogfiledelete.h" | ||
|
||
DialogFileDelete::DialogFileDelete(QWidget *parent, int mode) : QDialog(parent), _mode(mode) | ||
{ | ||
setWindowIcon(QIcon(":/ico.png")); | ||
|
||
setFixedSize(QSize(600,100)); | ||
|
||
mainLay = new QVBoxLayout(this); | ||
le_fileName = new QLineEdit; | ||
combox = new QComboBox; | ||
|
||
QHBoxLayout *lay_edit = new QHBoxLayout; | ||
QHBoxLayout *lay_btns = new QHBoxLayout; | ||
|
||
mainLay->addLayout(lay_edit); | ||
mainLay->addLayout(lay_btns); | ||
|
||
lay_edit->addWidget(new QLabel("目标路径:")); | ||
lay_edit->addWidget(combox); | ||
lay_edit->addWidget(le_fileName); | ||
|
||
combox->addItem("${srcdir}"); | ||
combox->addItem("${pkgdir}"); | ||
combox->setCurrentIndex(1); | ||
|
||
QPushButton *btn_cancel = new QPushButton("取消"); | ||
QPushButton *btn_apply = new QPushButton("确定"); | ||
|
||
lay_btns->addStretch(); | ||
lay_btns->addWidget(btn_cancel); | ||
lay_btns->addStretch(); | ||
lay_btns->addWidget(btn_apply); | ||
lay_btns->addStretch(); | ||
|
||
le_fileName->setText("/"); | ||
|
||
//file | ||
if(_mode == 0) | ||
{ | ||
setWindowTitle("删除文件"); | ||
} | ||
|
||
//dir | ||
if(_mode == 1) | ||
{ | ||
setWindowTitle("删除文件夹"); | ||
} | ||
|
||
connect(btn_cancel, &QPushButton::clicked, [=](){ | ||
int ret = QMessageBox::question(this, "确认退出", "确认退出文件删除吗?"); | ||
|
||
if(ret == QMessageBox::Yes) | ||
{ | ||
close(); | ||
} | ||
}); | ||
|
||
connect(btn_apply, &QPushButton::clicked, [=](){ | ||
if(le_fileName->text()=="/") | ||
{ | ||
QMessageBox::critical(this, "错误!", "请填写目标路径!"); | ||
|
||
return; | ||
} | ||
|
||
if(_mode == 0) | ||
{ | ||
emit signalAddOperation(tr("rm -f %1").arg(combox->currentText()+le_fileName->text())); | ||
} | ||
|
||
if(_mode == 1) | ||
{ | ||
emit signalAddOperation(tr("rm -rf %1").arg(combox->currentText()+le_fileName->text())); | ||
} | ||
}); | ||
} |
Oops, something went wrong.