Browse Source

Remember the current property tab on startup

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
c73243b0d2
  1. 14
      src/propertieswidget.cpp

14
src/propertieswidget.cpp

@ -286,10 +286,11 @@ void PropertiesWidget::readSettings() {
} }
if(!settings.value("TorrentProperties/Visible", false).toBool()) { if(!settings.value("TorrentProperties/Visible", false).toBool()) {
reduce(); reduce();
} else {
main_infos_button->setStyleSheet(SELECTED_BUTTON_CSS);
//setEnabled(false);
} }
const int current_tab = settings.value("TorrentProperties/CurrentTab", MAIN_TAB).toInt();
stackedProperties->setCurrentIndex(current_tab);
if(state != REDUCED)
getButtonFromIndex(current_tab)->setStyleSheet(SELECTED_BUTTON_CSS);
} }
void PropertiesWidget::saveSettings() { void PropertiesWidget::saveSettings() {
@ -311,6 +312,8 @@ void PropertiesWidget::saveSettings() {
if(sizes.size() == 2) { if(sizes.size() == 2) {
settings.setValue(QString::fromUtf8("TorrentProperties/SplitterSizes"), QVariant(QString::number(sizes.first())+','+QString::number(sizes.last()))); settings.setValue(QString::fromUtf8("TorrentProperties/SplitterSizes"), QVariant(QString::number(sizes.first())+','+QString::number(sizes.last())));
} }
// Remember current tab
settings.setValue("TorrentProperties/CurrentTab", stackedProperties->currentIndex());
} }
void PropertiesWidget::reloadPreferences() { void PropertiesWidget::reloadPreferences() {
@ -457,6 +460,7 @@ QPushButton* PropertiesWidget::getButtonFromIndex(int index) {
void PropertiesWidget::on_main_infos_button_clicked() { void PropertiesWidget::on_main_infos_button_clicked() {
if(state == VISIBLE && stackedProperties->currentIndex() == MAIN_TAB) { if(state == VISIBLE && stackedProperties->currentIndex() == MAIN_TAB) {
reduce(); reduce();
main_infos_button->setStyleSheet(DEFAULT_BUTTON_CSS);
} else { } else {
slide(); slide();
getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS); getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS);
@ -469,6 +473,7 @@ void PropertiesWidget::on_trackers_button_clicked() {
if(state == VISIBLE && stackedProperties->currentIndex() == TRACKERS_TAB) { if(state == VISIBLE && stackedProperties->currentIndex() == TRACKERS_TAB) {
reduce(); reduce();
} else { } else {
trackers_button->setStyleSheet(DEFAULT_BUTTON_CSS);
slide(); slide();
getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS); getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS);
stackedProperties->setCurrentIndex(TRACKERS_TAB); stackedProperties->setCurrentIndex(TRACKERS_TAB);
@ -479,6 +484,7 @@ void PropertiesWidget::on_trackers_button_clicked() {
void PropertiesWidget::on_peers_button_clicked() { void PropertiesWidget::on_peers_button_clicked() {
if(state == VISIBLE && stackedProperties->currentIndex() == PEERS_TAB) { if(state == VISIBLE && stackedProperties->currentIndex() == PEERS_TAB) {
reduce(); reduce();
peers_button->setStyleSheet(DEFAULT_BUTTON_CSS);
} else { } else {
slide(); slide();
getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS); getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS);
@ -490,6 +496,7 @@ void PropertiesWidget::on_peers_button_clicked() {
void PropertiesWidget::on_url_seeds_button_clicked() { void PropertiesWidget::on_url_seeds_button_clicked() {
if(state == VISIBLE && stackedProperties->currentIndex() == URLSEEDS_TAB) { if(state == VISIBLE && stackedProperties->currentIndex() == URLSEEDS_TAB) {
reduce(); reduce();
url_seeds_button->setStyleSheet(DEFAULT_BUTTON_CSS);
} else { } else {
slide(); slide();
getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS); getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS);
@ -501,6 +508,7 @@ void PropertiesWidget::on_url_seeds_button_clicked() {
void PropertiesWidget::on_files_button_clicked() { void PropertiesWidget::on_files_button_clicked() {
if(state == VISIBLE && stackedProperties->currentIndex() == FILES_TAB) { if(state == VISIBLE && stackedProperties->currentIndex() == FILES_TAB) {
reduce(); reduce();
files_button->setStyleSheet(DEFAULT_BUTTON_CSS);
} else { } else {
slide(); slide();
getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS); getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS);

Loading…
Cancel
Save