Browse Source

ui critical fixes

pull/950/head
hypnosis-i2p 7 years ago
parent
commit
81b79e6e53
  1. 7
      qt/i2pd_qt/TunnelPane.cpp
  2. 15
      qt/i2pd_qt/mainwindow.cpp
  3. 3
      qt/i2pd_qt/mainwindow.h
  4. 6
      qt/i2pd_qt/mainwindow.ui

7
qt/i2pd_qt/TunnelPane.cpp

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
#include "QMessageBox"
#include "mainwindow.h"
#include "ui_mainwindow.h"
TunnelPane::TunnelPane(TunnelsPageUpdateListener* tunnelsPageUpdateListener_, TunnelConfig* tunnelConfig_, QWidget* wrongInputPane_, QLabel* wrongInputLabel_, MainWindow* mainWindow_):
QObject(),
@ -184,6 +185,7 @@ void TunnelPane::appendControlsForI2CPParameters(I2CPParameters& i2cpParameters, @@ -184,6 +185,7 @@ void TunnelPane::appendControlsForI2CPParameters(I2CPParameters& i2cpParameters,
void TunnelPane::updated() {
std::string oldName=tunnelConfig->getName();
//validate and show red if invalid
if(!applyDataFromUIToTunnelConfig())return;
tunnelsPageUpdateListener->updated(oldName, tunnelConfig);
}
@ -231,6 +233,9 @@ void TunnelPane::deleteTunnelForm() { @@ -231,6 +233,9 @@ void TunnelPane::deleteTunnelForm() {
void TunnelPane::highlightWrongInput(QString warningText, QWidget* controlWithWrongInput) {
wrongInputPane->setVisible(true);
wrongInputLabel->setText(warningText);
if(controlWithWrongInput)controlWithWrongInput->setFocus();
if(controlWithWrongInput){
mainWindow->ui->tunnelsScrollArea->ensureWidgetVisible(controlWithWrongInput);
controlWithWrongInput->setFocus();
}
mainWindow->showTunnelsPage();
}

15
qt/i2pd_qt/mainwindow.cpp

@ -706,7 +706,7 @@ void MainWindow::appendTunnelForms(std::string tunnelNameToFocus) { @@ -706,7 +706,7 @@ void MainWindow::appendTunnelForms(std::string tunnelNameToFocus) {
tunnelPanes.push_back(tunnelPane);
if(name==tunnelNameToFocus){
tunnelPane->getNameLineEdit()->setFocus();
//todo ui->settingsScrollArea->###scroll
ui->tunnelsScrollArea->ensureWidgetVisible(tunnelPane->getNameLineEdit());
}
continue;
}
@ -719,7 +719,7 @@ void MainWindow::appendTunnelForms(std::string tunnelNameToFocus) { @@ -719,7 +719,7 @@ void MainWindow::appendTunnelForms(std::string tunnelNameToFocus) {
tunnelPanes.push_back(tunnelPane);
if(name==tunnelNameToFocus){
tunnelPane->getNameLineEdit()->setFocus();
//todo ui->settingsScrollArea->###scroll
ui->tunnelsScrollArea->ensureWidgetVisible(tunnelPane->getNameLineEdit());
}
continue;
}
@ -765,15 +765,6 @@ void MainWindow::reloadTunnelsConfigAndUI(std::string tunnelNameToFocus) { @@ -765,15 +765,6 @@ void MainWindow::reloadTunnelsConfigAndUI(std::string tunnelNameToFocus) {
void MainWindow::SaveTunnelsConfig() {
std::stringstream out;
//validate and show red if wrong
for (std::list<TunnelPane*>::iterator it=tunnelPanes.begin(); it!=tunnelPanes.end(); ++it) {
TunnelPane* tunpane = *it;
if(!tunpane->applyDataFromUIToTunnelConfig()) {
//!valid
return;
}
}
for (std::map<std::string,TunnelConfig*>::iterator it=tunnelConfigs.begin(); it!=tunnelConfigs.end(); ++it) {
const std::string& name = it->first;
TunnelConfig* tunconf = it->second;
@ -863,6 +854,6 @@ void MainWindow::backClickedFromChild() { @@ -863,6 +854,6 @@ void MainWindow::backClickedFromChild() {
void MainWindow::highlightWrongInput(QString warningText, QWidget* widgetToFocus) {
ui->wrongInputLabel->setVisible(true);
ui->wrongInputLabel->setText(warningText);
if(widgetToFocus)widgetToFocus->setFocus();
if(widgetToFocus){ui->settingsScrollArea->ensureWidgetVisible(widgetToFocus);widgetToFocus->setFocus();}
showSettingsPage();
}

3
qt/i2pd_qt/mainwindow.h

@ -441,11 +441,12 @@ private: @@ -441,11 +441,12 @@ private:
QMenu *trayIconMenu;
#endif
public:
Ui::MainWindow* ui;
Ui::StatusButtonsForm* statusButtonsUI;
Ui::routerCommandsWidget* routerCommandsUI;
Ui::GeneralSettingsContentsForm* uiSettings;
private:
TextBrowserTweaked1 * textBrowser;
QWidget * routerCommandsParent;
PageWithBackButton * pageWithBackButton;

6
qt/i2pd_qt/mainwindow.ui

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>908</width>
<height>550</height>
<height>554</height>
</rect>
</property>
<property name="minimumSize">
@ -50,7 +50,7 @@ @@ -50,7 +50,7 @@
<x>10</x>
<y>10</y>
<width>888</width>
<height>555</height>
<height>531</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
@ -624,7 +624,7 @@ @@ -624,7 +624,7 @@
</size>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="statusPage">
<property name="sizePolicy">

Loading…
Cancel
Save