FormMain::FormMain(QWidget *parent) : QMainWindow(parent), m_statusProgress(new QProgressBar(this)), m_statusLabel(new QLabel(this)), m_centralArea(new QScrollArea(this)), m_centralLayout(new QVBoxLayout(m_centralArea)), m_firstTimeShow(true), m_ui(new Ui::FormMain), m_simulatorWindow(NULL) { m_ui->setupUi(this); m_normalTitle = APP_LONG_NAME; m_unsavedTitle = m_normalTitle + " *"; m_statusProgress->setFixedHeight(m_ui->m_statusBar->sizeHint().height()); // Addd necessary widgets to status. m_ui->m_statusBar->addWidget(m_statusProgress); m_ui->m_statusBar->addWidget(m_statusLabel, 1); m_statusLabel->setVisible(false); m_statusProgress->setVisible(false); setWindowTitle(m_normalTitle); // Disable "maximize" button. setWindowFlags(windowFlags() & ~Qt::WindowMaximizeButtonHint); m_centralArea->setFrameStyle(QFrame::NoFrame); setCentralWidget(m_centralArea); setupSimulatorWindow(); setupActionShortcuts(); setupIcons(); setupTrayMenu(); setupToolbar(); loadSizeAndPosition(); createConnections(); //#if !defined(DEBUG) #if defined(DISABLE_STORE) m_ui->m_actionUploadApplicationToStore->setVisible(false); #else if (!qApp->settings()->value(APP_CFG_GEN, "enable_store", true).toBool()) { m_ui->m_actionUploadApplicationToStore->setVisible(false); } #endif #if defined(DISABLE_APK_GENERATION) m_ui->m_actionGenerateMobileApplication->setVisible(false); #else if (!qApp->settings()->value(APP_CFG_GEN, "enable_apk_generation", true).toBool()) { m_ui->m_actionGenerateMobileApplication->setVisible(false); } #endif //#endif // Make sure simulator window is displayed. m_ui->m_actionViewSimulatorWindow->setChecked(m_simulatorWindow->isVisibleOnStartup()); m_ui->m_actionStickSimulatorWindow->setChecked(m_simulatorWindow->isSticked()); }
void TimeGuard::setupUi() { setupIcons(); ui->setupUi(this); logOffAdmin(); ui->userNameLabel->setText(user->getName()); ui->logBrowser->setPlainText(fileManager->readLog(user->getName())); ui->timerLCD->displayDefaultTime(); this->setWindowIcon(programIcon); setupTray(); adminLoginDialog = new AdminLoginDialog(this, messages, admin); }
SketchToolButton::SketchToolButton(const QString &imageName, QWidget *parent, QAction* defaultAction) : QToolButton(parent) { m_imageName = imageName; // nice to have for debugging setupIcons(imageName); //DebugDialog::debug(QString("%1 %2 %3 %4 %5 %6 %7").arg(imageName) //.arg(m_enabledImage.width()).arg(m_enabledImage.height()) //.arg(m_disabledImage.width()).arg(m_disabledImage.height()) //.arg(m_pressedImage.width()).arg(m_pressedImage.height())); if(defaultAction) { setDefaultAction(defaultAction); setText(defaultAction->text()); } }
int main(int argc, char ** argv) { QStringList in; for(int i=1; i<argc; i++){ //skip the first arg (app binary) QString path = argv[i]; if(path=="."){ //Insert the current working directory in << QDir::currentPath(); }else{ if(!path.startsWith("/")){ path.prepend(QDir::currentPath()+"/"); } in << path; } } if(in.isEmpty()){ in << QDir::homePath(); } #ifdef __FreeBSD__ QtSingleApplication a(argc, argv); if( a.isRunning() ){ return !(a.sendMessage(in.join("\n"))); } #else QApplication a(argc, argv); #endif a.setApplicationName("Insight File Manager"); LuminaThemeEngine themes(&a); //Load current Locale QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); if ( ! QFile::exists(LOS::LuminaShare()+"i18n/lumina-fm_" + langCode + ".qm" ) ) langCode.truncate(langCode.indexOf("_")); translator.load( QString("lumina-fm_") + langCode, LOS::LuminaShare()+"i18n/" ); a.installTranslator( &translator ); qDebug() << "Locale:" << langCode; //Load current encoding for this locale QTextCodec::setCodecForTr( QTextCodec::codecForLocale() ); //make sure to use the same codec qDebug() << "Locale Encoding:" << QTextCodec::codecForLocale()->name(); MainUI w; QObject::connect(&a, SIGNAL(messageReceived(const QString&)), &w, SLOT(slotSingleInstance(const QString&)) ); QObject::connect(&themes, SIGNAL(updateIcons()), &w, SLOT(setupIcons()) ); w.OpenDirs(in); w.show(); int retCode = a.exec(); return retCode; }
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI) { ui->setupUi(this); //load the designer file //setupIcons(); ui->radio_apps->setChecked(true); //always default to starting here ui->tool_stop->setVisible(false); //no search running initially ui->tool_configure->setVisible(false); //app search initially set livetime = new QTimer(this); livetime->setInterval(300); //1/3 second for live searches livetime->setSingleShot(true); workthread = new QThread(this); workthread->setObjectName("Lumina Search Process"); searcher = new Worker(); searcher->moveToThread(workthread); closeShort = new QShortcut(QKeySequence(tr("Esc")), this); //Setup the connections connect(livetime, SIGNAL(timeout()), this, SLOT(startSearch()) ); connect(this, SIGNAL(SearchTerm(QString, bool)), searcher, SLOT(StartSearch(QString, bool)) ); connect(searcher, SIGNAL(FoundItem(QString)), this, SLOT(foundSearchItem(QString)) ); connect(searcher, SIGNAL(SearchUpdate(QString)), this, SLOT(searchMessage(QString)) ); connect(searcher, SIGNAL(SearchDone()), this, SLOT(searchFinished()) ); connect(ui->tool_stop, SIGNAL(clicked()), this, SLOT(stopSearch()) ); connect(ui->push_done, SIGNAL(clicked()), this, SLOT(closeApplication()) ); connect(ui->push_launch, SIGNAL(clicked()), this, SLOT(LaunchItem()) ); connect(ui->line_search, SIGNAL(textEdited(QString)), this, SLOT(searchChanged()) ); connect(ui->line_search, SIGNAL(returnPressed()), this, SLOT(LaunchItem()) ); connect(ui->radio_apps, SIGNAL(toggled(bool)), this, SLOT(searchTypeChanged()) ); connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(LaunchItem(QListWidgetItem*)) ); connect(ui->listWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(LaunchItem(QListWidgetItem*)) ); connect(ui->tool_configure, SIGNAL(clicked()), this, SLOT(configureSearch()) ); connect(closeShort, SIGNAL(activated()), this, SLOT( close() ) ); //Setup the settings file QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); settings = new QSettings("LuminaDE", "lumina-search",this); searcher->startDir = settings->value("StartSearchDir", QDir::homePath()).toString(); searcher->skipDirs = settings->value("SkipSearchDirs", QStringList()).toStringList(); updateDefaultStatusTip(); this->show(); workthread->start(); QTimer::singleShot(0,this, SLOT(setupIcons()) ); }
SketchToolButton::SketchToolButton(const QString &imageName, QWidget *parent, QList<QAction*> menuActions) : QToolButton(parent) { m_imageName = imageName; // nice to have for debugging setupIcons(imageName); QMenu *menu = new QMenu(this); for(int i=0; i < menuActions.size(); i++) { QAction* act = menuActions[i]; menu->addAction(act); if(i==0) { setDefaultAction(act); } } setMenu(menu); connect(menu,SIGNAL(aboutToHide()),this,SLOT(setEnabledIconAux())); setPopupMode(QToolButton::MenuButtonPopup); }
static int extraInitMenus(WPARAM wParam, LPARAM lParam) { extern HINSTANCE g_hInst; CLISTMENUITEM mi = {0}; //Load the icons. Later will change the menus if IcoLib is available setupIcons(); #ifdef SECUREDB CreateServiceFunction("DB3XS/SetPassword",DB3XSSetPassword); CreateServiceFunction("DB3XS/RemovePassword",DB3XSRemovePassword); #endif CreateServiceFunction(MS_DBV_VIRTUALIZE,virtualizeService); CreateServiceFunction(MS_DBV_SAVEFILE,saveFileService); if (!disableMenu){ mi.cbSize = sizeof(mi); mi.position = 0xFFffFFff; mi.flags = 0; mi.hIcon = mainIcon; // this one clist_nicer will put in the main menu mi.pszPopupName =MENUNAME; mi.pszName="Virtualize"; mi.pszService=MS_DBV_VIRTUALIZE; hVirtualizeMenu = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); mi.pszName="Save DB..."; mi.pszService=MS_DBV_SAVEFILE; hSaveFileMenu = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); #ifdef SECUREDB mi.hIcon = iconList[3];//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_ICON3)); mi.pszName=(g_secured)?"Change Password":"******"; mi.pszService="DB3XS/SetPassword"; if(!(hSetPwdMenu = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi)))return 1; mi.pszName="Remove Password"; mi.pszService="DB3XS/RemovePassword"; mi.hIcon = iconList[4];//LoadIcon(g_hInst,MAKEINTRESOURCE(IDI_ICON2)); if(!(hDelPwdMenu = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi)))return 1; #endif updateMenus(); } UnhookEvent(hOnLoadHook); hOnLoadHook = NULL; return 0; }
void SessionAnalysisWidget::setupColors() { for (int i = 0; i < ui.gridLayout->columnCount(); i += 2) { QLabel *lab = (QLabel*)ui.gridLayout->itemAtPosition(0, i)->widget(); QPalette palette = lab->palette(); palette.setColor(QPalette::Window, ColorsManager::getInstance().getDriverColors()[i]); lab->setPalette(palette); lab = (QLabel*)ui.gridLayout->itemAtPosition(1, i)->widget(); palette = lab->palette(); palette.setColor(QPalette::Window, ColorsManager::getInstance().getDriverColors()[i+1]); lab->setPalette(palette); } setupIcons(ColorsManager::getInstance().getDriverColors()); update(); }
int main(int argc, char ** argv) { QApplication a(argc, argv); LuminaThemeEngine theme(&a); a.setApplicationName("Search for..."); QTranslator translator; QLocale mylocale; QString langCode = mylocale.name(); if ( ! QFile::exists(LOS::LuminaShare()+"i18n/lumina-search_" + langCode + ".qm" ) ) langCode.truncate(langCode.indexOf("_")); translator.load( QString("lumina-search_") + langCode, LOS::LuminaShare()+"i18n/" ); a.installTranslator( &translator ); qDebug() << "Locale:" << langCode; MainUI w; QObject::connect(&theme,SIGNAL(updateIcons()), &w, SLOT(setupIcons()) ); w.show(); return a.exec(); }
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ ui->setupUi(this); //load the designer file mousegrabbed = false; XCB = new LXCB(); IMG = new ImageEditor(this); ui->scrollArea->setWidget(IMG); ui->tabWidget->setCurrentWidget(ui->tab_view); ppath = QDir::homePath(); setupIcons(); ui->spin_monitor->setMaximum(QApplication::desktop()->screenCount()); if(ui->spin_monitor->maximum()<2){ ui->spin_monitor->setEnabled(false); ui->radio_monitor->setEnabled(false); } //Setup the connections connect(ui->tool_save, SIGNAL(clicked()), this, SLOT(saveScreenshot()) ); connect(ui->actionSave_As, SIGNAL(triggered()), this, SLOT(saveScreenshot()) ); connect(ui->tool_quicksave, SIGNAL(clicked()), this, SLOT(quicksave()) ); connect(ui->actionQuick_Save, SIGNAL(triggered()), this, SLOT(quicksave()) ); connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(closeApplication()) ); connect(ui->push_snap, SIGNAL(clicked()), this, SLOT(startScreenshot()) ); connect(ui->actionTake_Screenshot, SIGNAL(triggered()), this, SLOT(startScreenshot()) ); connect(ui->tool_crop, SIGNAL(clicked()), IMG, SLOT(cropImage()) ); connect(IMG, SIGNAL(selectionChanged(bool)), this, SLOT(imgselchanged(bool)) ); settings = new QSettings("lumina-desktop", "lumina-screenshot",this); if(settings->value("screenshot-target", "window").toString() == "window") { ui->radio_window->setChecked(true); }else{ ui->radio_all->setChecked(true); } ui->spin_delay->setValue(settings->value("screenshot-delay", 0).toInt()); ui->tool_resize->setVisible(false); //not implemented yet this->show(); IMG->setDefaultSize(ui->scrollArea->maximumViewportSize()); IMG->LoadImage( QApplication::screens().at(0)->grabWindow(QApplication::desktop()->winId()).toImage() ); //initial screenshot //ui->label_screenshot->setPixmap( cpic.scaled(ui->label_screenshot->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation) ); }
FormSimulator::FormSimulator(FormMain* parent) : QDialog(parent), m_ui(new Ui::FormSimulator), m_mainWindow(parent), m_isActive(false), m_activeSimulation(NULL) { m_ui->setupUi(this); // Load some needed settings. m_isVisibleOnStartup = qApp->settings()->value(APP_CFG_SIMULATOR, "visible_on_startup", false).toBool(); m_isSticked = qApp->settings()->value(APP_CFG_SIMULATOR, "is_sticked", false).toBool(); // Do necessary initializations. setupIcons(); setupPhoneWidget(); connect(parent, SIGNAL(moved()), this, SLOT(conditionallyAttachToParent())); connect(parent, SIGNAL(resized()), this, SLOT(conditionallyAttachToParent())); connect(m_ui->m_btnRunSimulation, SIGNAL(clicked()), this, SLOT(startSimulation())); connect(m_ui->m_btnStopSimulation, SIGNAL(clicked()), this, SLOT(stopSimulation())); connect(m_ui->m_btnGoBack, SIGNAL(clicked()), this, SLOT(goBack())); connect(this, SIGNAL(stopEnableChanged(bool)), m_ui->m_btnStopSimulation, SLOT(setEnabled(bool))); // This window mustn't be deleted when closed by user. setAttribute(Qt::WA_DeleteOnClose, false); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); }
Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { ui->setupUi(this); desktopType="Application"; //default value //Setup all the icons using libLumina setupIcons(); //we copy qrc templates in the home dir of the user. //this allow the user to adapt those template to is own whishes QString templateFile = QDir::homePath() + "/.lumina/LuminaDE/fileinfo-link.template"; if (!QFile::exists(templateFile)) { QFile::copy(":defaults/fileinfo-link.template", templateFile); QFile(templateFile).setPermissions(QFileDevice::ReadUser|QFileDevice::WriteUser); } templateFile = QDir::homePath() + "/.lumina/LuminaDE/fileinfo-app.template"; if (!QFile::exists(templateFile)) { QFile::copy(":defaults/fileinfo-app.template", templateFile); QFile(templateFile).setPermissions(QFileDevice::ReadUser|QFileDevice::WriteUser); } }
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ //for Signal/slot we must register the Typedef of QFileInfoList qRegisterMetaType<QFileInfoList>("QFileInfoList"); qRegisterMetaType< LFileInfoList >("LFileInfoList"); //just to silence/fix some Qt connect warnings in QtConcurrent qRegisterMetaType< QVector<int> >("QVector<int>"); qRegisterMetaType< QList<QPersistentModelIndex> >("QList<QPersistentModelIndex>"); ui->setupUi(this); if(DEBUG){ qDebug() << "Initilization:"; } settings = new QSettings( QSettings::UserScope, "lumina-desktop", "lumina-fm", this); //syncTimer = new QTimer(this); //syncTimer->setInterval(200); //1/5 second (collect as many signals/slots as necessary //syncTimer->setSingleShot(true); //Reset the UI to the previously used size (if possible) QSize orig = settings->value("preferences/MainWindowSize", QSize()).toSize(); if(!orig.isEmpty() && orig.isValid()){ //Make sure the old size is larger than the default size hint if(orig.width() < this->sizeHint().width()){ orig.setWidth(this->sizeHint().width()); } if(orig.height() < this->sizeHint().height()){ orig.setHeight(this->sizeHint().height()); } //Also ensure the old size is smaller than the current screen size QSize screen = QApplication::desktop()->availableGeometry(this).size(); if(orig.width() > screen.width()){ orig.setWidth(screen.width()); } if(orig.height() > screen.height()){ orig.setHeight(screen.height()); } //Now resize the window this->resize(orig); } //initialize the non-ui widgets if(DEBUG){ qDebug() << " - Tab Bar Setup"; } tabBar = new QTabBar(this); tabBar->setTabsClosable(true); tabBar->setMovable(true); //tabs are independant - so allow the user to sort them tabBar->setShape(QTabBar::RoundedNorth); tabBar->setFocusPolicy(Qt::NoFocus); static_cast<QBoxLayout*>(ui->centralwidget->layout())->insertWidget(0,tabBar); if(DEBUG){ qDebug() << " - Threading"; } workThread = new QThread; workThread->setObjectName("Lumina-fm filesystem worker"); worker = new DirData(); worker->zfsavailable = LUtils::isValidBinary("zfs"); connect(worker, SIGNAL(DirDataAvailable(QString, QString, LFileInfoList)), this, SLOT(DirDataAvailable(QString, QString, LFileInfoList)) ); connect(worker, SIGNAL(SnapshotDataAvailable(QString, QString, QStringList)), this, SLOT(SnapshotDataAvailable(QString, QString, QStringList)) ); worker->moveToThread(workThread); if(DEBUG){ qDebug() << " - File System Model"; } fsmod = new QFileSystemModel(this); fsmod->setRootPath(QDir::homePath()); dirCompleter = new QCompleter(fsmod, this); dirCompleter->setModelSorting( QCompleter::CaseInsensitivelySortedModel ); if(DEBUG){ qDebug() << " - Context Menu"; } contextMenu = new QMenu(this); radio_view_details = new QRadioButton(tr("Detailed List"), this); radio_view_list = new QRadioButton(tr("Basic List"), this); radio_view_tabs = new QRadioButton(tr("Prefer Tabs"), this); radio_view_cols = new QRadioButton(tr("Prefer Columns"), this); ui->menuView_Mode->clear(); ui->menuGroup_Mode->clear(); detWA = new QWidgetAction(this); detWA->setDefaultWidget(radio_view_details); listWA = new QWidgetAction(this); listWA->setDefaultWidget(radio_view_list); tabsWA = new QWidgetAction(this); tabsWA->setDefaultWidget(radio_view_tabs); colsWA = new QWidgetAction(this); colsWA->setDefaultWidget(radio_view_cols); ui->menuView_Mode->addAction(detWA); ui->menuView_Mode->addAction(listWA); ui->menuGroup_Mode->addAction(tabsWA); ui->menuGroup_Mode->addAction(colsWA); //Setup the pages //ui->BrowserLayout->clear(); ui->page_player->setLayout(new QVBoxLayout()); ui->page_image->setLayout(new QVBoxLayout()); MW = new MultimediaWidget(this); SW = new SlideshowWidget(this); ui->page_player->layout()->addWidget(MW); ui->page_image->layout()->addWidget(SW); //Setup any specialty keyboard shortcuts if(DEBUG){ qDebug() << " - Keyboard Shortcuts"; } nextTabLShort = new QShortcut( QKeySequence(tr("Shift+Left")), this); nextTabRShort = new QShortcut( QKeySequence(tr("Shift+Right")), this); togglehiddenfilesShort = new QShortcut( QKeySequence(tr("Ctrl+H")), this); //Finish loading the interface workThread->start(); if(DEBUG){ qDebug() << " - Icons"; } setupIcons(); if(DEBUG){ qDebug() << " - Connections"; } setupConnections(); if(DEBUG){ qDebug() << " - Settings"; } loadSettings(); if(DEBUG){ qDebug() << " - Bookmarks"; } RebuildBookmarksMenu(); if(DEBUG){ qDebug() << " - Devices"; } RebuildDeviceMenu(); //Make sure we start on the browser page if(DEBUG){ qDebug() << " - Load Browser Page"; } //goToBrowserPage(); if(DEBUG){ qDebug() << " - Done with init"; } }
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ //for Signal/slot we must register the Typedef of QFileInfoList qRegisterMetaType<QFileInfoList>("QFileInfoList"); qRegisterMetaType< LFileInfoList >("LFileInfoList"); ui->setupUi(this); if(DEBUG){ qDebug() << "Initilization:"; } //Be careful about the QSettings setup, it must match the lumina-desktop setup QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); settings = new QSettings( QSettings::UserScope, "LuminaDE", "lumina-fm", this); favdir = QDir::homePath()+"/.lumina/favorites/"; //save this for later //syncTimer = new QTimer(this); //syncTimer->setInterval(200); //1/5 second (collect as many signals/slots as necessary //syncTimer->setSingleShot(true); //Reset the UI to the previously used size (if possible) if(DEBUG){ qDebug() << " - Reset window size"; } int height = settings->value("geometry/height",-1).toInt(); if(height>100 && height <= QApplication::desktop()->availableGeometry(this).height()){ this->resize(this->width(), height); } int width = settings->value("geometry/width",-1).toInt(); if(width>100 && width <= QApplication::desktop()->availableGeometry(this).width()){ this->resize(width, this->height() ); } //initialize the non-ui widgets if(DEBUG){ qDebug() << " - Tab Bar Setup"; } tabBar = new QTabBar(this); tabBar->setTabsClosable(true); tabBar->setMovable(true); //tabs are independant - so allow the user to sort them tabBar->setShape(QTabBar::RoundedNorth); tabBar->setFocusPolicy(Qt::NoFocus); static_cast<QBoxLayout*>(ui->centralwidget->layout())->insertWidget(0,tabBar); if(DEBUG){ qDebug() << " - Threading"; } workThread = new QThread; workThread->setObjectName("Lumina-fm filesystem worker"); worker = new DirData(); worker->zfsavailable = LUtils::isValidBinary("zfs"); connect(worker, SIGNAL(DirDataAvailable(QString, QString, LFileInfoList)), this, SLOT(DirDataAvailable(QString, QString, LFileInfoList)) ); connect(worker, SIGNAL(SnapshotDataAvailable(QString, QString, QStringList)), this, SLOT(SnapshotDataAvailable(QString, QString, QStringList)) ); worker->moveToThread(workThread); if(DEBUG){ qDebug() << " - File System Model"; } fsmod = new QFileSystemModel(this); fsmod->setRootPath(QDir::homePath()); dirCompleter = new QCompleter(fsmod, this); dirCompleter->setModelSorting( QCompleter::CaseInsensitivelySortedModel ); if(DEBUG){ qDebug() << " - Context Menu"; } contextMenu = new QMenu(this); radio_view_details = new QRadioButton(tr("Detailed List"), this); radio_view_list = new QRadioButton(tr("Basic List"), this); radio_view_tabs = new QRadioButton(tr("Prefer Tabs"), this); radio_view_cols = new QRadioButton(tr("Prefer Columns"), this); ui->menuView_Mode->clear(); ui->menuGroup_Mode->clear(); detWA = new QWidgetAction(this); detWA->setDefaultWidget(radio_view_details); listWA = new QWidgetAction(this); listWA->setDefaultWidget(radio_view_list); tabsWA = new QWidgetAction(this); tabsWA->setDefaultWidget(radio_view_tabs); colsWA = new QWidgetAction(this); colsWA->setDefaultWidget(radio_view_cols); ui->menuView_Mode->addAction(detWA); ui->menuView_Mode->addAction(listWA); ui->menuGroup_Mode->addAction(tabsWA); ui->menuGroup_Mode->addAction(colsWA); //Setup the pages //ui->BrowserLayout->clear(); ui->page_player->setLayout(new QVBoxLayout()); ui->page_image->setLayout(new QVBoxLayout()); MW = new MultimediaWidget(this); SW = new SlideshowWidget(this); ui->page_player->layout()->addWidget(MW); ui->page_image->layout()->addWidget(SW); //Setup any specialty keyboard shortcuts if(DEBUG){ qDebug() << " - Keyboard Shortcuts"; } nextTabLShort = new QShortcut( QKeySequence(tr("Shift+Left")), this); nextTabRShort = new QShortcut( QKeySequence(tr("Shift+Right")), this); closeTabShort = new QShortcut( QKeySequence(tr("Ctrl+W")), this); //Finish loading the interface workThread->start(); if(DEBUG){ qDebug() << " - Icons"; } setupIcons(); if(DEBUG){ qDebug() << " - Connections"; } setupConnections(); if(DEBUG){ qDebug() << " - Settings"; } loadSettings(); if(DEBUG){ qDebug() << " - Bookmarks"; } RebuildBookmarksMenu(); if(DEBUG){ qDebug() << " - Devices"; } RebuildDeviceMenu(); //Make sure we start on the browser page if(DEBUG){ qDebug() << " - Load Browser Page"; } //goToBrowserPage(); if(DEBUG){ qDebug() << " - Done with init"; } }
KRenameWindow::KRenameWindow(QWidget *parent) : KMainWindow(parent), m_curPage(0), m_guiMode(nullptr), m_fileCount(0) { QWidget *center = new QWidget(); QVBoxLayout *layout = new QVBoxLayout(center); m_delegate = new RichTextItemDelegate(this); m_tabBar = new QTabBar(center); m_stack = new QStackedWidget(center); m_buttons = new QDialogButtonBox(center); layout->addWidget(m_tabBar); layout->addWidget(m_stack); layout->addWidget(new KSeparator(Qt::Horizontal, center)); layout->addWidget(m_buttons); layout->setStretchFactor(m_stack, 2); this->setCentralWidget(center); for (int i = 0; i < tAdvancedMode.numPages; i++) { const QIcon &icon = KIconLoader::global()->loadIcon(tAdvancedMode.pageIcons[i], KIconLoader::NoGroup, KIconLoader::SizeSmall); m_tabBar->addTab(icon, i18n(tAdvancedMode.pageTitles[i])); } m_pageFiles = new Ui::KRenameFiles(); m_pageDests = new Ui::KRenameDestination(); m_pagePlugins = new Ui::KRenamePlugins(); m_pageFilename = new Ui::KRenameFilename(); // add files page QWidget *page = new QWidget(m_stack); m_pageFiles->setupUi(page); m_stack->addWidget(page); // add destination page page = new QWidget(m_stack); m_pageDests->setupUi(page); m_stack->addWidget(page); // add plugin page page = new QWidget(m_stack); m_pagePlugins->setupUi(page); m_stack->addWidget(page); // add filename page page = new QWidget(m_stack); m_pageFilename->setupUi(page); m_stack->addWidget(page); setupGui(); setupPlugins(); setupIcons(); StartUpInfo *startUp = new StartUpInfo(); connect(startUp, &StartUpInfo::addFiles, this, &KRenameWindow::addFiles); connect(startUp, &StartUpInfo::enterTemplate, this, &KRenameWindow::slotGotoTemplatesPage); m_pageDests->urlrequester->setMode(KFile::Directory | KFile::ExistingOnly); m_pageFiles->fileList->setItemDelegate(m_delegate); m_pageFiles->fileList->setInfoWidget(startUp); // Make sure that now signal occurs before setupGui was called connect(m_tabBar, &QTabBar::currentChanged, this, &KRenameWindow::showPage); connect(m_buttonClose, &QPushButton::clicked, this, &KRenameWindow::close); connect(m_buttons, &QDialogButtonBox::accepted, this, &KRenameWindow::slotFinish); this->setAutoSaveSettings("KRenameWindowSettings", true); // Show the first page in any mode showPage(0); }