예제 #1
0
void MainWindow::loadSettings()
{
    settings->loadSettings();

    /*main app settings*/
    resize(settings->getWindowSize());
    getColorFromSettings(settings->getBackgroundColor());
    showMenuBarAct->setChecked(settings->getShowMenuBar());
    zoomWidget->setZoomIncrement(settings->getZoomIncrement());
    imageWidget->setBGType(settings->getBGToShow());
    imageWidget->setCBSSize(settings->getSquaresSize());
    imageWidget->setRestartWhenZooming(settings->getRestartWhenZooming());
    imageWidget->setMovieSpeed(settings->getMovieSpeed());
    imageWidget->setStopWhenFinish(settings->getStopMovieWhenFinish());
    showZoomSlider  = settings->getShowZoomSlider();
    compressLevel   = settings->getCompressLevel();
    maxRecentFiles  = settings->getMaxRecentFiles();
    recentFilesPath = settings->getRecentFilesList();
    fileUtils->setSorting(FileUtils::Order(settings->getSorting()));
    createRFActs();
    adjustSizeSlot();
    showMenuBar();

    //tool bar settings
    setUpToolBar(settings->getActionsLoaded(),
                 settings->getTBArea(),
                 showZoomSlider);

    //last dir used
    lastDirUsed = settings->getLastDirUsed();
    defaultPath = settings->getDefaultPath();
    pathToUse   = settings->getPathToUse();

    this->updateActions();
}
예제 #2
0
파일: gui.cpp 프로젝트: dreamsxin/ktorrent
    void GUI::setupActions()
    {
        KActionCollection* ac = actionCollection();
        KAction* new_action = KStandardAction::openNew(this, SLOT(createTorrent()), ac);
        new_action->setToolTip(i18n("Create a new torrent"));
        KAction* open_action = KStandardAction::open(this, SLOT(openTorrent()), ac);
        open_action->setToolTip(i18n("Open a torrent"));
        paste_action = KStandardAction::paste(this, SLOT(paste()), ac);

        open_silently_action = new KAction(KIcon(open_action->icon()), i18n("Open Silently"), this);
        open_silently_action->setToolTip(i18n("Open a torrent without asking any questions"));
        connect(open_silently_action, SIGNAL(triggered()), this, SLOT(openTorrentSilently()));
        ac->addAction("file_open_silently", open_silently_action);

        KStandardAction::quit(this, SLOT(quit()), ac);

        show_status_bar_action = KStandardAction::showStatusbar(this, SLOT(showStatusBar()), ac);
        show_status_bar_action->setIcon(KIcon("kt-show-statusbar"));

        show_menu_bar_action = KStandardAction::showMenubar(this, SLOT(showMenuBar()), ac);
        KStandardAction::preferences(this, SLOT(showPrefDialog()), ac);
        KStandardAction::keyBindings(this, SLOT(configureKeys()), ac);
        KStandardAction::configureToolbars(this, SLOT(configureToolbars()), ac);
        KStandardAction::configureNotifications(this, SLOT(configureNotifications()), ac);

        paste_url_action = new KAction(KIcon("document-open-remote"), i18n("Open URL"), this);
        paste_url_action->setToolTip(i18n("Open a URL which points to a torrent, magnet links are supported"));
        paste_url_action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_P));
        connect(paste_url_action, SIGNAL(triggered()), this, SLOT(pasteURL()));
        ac->addAction("paste_url", paste_url_action);

        ipfilter_action = new KAction(KIcon("view-filter"), i18n("IP Filter"), this);
        ipfilter_action->setToolTip(i18n("Show the list of blocked IP addresses"));
        ipfilter_action->setShortcut(KShortcut(Qt::CTRL + Qt::Key_I));
        connect(ipfilter_action, SIGNAL(triggered()), this, SLOT(showIPFilter()));
        ac->addAction("ipfilter_action", ipfilter_action);

        import_action = new KAction(KIcon("document-import"), i18n("Import Torrent"), this);
        import_action->setToolTip(i18n("Import a torrent"));
        import_action->setShortcut(KShortcut(Qt::SHIFT + Qt::Key_I));
        connect(import_action, SIGNAL(triggered()), this, SLOT(import()));
        ac->addAction("import", import_action);

        show_kt_action = new KAction(KIcon("kt-show-hide"), i18n("Show/Hide KTorrent"), this);
        connect(show_kt_action, SIGNAL(triggered()), this, SLOT(showOrHide()));
        ac->addAction("show_kt", show_kt_action);
        show_kt_action->setGlobalShortcut(KShortcut(Qt::ALT + Qt::SHIFT + Qt::Key_T));

        setStandardToolBarMenuEnabled(true);
    }
예제 #3
0
void init_boe(int argc, char* argv[]) {
	init_directories(argv[0]);
	init_menubar(); // Do this first of all because otherwise a default File and Window menu will be seen
	sync_prefs();
	init_graph_tool();
	init_snd_tool();
	
	cDialog::init();
	init_sbar(text_sbar, sbar_rect, 58, 11, 58);
	init_sbar(item_sbar, item_sbar_rect, 16, 8);
	init_sbar(shop_sbar, shop_sbar_rect, 16, 8);
	init_btn(done_btn, BTN_DONE);
	init_btn(help_btn, BTN_HELP);
	
	adjust_window_mode();
	// If we don't do this now it'll flash white to start with
	mainPtr.clear(sf::Color::Black);
	mainPtr.display();
	
	make_cursor_watch();
	boost::thread init_thread([]() {
		init_buf();
		check_for_intel();
		srand(time(nullptr));
		init_screen_locs();
		Set_up_win();
		init_startup();
		flushingInput = true;
	});
	show_logo();
	if(get_bool_pref("ShowStartupSplash", true))
		plop_fancy_startup();
	init_thread.join();
	
	cUniverse::print_result = iLiving::print_result = add_string_to_buf;
	cPlayer::give_help = give_help;
	set_up_apple_events(argc, argv);
	init_fileio();
	init_spell_menus();
	init_mini_map();
	redraw_screen(REFRESH_NONE);
	showMenuBar();
}
예제 #4
0
void MainWindow::createActions()
{
    openAct = new QAction(tr("&Open"), this);
    openAct->setToolTip(tr("Open an image"));
    actionsManager->addAction(openAct, "_open", this, this, SLOT(open()), QKeySequence::Open);

    saveAct = new QAction(tr("&Save"), this);
    saveAct->setEnabled(false);
    actionsManager->addAction(saveAct, "_save", this, this, SLOT(save()), QKeySequence::Save);

    exitAct = new QAction(tr("&Exit"), this);
    actionsManager->addAction(exitAct, "_exit", this, this, SLOT(close()), QKeySequence::Quit);

    filePropertiesAct = new QAction(tr("Properties"), this);
    filePropertiesAct->setEnabled(false);
    actionsManager->addAction(filePropertiesAct, "_fileProperties", this, this,
                              SLOT(fileProperties()), QKeySequence("Ctrl+."));

    zoomInAct = new QAction(tr("Zoom In"), this);
    zoomInAct->setEnabled(false);
    actionsManager->addAction(zoomInAct, "_zoomIn", this, this, SLOT(zoomIn()), QKeySequence("+"));

    zoomOutAct = new QAction(tr("Zoom Out"), this);
    zoomOutAct->setEnabled(false);
    actionsManager->addAction(zoomOutAct, "_zoomOut", this, this, SLOT(zoomOut()), QKeySequence("-"));

    normalSizeAct = new QAction(tr("Normal Size"), this);
    normalSizeAct->setEnabled(false);
    actionsManager->addAction(normalSizeAct, "_normalSize", this, this, SLOT(normalSize()), QKeySequence("1"));

    adjustSizeAct = new QAction(tr("Best Fit"), this);
    adjustSizeAct->setEnabled(false);
    adjustSizeAct->setCheckable(true);
    actionsManager->addAction(adjustSizeAct, "_adjustSize", this, this, SLOT(adjustSizeSlot()), QKeySequence("0"));

    rotateRightAct = new QAction(tr("Rotate to right"), this);
    rotateRightAct->setToolTip(tr("Rotate image in the clockwise clock"));
    rotateRightAct->setEnabled(false);
    actionsManager->addAction(rotateRightAct, "_rotateRight", this, this, SLOT(rotateRight()));

    rotateLeftAct = new QAction(tr("Rotate to Left"), this);
    rotateLeftAct->setToolTip(tr("Rotate image counter-clockwise to clockwise"));
    rotateLeftAct->setEnabled(false);
    actionsManager->addAction(rotateLeftAct, "_rotateLeft", this, this, SLOT(rotateLeft()));

    flipVerticallyAct = new QAction(tr("Flip vertically"), this);
    flipVerticallyAct->setToolTip(tr("Turns vertically the image"));
    flipVerticallyAct->setEnabled(false);
    actionsManager->addAction(flipVerticallyAct, "_flipVertically", this, this, SLOT(flipVertically()));

    flipHorizontallyAct = new QAction(tr("Flip horizontally"), this);
    flipHorizontallyAct->setToolTip(tr("Reflects the image"));
    flipHorizontallyAct->setEnabled(false);
    actionsManager->addAction(flipHorizontallyAct, "_flipHorizontally", this, this, SLOT(flipHorizontally()));

    aboutAct = new QAction(tr("A&bout"), this);
    actionsManager->addAction(aboutAct, "_about", this, this, SLOT(about()), QKeySequence::HelpContents);

    nextAct = new QAction(tr("Ne&xt"), this);
    nextAct->setStatusTip(tr("Loads next image"));
    nextAct->setEnabled(false);
    actionsManager->addAction(nextAct, "_next", this, this, SLOT(next()), Qt::Key_Right);

    goFirstAct = new QAction(tr("Go to the first"), this);
    goFirstAct->setStatusTip(tr("Loads the first image in the folder"));
    goFirstAct->setEnabled(false);
    actionsManager->addAction(goFirstAct, "_goFirst", this, this, SLOT(goFirst()), Qt::Key_Home);

    prevAct = new QAction(tr("Pre&vious"), this);
    prevAct->setStatusTip(tr("Loads previous image"));
    prevAct->setEnabled(false);
    actionsManager->addAction(prevAct, "_previous", this, this, SLOT(previous()), Qt::Key_Left);

    goLastAct = new QAction(tr("Go to the last"), this);
    goLastAct->setStatusTip(tr("Loads the last image in the folder"));
    goLastAct->setEnabled(false);
    actionsManager->addAction(goLastAct, "_goLast", this, this, SLOT(goLast()), Qt::Key_End);

    openDirAct = new QAction(tr("Open &Folder"), this);
    openDirAct->setStatusTip("Open a folder to explore images inside it");
    actionsManager->addAction(openDirAct, "_openFolder", this, this, SLOT(openDir()), QKeySequence("Ctrl+Shift+O"));

    showMenuBarAct = new QAction(tr("Show Menu Bar"), this);
    showMenuBarAct->setCheckable(true);
    actionsManager->addAction(showMenuBarAct, "_showMenuBar", this, this, SLOT(showMenuBar()), QKeySequence("Ctrl+M"));

    configAct = new QAction(tr("Configuration"), this);
    configAct->setEnabled(true);
    actionsManager->addAction(configAct, "_configuration", this, this, SLOT(configureProgram()), QKeySequence("Ctrl+C"));

    deleteRecentFilesAct = new QAction(tr("Delete list"), this);
    deleteRecentFilesAct->setIcon(QIcon::fromTheme("edit-clear"));
    connect(deleteRecentFilesAct, SIGNAL(triggered()), this, SLOT(deleteRecentFiles()));

    printAct = new QAction(tr("Print"), this);
    printAct->setEnabled(false);
    actionsManager->addAction(printAct, "_print", this, this, SLOT(print()), QKeySequence::Print);

    deleteFileAct = new QAction(tr("Delete"), this);
    deleteFileAct->setEnabled(false);
    deleteFileAct->setToolTip(tr("This deletes completly the file from the disk, doesn't move it to the trash"));
    actionsManager->addAction(deleteFileAct, "_deleteFile", this, this, SLOT(deleteFileSlot()), QKeySequence::Delete);

    moveToAct = new QAction(tr("Move to..."), this);
    moveToAct->setEnabled(false);
    actionsManager->addAction(moveToAct, "_moveTo", this, this, SLOT(moveToSlot()));

    goToAct = new QAction(tr("Go to"), this);
    goToAct->setEnabled(false);
    actionsManager->addAction(goToAct, "_goTo", this, this, SLOT(goToSlot()), QKeySequence("Ctrl+J"));

    configureToolBarAct = new QAction(tr("Configure toolbar"), this);
    actionsManager->addAction(configureToolBarAct, "_configureToolBar", this, this, SLOT(configureToolBarSlot()));

    //set the icons, becouse QIcon::name() was included in Qt4.7
    actionsManager->setActionIcon("_about", "help-about");
    actionsManager->setActionIcon("_adjustSize", "zoom-fit-best");
    actionsManager->setActionIcon("_configuration", "configure");
    actionsManager->setActionIcon("_deleteFile", "edit-delete");
    actionsManager->setActionIcon("_exit", "application-exit");
    actionsManager->setActionIcon("_fileProperties", "document-properties");
    actionsManager->setActionIcon("_flipHorizontally", "object-flip-horizontal");
    actionsManager->setActionIcon("_flipVertically", "object-flip-vertical");
    actionsManager->setActionIcon("_goFirst", "go-first");
    actionsManager->setActionIcon("_goLast", "go-last");
    actionsManager->setActionIcon("_goTo", "go-jump");
    actionsManager->setActionIcon("_moveTo", "none");
    actionsManager->setActionIcon("_next", "go-next");
    actionsManager->setActionIcon("_normalSize", "zoom-original");
    actionsManager->setActionIcon("_open", "document-open");
    actionsManager->setActionIcon("_openFolder", "folder-open");
    actionsManager->setActionIcon("_previous", "go-previous");
    actionsManager->setActionIcon("_print", "document-print");
    actionsManager->setActionIcon("_rotateLeft", "object-rotate-left");
    actionsManager->setActionIcon("_rotateRight", "object-rotate-right");
    actionsManager->setActionIcon("_save", "document-save");
    actionsManager->setActionIcon("_showMenuBar", "show-menu");
    actionsManager->setActionIcon("_showToolBar", "configure-toolbars");
    actionsManager->setActionIcon("_tbMovable", "configure-toolbars");
    actionsManager->setActionIcon("_configureToolBar", "configure-toolbars");
    actionsManager->setActionIcon("_zoomIn", "zoom-in");
    actionsManager->setActionIcon("_zoomOut", "zoom-out");
}