From 5e1a4be1348dfe1a89d38203450c7867940f5a9b Mon Sep 17 00:00:00 2001 From: arcan1s Date: Mon, 14 Jul 2014 19:36:14 +0400 Subject: [PATCH] add openProfile --- sources/gui/src/about.ui | 4 ++-- sources/gui/src/main.cpp | 36 ++++++++++++++++++++++------------ sources/gui/src/mainwindow.cpp | 13 ++++++++++-- sources/gui/src/mainwindow.h | 3 ++- 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/sources/gui/src/about.ui b/sources/gui/src/about.ui index a4510b9..1b82898 100644 --- a/sources/gui/src/about.ui +++ b/sources/gui/src/about.ui @@ -6,8 +6,8 @@ 0 0 - 396 - 296 + 394 + 294 diff --git a/sources/gui/src/main.cpp b/sources/gui/src/main.cpp index a759314..85c33d5 100644 --- a/sources/gui/src/main.cpp +++ b/sources/gui/src/main.cpp @@ -61,6 +61,7 @@ int main(int argc, char *argv[]) bool showNetctlAuto = false; bool showSettings = false; bool showVersion = false; + QString openProfile = QString("PROFILE"); int tabNumber = 1; for (int i=1; isetupUi(this); ui->tabWidget->setCurrentIndex(tabNum-1); @@ -107,6 +109,12 @@ MainWindow::MainWindow(QWidget *parent, updateTabs(ui->tabWidget->currentIndex()); ui->statusBar->showMessage(QApplication::translate("MainWindow", "Ready")); + if (openProfile != QString("PROFILE")) { + ui->comboBox_profile->addItem(openProfile); + ui->comboBox_profile->setCurrentIndex(ui->comboBox_profile->count()-1); + profileTabLoadProfile(); + } + if (showAbout) aboutWin->show(); if (showNetctlAuto) @@ -599,7 +607,8 @@ void MainWindow::mainTabEditProfile() ui->tabWidget->setDisabled(true); QString profile = ui->tableWidget_main->item(ui->tableWidget_main->currentItem()->row(), 0)->text(); ui->tabWidget->setCurrentIndex(1); - ui->comboBox_profile->setCurrentIndex(ui->comboBox_profile->findText(profile)); + ui->comboBox_profile->addItem(profile); + ui->comboBox_profile->setCurrentIndex(ui->comboBox_profile->count()-1); profileTabLoadProfile(); } diff --git a/sources/gui/src/mainwindow.h b/sources/gui/src/mainwindow.h index 0ba4d23..c9296eb 100644 --- a/sources/gui/src/mainwindow.h +++ b/sources/gui/src/mainwindow.h @@ -58,7 +58,8 @@ public: const bool showAbout = false, const bool showNetctlAuto = false, const bool showSettings = false, - const int tabNum = 1); + const int tabNum = 1, + const QString openProfile = QString("PROFILE")); ~MainWindow(); public slots: