mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-03-13 05:41:17 +00:00
- Prepare code for p2p ip filter support
This commit is contained in:
parent
f6210d5857
commit
b17c8b84d1
@ -1037,7 +1037,7 @@ void options_imp::on_browseScanDirButton_clicked() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void options_imp::on_browseFilterButton_clicked() {
|
void options_imp::on_browseFilterButton_clicked() {
|
||||||
QString ipfilter = QFileDialog::getOpenFileName(this, tr("Choose an ipfilter.dat file"), QDir::homePath());
|
QString ipfilter = QFileDialog::getOpenFileName(this, tr("Choose an ip filter file"), QDir::homePath(), tr("Filters (*.dat *.p2p *.p2b)"));
|
||||||
if(!ipfilter.isNull()){
|
if(!ipfilter.isNull()){
|
||||||
textFilterPath->setText(ipfilter);
|
textFilterPath->setText(ipfilter);
|
||||||
processFilterFile(ipfilter);
|
processFilterFile(ipfilter);
|
||||||
@ -1052,13 +1052,8 @@ void options_imp::on_browseSaveDirButton_clicked(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process ip filter file
|
// Parser for eMule ip filter in DAT format
|
||||||
// Supported formats:
|
void options_imp::parseDATFilterFile(QString filePath) {
|
||||||
// * eMule IP list (DAT): http://wiki.phoenixlabs.org/wiki/DAT_Format
|
|
||||||
// * PeerGuardian Text (P2P): http://wiki.phoenixlabs.org/wiki/P2P_Format (TODO)
|
|
||||||
// * PeerGuardian Binary (P2B): http://wiki.phoenixlabs.org/wiki/P2B_Format (TODO)
|
|
||||||
void options_imp::processFilterFile(QString filePath){
|
|
||||||
qDebug("Processing filter files");
|
|
||||||
QFile file(filePath);
|
QFile file(filePath);
|
||||||
QStringList IP;
|
QStringList IP;
|
||||||
if (file.exists()){
|
if (file.exists()){
|
||||||
@ -1123,6 +1118,30 @@ void options_imp::processFilterFile(QString filePath){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parser for PeerGuardian ip filter in p2p format
|
||||||
|
void options_imp::parseP2PFilterFile(QString filePath) {
|
||||||
|
std::cerr << "p2p file support was not implemented yet\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process ip filter file
|
||||||
|
// Supported formats:
|
||||||
|
// * eMule IP list (DAT): http://wiki.phoenixlabs.org/wiki/DAT_Format
|
||||||
|
// * PeerGuardian Text (P2P): http://wiki.phoenixlabs.org/wiki/P2P_Format (TODO)
|
||||||
|
// * PeerGuardian Binary (P2B): http://wiki.phoenixlabs.org/wiki/P2B_Format (TODO)
|
||||||
|
void options_imp::processFilterFile(QString filePath){
|
||||||
|
qDebug("Processing filter files");
|
||||||
|
if(filePath.endsWith(".dat", Qt::CaseInsensitive)) {
|
||||||
|
// eMule DAT file
|
||||||
|
parseDATFilterFile(filePath);
|
||||||
|
} else {
|
||||||
|
if(filePath.endsWith(".p2p", Qt::CaseInsensitive)) {
|
||||||
|
// PeerGuardian p2p file
|
||||||
|
parseP2PFilterFile(filePath);
|
||||||
|
}
|
||||||
|
// TODO: Add p2b support
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Return Filter object to apply to BT session
|
// Return Filter object to apply to BT session
|
||||||
ip_filter options_imp::getFilter() const{
|
ip_filter options_imp::getFilter() const{
|
||||||
return filter;
|
return filter;
|
||||||
|
@ -143,6 +143,8 @@ class options_imp : public QDialog, private Ui::Dialog {
|
|||||||
void disableSystrayOptions();
|
void disableSystrayOptions();
|
||||||
void setSystrayOptionsState(int checkBoxValue);
|
void setSystrayOptionsState(int checkBoxValue);
|
||||||
void enableWebUi(bool checkBoxValue);
|
void enableWebUi(bool checkBoxValue);
|
||||||
|
void parseDATFilterFile(QString filePath);
|
||||||
|
void parseP2PFilterFile(QString filePath);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setLocale(QString locale);
|
void setLocale(QString locale);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user