// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- void QFSDropLabel::dropEvent(QDropEvent* event) { QList<QUrl> urlList; QString fName; QFileInfo info; if (event->mimeData()->hasUrls()) { urlList = event->mimeData()->urls(); // returns list of QUrls // if just text was dropped, urlList is empty (size == 0) if ( urlList.size() > 0) // if at least one QUrl is present in list { fName = urlList[0].toLocalFile(); // convert first QUrl to local path fName = QDir::toNativeSeparators(fName); info.setFile( fName ); // information about file setText( fName ); // if is file, setText emit fileDropped(fName); } } changeStyleSheet(FS_STANDARD_STYLE); event->acceptProposedAction(); }
void MainWindow::init() { /* MenuBar */ setMenuBar(new MenuBar(addToolBar(tr("")), this)); connect(menuBar(), SIGNAL(newTabTriggered()), this, SLOT(newTab())); connect(menuBar(), SIGNAL(openTriggered()), this, SLOT(openTriggered())); connect(menuBar(), SIGNAL(openClipboardTriggered()), this, SLOT(openClipboardTriggered())); connect(menuBar(), SIGNAL(saveAsTriggered()), this, SLOT(saveAsTriggered())); connect(menuBar(), SIGNAL(saveHtmlTriggered()), this, SLOT(saveHtmlTriggered())); connect(menuBar(), SIGNAL(printTriggered()), this, SLOT(printTriggered())); connect(menuBar(), SIGNAL(closeTabTriggered()), this, SLOT(closeTabTriggered())); connect(menuBar(), SIGNAL(quitTriggered()), this, SLOT(close())); connect(menuBar(), SIGNAL(findNextTriggered()), this, SLOT(findNextTriggered())); connect(menuBar(), SIGNAL(findPreviousTriggered()), this, SLOT(findPreviousTriggered())); connect(menuBar(), SIGNAL(gotoLineTriggered()), this, SLOT(gotoLineTriggered())); connect(menuBar(), SIGNAL(reloadTriggered()), this, SLOT(reloadTriggered())); connect(menuBar(), SIGNAL(zoomInTriggered()), this, SLOT(zoomInTriggered())); connect(menuBar(), SIGNAL(zoomOutTriggered()), this, SLOT(zoomOutTriggered())); connect(menuBar(), SIGNAL(zoomNormalTriggered()), this, SLOT(zoomNormalTriggered())); connect(menuBar(), SIGNAL(lineWrapTriggered()), this, SLOT(lineWrapTriggered())); connect(menuBar(), SIGNAL(optionTriggered()), this, SLOT(optionTriggered())); connect(menuBar(), SIGNAL(updateTriggered()), this, SLOT(updateTriggered())); connect(menuBar(), SIGNAL(reportBugTriggered()), this, SLOT(reportBugTriggered())); connect(menuBar(), SIGNAL(requestFeatureTriggered()), this, SLOT(requestFeatureTriggered())); connect(menuBar(), SIGNAL(aboutTriggered()), this, SLOT(aboutTriggered())); connect(menuBar(), SIGNAL(openRecentFiles(QAction*)), this, SLOT(openRecentFiles(QAction*))); connect(menuBar(), SIGNAL(fileBrowserVisibleChanged(bool)), this, SLOT(fileBrowserVisibleChanged(bool))); connect(menuBar(), SIGNAL(resultViewVisibleChanged(bool)), this, SLOT(resultViewVisibleChanged(bool))); connect(menuBar(), SIGNAL(chartViewVisibleChanged(bool)), this, SLOT(chartViewVisibleChanged(bool))); connect(static_cast<MenuBar*>(menuBar())->searchLineEdit(), SIGNAL(returnPressed()), this, SLOT(findNextTriggered())); /* StatusBar */ setStatusBar(new StatusBar(this)); connect(static_cast<StatusBar*>(statusBar()), SIGNAL(textEncodingChanged(QString)), this, SLOT(textEncodingChanged(QString))); /* TabWidget */ m_tabWidget = new TabWidget(this); connect(m_tabWidget, SIGNAL(newTab()), this, SLOT(newTab())); connect(m_tabWidget, SIGNAL(closeAll()), this, SLOT(closeAll())); connect(m_tabWidget, SIGNAL(closeOthers(int)), this, SLOT(closeOthers(int))); connect(m_tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); newTab(); setCentralWidget(m_tabWidget); /* DockWidget */ createDockWidget(); /* Keyword Button Group */ connect(keywordButtonGroup(), SIGNAL(buttonReloaded()), LOGVIEWERMANAGER(), SLOT(keywordButtonGroupReloaded())); connect(keywordButtonGroup(), SIGNAL(buttonClicked(QWidget*,QButtonGroup*)), LOGVIEWERMANAGER(), SLOT(keywordButtonGroupClicked(QWidget*,QButtonGroup*))); connect(keywordButtonGroup(), SIGNAL(buttonAdded(QStringList&)), LOGVIEWERMANAGER(), SLOT(keywordButtonGroupAdded(QStringList&))); connect(keywordButtonGroup(), SIGNAL(buttonRemoved(QStringList&)), LOGVIEWERMANAGER(), SLOT(keywordButtonGroupRemoved(QStringList&))); /* File Load Manager */ connect(FILELOADMANAGER(), SIGNAL(loadStarted(QWidget*)), this, SLOT(fileLoadStarted(QWidget*))); connect(FILELOADMANAGER(), SIGNAL(loadProgress(QWidget*,QString*,int)), this, SLOT(fileLoadProgress(QWidget*,QString*,int))); connect(FILELOADMANAGER(), SIGNAL(loadFinished(QWidget*,QString*)), this, SLOT(fileLoadProgress(QWidget*,QString*))); connect(FILELOADMANAGER(), SIGNAL(codecDected(QString)), this, SLOT(codecDected(QString))); connect(FILELOADMANAGER(), SIGNAL(loadStarted(QWidget*)), m_tabWidget, SLOT(fileLoadStarted(QWidget*))); connect(FILELOADMANAGER(), SIGNAL(loadFinished(QWidget*,QString*)), m_tabWidget, SLOT(fileLoadFinished(QWidget*))); connect(FILELOADMANAGER(), SIGNAL(loadStarted(QWidget*)), LOGVIEWERMANAGER(), SLOT(fileLoadStarted(QWidget*))); connect(FILELOADMANAGER(), SIGNAL(loadFinished(QWidget*,QString*)), LOGVIEWERMANAGER(), SLOT(fileLoadFinished(QWidget*))); connect(FILELOADMANAGER(), SIGNAL(fileSizeNotify(QWidget*,long)), LOGVIEWERMANAGER(), SLOT(fileSizeNotified(QWidget*,long))); connect(FILELOADMANAGER(), SIGNAL(fileNameNotify(QWidget*,QString)), LOGVIEWERMANAGER(), SLOT(fileNameNotified(QWidget*,QString))); /* Log Viewer */ connect(LOGVIEWERMANAGER(), SIGNAL(selectionChanged(QWidget*)), this, SLOT(selectionChanged(QWidget*))); connect(LOGVIEWERMANAGER(), SIGNAL(cursorPositionChanged(QWidget*)), this, SLOT(cursorPositionChanged(QWidget*))); connect(LOGVIEWERMANAGER(), SIGNAL(fileDropped(QString)), this, SLOT(fileDropped(QString))); connect(LOGVIEWERMANAGER(), SIGNAL(modelCreated(QWidget*, QStandardItemModel*)), this, SLOT(modelCreated(QWidget*, QStandardItemModel*))); connect(LOGVIEWERMANAGER(), SIGNAL(chartLoaded(QWidget*, QPixmap*)), this, SLOT(chartLoaded(QWidget*, QPixmap*))); }