mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 19:27:49 +02:00
various small qt gui fixes
This commit is contained in:
parent
5c3d6298b0
commit
3d5fb07ca8
4 changed files with 68 additions and 16 deletions
|
@ -57,6 +57,8 @@
|
|||
#include "SignatureTypeComboboxFactory.h"
|
||||
#include "pagewithbackbutton.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
template<typename ValueType>
|
||||
bool isType(boost::any& a) {
|
||||
return
|
||||
|
@ -97,7 +99,7 @@ public:
|
|||
std::string optName="";
|
||||
if(!option.section.isEmpty())optName=option.section.toStdString()+std::string(".");
|
||||
optName+=option.option.toStdString();
|
||||
qDebug() << "loadFromConfigOption[" << optName.c_str() << "]";
|
||||
//qDebug() << "loadFromConfigOption[" << optName.c_str() << "]";
|
||||
boost::any programOption;
|
||||
i2p::config::GetOptionAsAny(optName, programOption);
|
||||
optionValue=programOption.empty()?boost::any(std::string(""))
|
||||
|
@ -203,6 +205,21 @@ public:
|
|||
virtual void saveToStringStream(std::stringstream& out)=0;
|
||||
virtual bool isValid() { return true; }
|
||||
};
|
||||
class LogDestinationComboBoxItem : public ComboBoxItem {
|
||||
public:
|
||||
LogDestinationComboBoxItem(ConfigOption option_, QComboBox* comboBox_) : ComboBoxItem(option_, comboBox_) {};
|
||||
virtual ~LogDestinationComboBoxItem(){}
|
||||
virtual void loadFromConfigOption(){
|
||||
MainWindowItem::loadFromConfigOption();
|
||||
const char * ld = boost::any_cast<std::string>(optionValue).c_str();
|
||||
comboBox->setCurrentText(QString(ld));
|
||||
}
|
||||
virtual void saveToStringStream(std::stringstream& out){
|
||||
optionValue=comboBox->currentText().toStdString();
|
||||
MainWindowItem::saveToStringStream(out);
|
||||
}
|
||||
virtual bool isValid() { return true; }
|
||||
};
|
||||
class LogLevelComboBoxItem : public ComboBoxItem {
|
||||
public:
|
||||
LogLevelComboBoxItem(ConfigOption option_, QComboBox* comboBox_) : ComboBoxItem(option_, comboBox_) {};
|
||||
|
@ -418,14 +435,15 @@ protected:
|
|||
QString getStatusPageHtml(bool showHiddenInfo);
|
||||
|
||||
QList<MainWindowItem*> configItems;
|
||||
NonGUIOptionItem* logOption;
|
||||
NonGUIOptionItem* daemonOption;
|
||||
NonGUIOptionItem* serviceOption;
|
||||
//LogDestinationComboBoxItem* logOption;
|
||||
FileChooserItem* logFileNameOption;
|
||||
|
||||
FileChooserItem* initFileChooser(ConfigOption option, QLineEdit* fileNameLineEdit, QPushButton* fileBrowsePushButton);
|
||||
void initFolderChooser(ConfigOption option, QLineEdit* folderLineEdit, QPushButton* folderBrowsePushButton);
|
||||
//void initCombobox(ConfigOption option, QComboBox* comboBox);
|
||||
void initLogDestinationCombobox(ConfigOption option, QComboBox* comboBox);
|
||||
void initLogLevelCombobox(ConfigOption option, QComboBox* comboBox);
|
||||
void initSignatureTypeCombobox(ConfigOption option, QComboBox* comboBox);
|
||||
void initIPAddressBox(ConfigOption option, QLineEdit* addressLineEdit, QString fieldNameTranslated);
|
||||
|
@ -453,6 +471,8 @@ public slots:
|
|||
void anchorClickedHandler(const QUrl & link);
|
||||
void backClickedFromChild();
|
||||
|
||||
void logDestinationComboBoxValueChanged(const QString & text);
|
||||
|
||||
private:
|
||||
QString datadir;
|
||||
QString confpath;
|
||||
|
@ -635,13 +655,17 @@ private:
|
|||
{
|
||||
// mandatory params
|
||||
std::string dest;
|
||||
if (type == I2P_TUNNELS_SECTION_TYPE_CLIENT || type == I2P_TUNNELS_SECTION_TYPE_UDPCLIENT)
|
||||
if (type == I2P_TUNNELS_SECTION_TYPE_CLIENT || type == I2P_TUNNELS_SECTION_TYPE_UDPCLIENT) {
|
||||
dest = section.second.get<std::string> (I2P_CLIENT_TUNNEL_DESTINATION);
|
||||
std::cout << "had read tunnel dest: " << dest << std::endl;
|
||||
}
|
||||
int port = section.second.get<int> (I2P_CLIENT_TUNNEL_PORT);
|
||||
std::cout << "had read tunnel port: " << port << std::endl;
|
||||
// optional params
|
||||
std::string keys = section.second.get (I2P_CLIENT_TUNNEL_KEYS, "");
|
||||
std::string address = section.second.get (I2P_CLIENT_TUNNEL_ADDRESS, "127.0.0.1");
|
||||
int destinationPort = section.second.get (I2P_CLIENT_TUNNEL_DESTINATION_PORT, 0);
|
||||
int destinationPort = section.second.get<int>(I2P_CLIENT_TUNNEL_DESTINATION_PORT, 0);
|
||||
std::cout << "had read tunnel destinationPort: " << destinationPort << std::endl;
|
||||
i2p::data::SigningKeyType sigType = section.second.get (I2P_CLIENT_TUNNEL_SIGNATURE_TYPE, i2p::data::SIGNING_KEY_TYPE_ECDSA_SHA256_P256);
|
||||
// I2CP
|
||||
std::map<std::string, std::string> options;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue