Ejemplo n.º 1
0
void BookmarksDialog::createDialogContent()
{
	ui->setupUi(dialog);
	
	//Signals and slots
	connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
	connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
	connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));

	connect(ui->addBookmarkButton, SIGNAL(clicked()), this, SLOT(addBookmarkButtonPressed()));
	connect(ui->removeBookmarkButton, SIGNAL(clicked()), this, SLOT(removeBookmarkButtonPressed()));
	connect(ui->goToButton, SIGNAL(clicked()), this, SLOT(goToBookmarkButtonPressed()));
	connect(ui->clearBookmarksButton, SIGNAL(clicked()), this, SLOT(clearBookmarksButtonPressed()));
	connect(ui->bookmarksTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(selectCurrentBookmark(QModelIndex)));

	connect(ui->clearHighlightsButton, SIGNAL(clicked()), this, SLOT(clearHighlightsButtonPressed()));
	connect(ui->highlightBookmarksButton, SIGNAL(clicked()), this, SLOT(highlightBookrmarksButtonPressed()));

	connect(ui->importBookmarksButton, SIGNAL(clicked()), this, SLOT(importBookmarks()));
	connect(ui->exportBookmarksButton, SIGNAL(clicked()), this, SLOT(exportBookmarks()));

	//Initializing the list of bookmarks
	bookmarksListModel->setColumnCount(ColumnCount);
	setBookmarksHeaderNames();

	ui->bookmarksTreeView->setModel(bookmarksListModel);
	ui->bookmarksTreeView->header()->setSectionsMovable(false);
	ui->bookmarksTreeView->header()->setSectionResizeMode(ColumnName, QHeaderView::ResizeToContents);
	ui->bookmarksTreeView->header()->setStretchLastSection(true);
	ui->bookmarksTreeView->hideColumn(ColumnUUID);

	loadBookmarks();
}
Ejemplo n.º 2
0
void MpcImportWindow::createDialogContent()
{
	ui->setupUi(dialog);

	//Signals
	connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
	connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
	connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));

	connect(ui->pushButtonAcquire, SIGNAL(clicked()),
	        this, SLOT(acquireObjectData()));
	connect(ui->pushButtonAbortDownload, SIGNAL(clicked()),
	        this, SLOT(abortDownload()));
	connect(ui->pushButtonAdd, SIGNAL(clicked()), this, SLOT(addObjects()));
	connect(ui->pushButtonDiscard, SIGNAL(clicked()),
	        this, SLOT(discardObjects()));

	connect(ui->pushButtonBrowse, SIGNAL(clicked()), this, SLOT(selectFile()));
	connect(ui->comboBoxBookmarks, SIGNAL(currentIndexChanged(QString)),
	        this, SLOT(bookmarkSelected(QString)));

	connect(ui->radioButtonFile, SIGNAL(toggled(bool)),
	        ui->frameFile, SLOT(setVisible(bool)));
	connect(ui->radioButtonURL, SIGNAL(toggled(bool)),
	        ui->frameURL, SLOT(setVisible(bool)));

	connect(ui->radioButtonAsteroids, SIGNAL(toggled(bool)),
	        this, SLOT(switchImportType(bool)));
	connect(ui->radioButtonComets, SIGNAL(toggled(bool)),
	        this, SLOT(switchImportType(bool)));

	connect(ui->pushButtonMarkAll, SIGNAL(clicked()),
	        this, SLOT(markAll()));
	connect(ui->pushButtonMarkNone, SIGNAL(clicked()),
	        this, SLOT(unmarkAll()));

	connect(ui->pushButtonSendQuery, SIGNAL(clicked()),
	        this, SLOT(sendQuery()));
	connect(ui->lineEditQuery, SIGNAL(returnPressed()),
		this, SLOT(sendQuery()));
	connect(ui->pushButtonAbortQuery, SIGNAL(clicked()),
	        this, SLOT(abortQuery()));
	connect(ui->lineEditQuery, SIGNAL(textEdited(QString)),
	        this, SLOT(resetNotFound()));
	//connect(ui->lineEditQuery, SIGNAL(editingFinished()), this, SLOT(sendQuery()));
	connect(countdownTimer, SIGNAL(timeout()), this, SLOT(updateCountdown()));

	QSortFilterProxyModel * filterProxyModel = new QSortFilterProxyModel(this);
	filterProxyModel->setSourceModel(candidateObjectsModel);
	filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
	ui->listViewObjects->setModel(filterProxyModel);
	connect(ui->lineEditSearch, SIGNAL(textChanged(const QString&)),
	        filterProxyModel, SLOT(setFilterFixedString(const QString&)));

	loadBookmarks();
	updateTexts();

	resetCountdown();
	resetDialog();
}
Ejemplo n.º 3
0
void DialogBookmarks::deleteBookmark() {
    QSettings settings("mir", "Contra");
    if(ui->listWidget->currentItem()) {
        qint32 row = ui->listWidget->currentRow();
        qint32 bookmarkCount = settings.value("bookmarkCount", 0).toInt();
        settings.remove("bookmarkname"+QString::number(row));
        settings.remove("bookmarkaddress"+QString::number(row));
        settings.remove("bookmarklogin"+QString::number(row));
        settings.remove("bookmarkpassword"+QString::number(row));
        for(qint32 i=row; i<bookmarkCount-1; i++) {
            settings.setValue("bookmarkname"+QString::number(i), settings.value("bookmarkname"+QString::number(i+1)).toString());
            settings.setValue("bookmarkaddress"+QString::number(i), settings.value("bookmarkaddress"+QString::number(i+1)).toString());
            settings.setValue("bookmarklogin"+QString::number(i), settings.value("bookmarklogin"+QString::number(i+1)).toString());
            settings.setValue("bookmarkpassword"+QString::number(i), settings.value("bookmarkpassword"+QString::number(i+1)).toString());
        }
        settings.remove("bookmarkname"+QString::number(bookmarkCount-1));
        settings.remove("bookmarkaddress"+QString::number(bookmarkCount-1));
        settings.remove("bookmarklogin"+QString::number(bookmarkCount-1));
        settings.remove("bookmarkpassword"+QString::number(bookmarkCount-1));
        bookmarkCount--;
        settings.setValue("bookmarkCount", bookmarkCount);

        qDebug() << "Deleted item " << ui->listWidget->currentRow();
        loadBookmarks();
    }
}
Ejemplo n.º 4
0
PlacesItemModel::PlacesItemModel(QObject* parent) :
    KStandardItemModel(parent),
    m_fileIndexingEnabled(false),
    m_hiddenItemsShown(false),
    m_availableDevices(),
    m_predicate(),
    m_bookmarkManager(0),
    m_systemBookmarks(),
    m_systemBookmarksIndexes(),
    m_bookmarkedItems(),
    m_hiddenItemToRemove(-1),
    m_updateBookmarksTimer(0),
    m_storageSetupInProgress()
{
#ifdef HAVE_BALOO
    Baloo::IndexerConfig config;
    m_fileIndexingEnabled = config.fileIndexingEnabled();
#endif
    const QString file = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/user-places.xbel";
    m_bookmarkManager = KBookmarkManager::managerForExternalFile(file);

    createSystemBookmarks();
    initializeAvailableDevices();
    loadBookmarks();

    const int syncBookmarksTimeout = 100;

    m_updateBookmarksTimer = new QTimer(this);
    m_updateBookmarksTimer->setInterval(syncBookmarksTimeout);
    m_updateBookmarksTimer->setSingleShot(true);
    connect(m_updateBookmarksTimer, &QTimer::timeout, this, &PlacesItemModel::updateBookmarks);

    connect(m_bookmarkManager, &KBookmarkManager::changed,
            m_updateBookmarksTimer, static_cast<void(QTimer::*)()>(&QTimer::start));
}
Ejemplo n.º 5
0
MainWindow::MainWindow()
 : QMainWindow(), allBookmarkConnections(NULL)
{
	loadBookmarks();
	initGui();
	createMenu();
	// tell Qt to delete windows when it is closed
	setAttribute(Qt::WA_DeleteOnClose);
}
Ejemplo n.º 6
0
void BookmarksDialog::importBookmarks()
{
	QString originalBookmarksFile = bookmarksJsonPath;

	QString filter = "JSON (*.json)";
	bookmarksJsonPath = QFileDialog::getOpenFileName(Q_NULLPTR, q_("Import bookmarks"), QDir::homePath(), filter);

	loadBookmarks();

	bookmarksJsonPath = originalBookmarksFile;
	saveBookmarks();
}
Ejemplo n.º 7
0
Archivo: Dtb.cpp Proyecto: daisy/amis
//--------------------------------------------------
//open an NCC or OPF file
//--------------------------------------------------
bool amis::dtb::Dtb::open(const ambulant::net::url* fileUrl, 
						  const ambulant::net::url* bookmarksDirectory, 
						  amis::BookList* history)
{
	cleanUpObjects();
	mpHistory = history;
	string log_msg = "Opening book: " + fileUrl->get_url();
	amis::util::Log::Instance()->writeMessage(log_msg, "Dtb::open"); 

	mpFiles = NULL;
	mpFiles = new amis::dtb::DtbFileSet();
	mpFiles->initWithNccOrOpf(fileUrl, mpFileSearcher);
	mpFiles->setBookmarksDirectory(bookmarksDirectory);
	
	mpCurrentNavNode = NULL;
	if (DtbFileSet::isNccFile(fileUrl))
	{
		amis::util::Log::Instance()->writeMessage("This is a DAISY 2.02 book", "Dtb::open");	
		mDaisyVersion = DAISY_202;
		if (mThreadYielder != 0) mThreadYielder->peekAndPump();
		if (!processNcc(mpFiles->getNavFilepath(), fileUrl->is_local_file()))
		{
			return false;
		}
	}
	else if (DtbFileSet::isOpfFile(fileUrl))
	{
		if (mThreadYielder != 0) mThreadYielder->peekAndPump();
		if (!processOpf(mpFiles->getOpfFilepath()))
		{
			return false;
		}
		mDaisyVersion = DAISY_2005;
		amis::util::Log::Instance()->writeMessage("This is a Daisy 2005 book", "Dtb::open");
		if (!processNcx(mpFiles->getNavFilepath(), fileUrl->is_local_file())) return false;
		//if (!processDaisyResourceFile(mpFiles->getResourceFilepath())) return false;
	}
	else
	{ 
		mDaisyVersion = UNSUPPORTED;
		amis::util::Log::Instance()->writeWarning("The type of book could not be determined", 
			"Dtb::open");
		return false;
	}
	
	loadBookmarks(mpFiles->getBookmarksFilepath());
	amis::util::Log::Instance()->writeMessage("Opened book successfully", "Dtb::open");
	
	return true;
}
Ejemplo n.º 8
0
void MediaBrowser::slotDelBookmark()
{
	int idx = m_bookmarkBox->currentIndex();
	if(idx >= 0 && idx <= m_bookmarkList.size()-1)
	{
		if(QMessageBox::question(this,"Delete Bookmark?",QString("Are you sure you want to delete this bookmark?")) == QMessageBox::Ok)
		{
			m_bookmarkList.removeAt(idx);
			m_ignoreBookmarkIdxChange = true;
			saveBookmarks(); // Write to qsettings
			loadBookmarks(); // Read back from qsettings and update combo box
			m_ignoreBookmarkIdxChange = false;
		}
	}
}
Ejemplo n.º 9
0
MainWindow::MainWindow(const QUrl &url) : ui(new Ui::MainWindow), progress(0)
{
    ui->setupUi(this);

    bookmarkDB = std::unique_ptr<BookmarkDB>{ new BookmarkDB };

    createWidgets(url);
    createActions();
    createMenus();
    createConnections();
    createLayout();

    view->load(url);
    startRequest(url);
    pageTimer->start(1000 * 120);
    loadBookmarks();
}
Ejemplo n.º 10
0
DialogBookmarks::DialogBookmarks(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DialogBookmarks)
{
    ui->setupUi(this);

    //setWindowFlags(Qt::WindowTitleHint);

    connect(ui->listWidget, SIGNAL(clicked(QModelIndex)), this, SLOT(selectedBookmark()));
    connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(newBookmark()));
    connect(ui->pushButton_2, SIGNAL(clicked()), SLOT(deleteBookmark()));

    connect(ui->lineEdit, SIGNAL(textEdited(QString)), this, SLOT(saveBookmark()));
    connect(ui->lineEdit_2, SIGNAL(textEdited(QString)), this, SLOT(saveBookmark()));
    connect(ui->lineEdit_3, SIGNAL(textEdited(QString)), this, SLOT(saveBookmark()));
    connect(ui->lineEdit_4, SIGNAL(textEdited(QString)), this, SLOT(saveBookmark()));

    connect(this, SIGNAL(finished(int)), this, SLOT(saveBookmark()));

    loadBookmarks();
}
Ejemplo n.º 11
0
void MediaBrowser::slotBookmarkFolder()
{
	QString dir = m_currentDirectory;
	QString title = QDir(dir).dirName();
	
	bool ok;
	QString text = QInputDialog::getText(this, "Bookmark title",
		QString("Please enter a title for this folder:"),
		QLineEdit::Normal,
		title, &ok);
		
	if(ok && !text.isEmpty())
		title = text;
		
	
	m_bookmarkList << QPair<QString,QString>(dir,title);
	
	m_ignoreBookmarkIdxChange = true;
	saveBookmarks(); // Write to qsettings
	loadBookmarks(); // Read back from qsettings and update combo box
	m_ignoreBookmarkIdxChange = false;
	
	m_bookmarkBox->setCurrentIndex(m_bookmarkList.size() - 2); // -2 because last item in combobox is a "placeholder" entry
}
Ejemplo n.º 12
0
void MediaBrowser::setupUI()
{
	QVBoxLayout *vbox0 = new QVBoxLayout(this);
	m_splitter = new QSplitter(this);
	m_splitter->setOrientation(Qt::Vertical);
	vbox0->addWidget(m_splitter);

	QWidget *browser = new QWidget(m_splitter);
	QVBoxLayout *vbox = new QVBoxLayout(browser);
	SET_MARGIN(vbox,0);

	// Setup filter box at the top of the widget
	m_searchBase = new QWidget(browser);

	QHBoxLayout *hbox = new QHBoxLayout(m_searchBase);
	SET_MARGIN(hbox,0);

	m_btnBack = new QPushButton(QIcon(":/data/stock-go-back.png"),"");
	m_btnBack->setEnabled(false);
	connect(m_btnBack, SIGNAL(clicked()), this, SLOT(goBack()));

	m_btnForward = new QPushButton(QIcon(":/data/stock-go-forward.png"),"");
	m_btnForward->setEnabled(false);
	connect(m_btnForward, SIGNAL(clicked()), this, SLOT(goForward()));

	m_btnUp = new QPushButton(QIcon(":/data/stock-go-up.png"),"");
	m_btnUp->setEnabled(false);
	connect(m_btnUp, SIGNAL(clicked()), this, SLOT(goUp()));

	QLabel *label = new QLabel("Fil&ter:");
	m_searchBox = new QLineEdit(m_searchBase);
	label->setBuddy(m_searchBox);

	m_clearSearchBtn = new QPushButton(QIcon(":/data/stock-clear.png"),"");
	m_clearSearchBtn->setVisible(false);

	hbox->addWidget(m_btnBack);
	hbox->addWidget(m_btnForward);
	hbox->addWidget(m_btnUp);
	hbox->addWidget(label);
	hbox->addWidget(m_searchBox);
	hbox->addWidget(m_clearSearchBtn);

	connect(m_searchBox, SIGNAL(textChanged(const QString &)), this, SLOT(filterChanged(const QString &)));
	connect(m_searchBox, SIGNAL(returnPressed()), this, SLOT(filterReturnPressed()));
	connect(m_clearSearchBtn, SIGNAL(clicked()), this, SLOT(clearFilter()));
	
	// Now for the list itself
	m_listView = new MediaBrowserQListView(browser);
	m_listView->setAlternatingRowColors(true);
	m_listView->setIconSize(m_iconSize);
	//m_listView->setWrapping(true);
	m_listView->setWordWrap(true);
	//m_listView->setGridSize(MEDIABROWSER_LIST_ICON_SIZE);
	m_listView->setLayoutMode(QListView::Batched);
	//m_listView->setFlow(QListView::LeftToRight);
	m_listView->setResizeMode(QListView::Adjust);
	//m_listView->setSelectionMode(QAbstractItemView::SingleSelection);

	// below doesnt seem to be enough
	//m_listView->setEditTriggers(QAbstractItemView::SelectedClicked | QAbstractItemView::EditKeyPressed);

	m_fsModel = new DirectoryListModel(browser); //QFileSystemModel(browser);
	m_fsModel->setIconProvider(new MyQFileIconProvider());
	//m_fsModel->setNameFilterDisables(false);

	m_listView->setModel(m_fsModel);

	connect(m_listView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(indexDoubleClicked(const QModelIndex &)));
	connect(m_listView,     SIGNAL(activated(const QModelIndex &)), this, SLOT(indexDoubleClicked(const QModelIndex &)));
	connect(m_listView,       SIGNAL(clicked(const QModelIndex &)), this, SLOT(indexSingleClicked(const QModelIndex &)));

	////////////////////////
	
	// Add action buttons
	m_btnBase = new QWidget(browser);
	QHBoxLayout *hbox3 = new QHBoxLayout(m_btnBase);
	SET_MARGIN(hbox3,0);

	m_btnSetAsBgLive = new QPushButton(QIcon(":/data/stock-apply-ffwd.png"),"");
	m_btnSetAsBgLive->setToolTip("Set selected file as background for the current live slide");
	hbox3->addWidget(m_btnSetAsBgLive);

	m_btnAddToSchedue = new QPushButton(QIcon(":/data/stock-add.png"),"");
	m_btnAddToSchedue->setToolTip("Add selected file to schedule");
	hbox3->addWidget(m_btnAddToSchedue);

	m_btnSetAsBgLater = new QPushButton(QIcon(":/data/stock-apply-next.png"),"");
	m_btnSetAsBgLater->setToolTip("Set selected file as background for the NEXT slide to go live");
	hbox3->addWidget(m_btnSetAsBgLater);

	m_btnSetAsBgCurrent = new QPushButton(QIcon(":/data/stock-apply-pause.png"),"");
	m_btnSetAsBgCurrent->setToolTip("Set selected file as background for the selected slide group");
	hbox3->addWidget(m_btnSetAsBgCurrent);

	connect(m_btnAddToSchedue, SIGNAL(clicked()), this, SLOT(slotAddToSchedule()));
	connect(m_btnSetAsBgCurrent, SIGNAL(clicked()), this, SLOT(slotSetAsBgCurrent()));
	connect(m_btnSetAsBgLater, SIGNAL(clicked()), this, SLOT(slotSetAsBgLater()));
	connect(m_btnSetAsBgLive, SIGNAL(clicked()), this, SLOT(slotSetAsBgLive()));

	// enabled by indexSingleClicked()
	m_btnBase->setEnabled(false);
	
	/////////////////

	// Add the directory box and filter box at bottom
	m_folderBoxBase = new QWidget(browser);
	QHBoxLayout *hbox2 = new QHBoxLayout(m_folderBoxBase);
	SET_MARGIN(hbox2,0);
	
	hbox2->addWidget(new QLabel("Folder:"));
	
	m_dirBox = new QLineEdit(m_folderBoxBase);
	hbox2->addWidget(m_dirBox);
	
	m_filterBox = new QComboBox(m_folderBoxBase);
	hbox2->addWidget(m_filterBox);

	connect(m_dirBox, SIGNAL(returnPressed()), this, SLOT(dirBoxReturnPressed()));
	connect(m_filterBox, SIGNAL(currentIndexChanged(int)), this, SLOT(fileTypeChanged(int)));
	
	//#######################################333
	
	
	m_bookmarkBase = new QWidget(browser);
	
	QHBoxLayout *hbox4 = new QHBoxLayout(m_bookmarkBase);
	SET_MARGIN(hbox4,0);
	
	hbox4->addWidget(new QLabel("Saved:"));
	
	m_bookmarkBox = new QComboBox(m_bookmarkBase);
	hbox4->addWidget(m_bookmarkBox,2);

	m_btnBookmark = new QPushButton(QIcon(":/data/stock-new.png"),"");
	m_btnBookmark->setToolTip("Bookmark current folder");
	hbox4->addWidget(m_btnBookmark);
	
	m_btnDelBookmark = new QPushButton(QIcon(":/data/stock-remove.png"),"");
	m_btnDelBookmark->setToolTip("Delete current bookmark");
	hbox4->addWidget(m_btnDelBookmark);
	
	connect(m_bookmarkBox, SIGNAL(activated(int)), this, SLOT(loadBookmarkIndex(int)));
	connect(m_btnBookmark, SIGNAL(clicked()), this, SLOT(slotBookmarkFolder()));
	connect(m_btnDelBookmark, SIGNAL(clicked()), this, SLOT(slotDelBookmark()));
	
	
	//#######################################333
	


	QFrame * line = new QFrame();
        line->setFrameShape(QFrame::HLine);
        line->setFrameShadow(QFrame::Sunken);
	
	vbox->addWidget(m_searchBase);
	vbox->addWidget(m_folderBoxBase);
	vbox->addWidget(line);
	vbox->addWidget(m_bookmarkBase);
	vbox->addWidget(m_listView);
	vbox->addWidget(m_btnBase);
	
	m_splitter->addWidget(browser);

	m_viewerBase = new QWidget(m_splitter);
	m_viewerLayout = new QVBoxLayout(m_viewerBase);
	m_viewerLayout->setContentsMargins(0,0,0,0);
	
	// Setup the slide group viewer
	m_viewer = new SlideGroupViewer(m_viewerBase);
	m_viewer->setCanZoom(true);
	m_viewer->setSceneContextHint(MyGraphicsScene::Preview);
	m_viewer->setBackground(Qt::black);

	// Create the slide and slide group that we'll reuse to preview the 
	// selected media items
	Slide * slide = new Slide();
	AbstractVisualItem * bg = dynamic_cast<AbstractVisualItem*>(slide->background());
	bg->setFillType(AbstractVisualItem::Solid);
	bg->setFillBrush(Qt::black);

	SlideGroup *group = new SlideGroup();
	group->addSlide(slide);
	
	//qDebug() << "MediaBrowser::setupUI(): Setting slidegroup "<<group<<" on viewer "<<m_viewer; 
	m_viewer->setSlideGroup(group, slide);
	
	m_viewerLayout->addWidget(m_viewer);
	m_splitter->addWidget(m_viewerBase);
	
	loadBookmarks();
}