void ProfileForm::show(ContentLayout* contentLayout) { contentLayout->mainHead->layout()->addWidget(head); contentLayout->mainContent->layout()->addWidget(this); head->show(); QWidget::show(); prFileLabelUpdate(); QString DirPath = Settings::getInstance().getMakeToxPortable() ? QApplication::applicationDirPath() : QDir(Settings::getInstance().getSettingsDirPath()).path().trimmed(); bodyUI->dirPrLink->setText(bodyUI->dirPrLink->text().replace("Dir_Path",DirPath)); bodyUI->dirPrLink->setOpenExternalLinks(true); bodyUI->dirPrLink->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::TextSelectableByMouse); bodyUI->dirPrLink->setMaximumSize(bodyUI->dirPrLink->sizeHint()); bodyUI->userName->setFocus(); bodyUI->userName->selectAll(); }
void ProfileForm::show(ContentLayout* contentLayout) { contentLayout->mainContent->layout()->addWidget(this); QWidget::show(); prFileLabelUpdate(); bool portable = Settings::getInstance().getMakeToxPortable(); QString defaultPath = QDir(Settings::getInstance().getSettingsDirPath()).path().trimmed(); QString appPath = QApplication::applicationDirPath(); QString dirPath = portable ? appPath : defaultPath; QString dirPrLink = tr("Current profile location: %1").arg(QString("<a href=\"file://%1\">%1</a>").arg(dirPath)); bodyUI->dirPrLink->setText(dirPrLink); bodyUI->dirPrLink->setOpenExternalLinks(true); bodyUI->dirPrLink->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::TextSelectableByMouse); bodyUI->dirPrLink->setMaximumSize(bodyUI->dirPrLink->sizeHint()); bodyUI->userName->setFocus(); bodyUI->userName->selectAll(); }
void ProfileForm::onRenameClicked() { Nexus& nexus = Nexus::getInstance(); QString cur = nexus.getProfile()->getName(); QString title = tr("Rename \"%1\"", "renaming a profile").arg(cur); do { QString name = QInputDialog::getText(this, title, title + ":"); if (name.isEmpty()) break; name = Core::sanitize(name); if (Profile::exists(name)) GUI::showError(tr("Profile already exists", "rename failure title"), tr("A profile named \"%1\" already exists.", "rename confirm text").arg(name)); else if (!nexus.getProfile()->rename(name)) GUI::showError(tr("Failed to rename", "rename failed title"), tr("Couldn't rename the profile to \"%1\"").arg(cur)); else { prFileLabelUpdate(); break; } } while (true); }