Added examples and tutorials to menu

This commit is contained in:
Frans Schreuder 2013-05-21 16:39:04 +02:00
parent aa7d670f84
commit d8e4b16080
8 changed files with 120 additions and 14 deletions

View File

@ -1,11 +1,11 @@
# Install examples
install-data-local:
$(MKDIR_P) $(DESTDIR)$(datadir)/qucs/doc/examples
$(MKDIR_P) $(DESTDIR)$(datadir)/qucs/docs/examples
if [[ ! -d examples ]] ; then $(MKDIR_P) examples; echo -e "This distribution contains no examples, please copy them manually from the qucs git repository:\ngit clone git://git.code.sf.net/p/qucs/git qucs">examples/README; fi
for examplefile in examples/* ; do \
if test -f $$examplefile; then \
$(INSTALL_DATA) $$examplefile $(DESTDIR)$(datadir)/qucs/doc/$$examplefile; \
$(INSTALL_DATA) $$examplefile $(DESTDIR)$(datadir)/qucs/docs/$$examplefile; \
fi \
done

View File

@ -1,12 +1,12 @@
# Install examples
install-data-local:
$(MKDIR_P) $(DESTDIR)$(datadir)/qucs/doc; \
$(MKDIR_P) $(DESTDIR)$(datadir)/qucs/docs; \
for DOC_SUBDIR in report technical tutorial ; do \
$(MKDIR_P) $(DESTDIR)$(datadir)/qucs/doc/$$DOC_SUBDIR; \
$(MKDIR_P) $(DESTDIR)$(datadir)/qucs/docs/$$DOC_SUBDIR; \
for docfile in $$DOC_SUBDIR/*.pdf ; do \
if test -f $$docfile; then \
$(INSTALL_DATA) $$docfile $(DESTDIR)$(datadir)/qucs/doc/$$docfile; \
$(INSTALL_DATA) $$docfile $(DESTDIR)$(datadir)/qucs/docs/$$docfile; \
fi \
done \
done

View File

@ -468,12 +468,12 @@ uninstall-am:
install-data-local:
$(MKDIR_P) $(DESTDIR)$(datadir)/qucs/doc; \
$(MKDIR_P) $(DESTDIR)$(datadir)/qucs/docs; \
for DOC_SUBDIR in report technical tutorial ; do \
$(MKDIR_P) $(DESTDIR)$(datadir)/qucs/doc/$$DOC_SUBDIR; \
$(MKDIR_P) $(DESTDIR)$(datadir)/qucs/docs/$$DOC_SUBDIR; \
for docfile in $$DOC_SUBDIR/*.pdf ; do \
if test -f $$docfile; then \
$(INSTALL_DATA) $$docfile $(DESTDIR)$(datadir)/qucs/doc/$$docfile; \
$(INSTALL_DATA) $$docfile $(DESTDIR)$(datadir)/qucs/docs/$$docfile; \
fi \
done \
done

View File

@ -581,15 +581,20 @@ int main(int argc, char *argv[])
QDir::convertSeparators (QucsDirStr + "/share/qucs/library/");
QucsSettings.OctaveDir =
QDir::convertSeparators (QucsDirStr + "/share/qucs/octave/");
QucsSettings.ExamplesDir =
QDir::convertSeparators (QucsDirStr + "/share/qucs/doc/examples/");
QucsSettings.DocDir =
QDir::convertSeparators (QucsDirStr + "/share/qucs/doc/");
} else {
QucsSettings.BinDir = BINARYDIR;
QucsSettings.BitmapDir = BITMAPDIR;
QucsSettings.LangDir = LANGUAGEDIR;
QucsSettings.LibDir = LIBRARYDIR;
QucsSettings.OctaveDir = OCTAVEDIR;
QucsSettings.ExamplesDir = QDir(DOCDIR).canonicalPath()+"/examples/";
QucsSettings.DocDir = DOCDIR;
}
QucsSettings.Editor = QucsSettings.BinDir + "qucsedit";
QucsWorkDir.setPath(QDir::homeDirPath()+QDir::convertSeparators ("/.qucs"));
QucsHomeDir.setPath(QDir::homeDirPath()+QDir::convertSeparators ("/.qucs"));
loadSettings();

View File

@ -55,6 +55,8 @@ struct tQucsSettings {
QString LibDir;
QString AscoDir;
QString OctaveDir;
QString ExamplesDir;
QString DocDir;
unsigned int NodeWiring;

View File

@ -1411,6 +1411,28 @@ bool QucsApp::closeAllFiles()
return true;
}
void QucsApp::slotFileExamples()
{
statusBar()->message(tr("Open examples directory..."));
QString path = QDir::toNativeSeparators(QucsSettings.ExamplesDir);
QDesktopServices::openUrl(QUrl("file:///" + path));
statusBar()->message(tr("Ready."));
}
void QucsApp::slotHelpTutorial()
{
}
void QucsApp::slotHelpTechnical()
{
}
void QucsApp::slotHelpReport()
{
}
// --------------------------------------------------------------
// Is called when another document is selected via the TabBar.
void QucsApp::slotChangeView(QWidget *w)

View File

@ -103,6 +103,10 @@ public slots:
void slotFileSaveAs(); // save a document under a different filename
void slotFileSaveAll(); // save all open documents
void slotFileClose(); // close the actual file
void slotFileExamples(); // show the examples in a file browser
void slotHelpTutorial(); // Open a pdf tutorial
void slotHelpReport(); // Open a pdf report
void slotHelpTechnical(); // Open a pdf technical document
void slotFileClose (int); // close the file with given index
void slotSymbolEdit(); // edit the symbol for the schematic
void slotFileSettings();// open dialog to change file settings
@ -170,7 +174,7 @@ public:
QAction *ActionCMenuOpen, *ActionCMenuRename, *ActionCMenuDelete, *ActionCMenuDelGroup;
QAction *fileNew, *textNew, *fileNewDpl, *fileOpen, *fileSave, *fileSaveAs,
*fileSaveAll, *fileClose, *fileSettings, *filePrint, *fileQuit,
*fileSaveAll, *fileClose, *fileExamples, *fileSettings, *filePrint, *fileQuit,
*projNew, *projOpen, *projDel, *projClose, *applSettings,
*editCut, *editCopy, *magAll, *magOne, *magMinus, *filePrintFit,
*symEdit, *intoH, *popH, *simulate, *dpl_sch, *undo, *redo, *dcbias;
@ -257,6 +261,9 @@ private:
QMenu *fileMenu, *editMenu, *insMenu, *projMenu, *simMenu, *viewMenu,
*helpMenu, *alignMenu, *toolMenu;
// submenus for the PDF documents
QMenu *helpTechnical, *helpReport, *helpTutorial;
QToolBar *fileToolbar, *editToolbar, *viewToolbar, *workToolbar;
// Shortcuts for scolling schematic / TextEdit

View File

@ -100,6 +100,13 @@ void QucsApp::initActions()
fileClose->setWhatsThis(tr("Close File\n\nCloses the current document"));
connect(fileClose, SIGNAL(activated()), SLOT(slotFileClose()));
fileExamples = new QAction(tr("&Examples"), this);
fileExamples->setStatusTip(tr("Opens a file explorer with example documents"));
fileExamples->setWhatsThis(
tr("Examples\n\nOpens a file explorer with example documents"));
connect(fileExamples, SIGNAL(activated()), SLOT(slotFileExamples()));
symEdit = new QAction(tr("&Edit Circuit Symbol"), this);
symEdit->setShortcut(Qt::Key_F9);
symEdit->setStatusTip(tr("Edits the symbol for this schematic"));
@ -417,9 +424,9 @@ void QucsApp::initActions()
editRotate = new QAction(QIcon((QucsSettings.BitmapDir + "rotate_ccw.png")), tr("Rotate"), this);
editRotate->setShortcut(Qt::CTRL+Qt::Key_R);
editRotate->setStatusTip(tr("Rotates the selected component by 90°"));
editRotate->setStatusTip(tr("Rotates the selected component by 90\B0"));
editRotate->setWhatsThis(
tr("Rotate\n\nRotates the selected component by 90° counter-clockwise"));
tr("Rotate\n\nRotates the selected component by 90\B0 counter-clockwise"));
editRotate->setToggleAction(true);
connect(editRotate, SIGNAL(toggled(bool)), SLOT(slotEditRotate(bool)));
@ -636,7 +643,8 @@ void QucsApp::initActions()
helpAboutQt->setWhatsThis(tr("About Qt\n\nAbout Qt by Trolltech"));
connect(helpAboutQt, SIGNAL(activated()), SLOT(slotHelpAboutQt()));
}
#include <iostream>
using namespace std;
// ----------------------------------------------------------
void QucsApp::initMenuBar()
{
@ -652,6 +660,8 @@ void QucsApp::initMenuBar()
fileMenu->addAction(filePrint);
fileMenu->addAction(filePrintFit);
fileMenu->insertSeparator();
fileMenu->addAction(fileExamples);
fileMenu->insertSeparator();
fileMenu->addAction(fileSettings);
fileMenu->addAction(symEdit);
fileMenu->insertSeparator();
@ -761,9 +771,68 @@ void QucsApp::initMenuBar()
helpMenu->addAction(helpIndex);
helpMenu->addAction(helpGetStart);
helpMenu->insertSeparator();
//Fill submenu's with filenames of PDF documents
QDir TechnicalDir = QDir(QucsSettings.DocDir);
if(TechnicalDir.cd("technical"))
{
helpTechnical = new QMenu(tr("&Technical Papers"));
helpMenu->addMenu(helpTechnical);
TechnicalDir.setFilter(QDir::Files);
QStringList entries = TechnicalDir.entryList();
for(int i=0;i<entries.size();i++)
{
QAction* helpTechnicalActions = new QAction(entries[i], this);
helpTechnicalActions->setStatusTip(tr("Open ")+entries[i]);
helpTechnicalActions->setWhatsThis(tr(entries[i]+"\n\nOpen "+entries[i]));
connect(helpTechnicalActions, SIGNAL(activated()), SLOT(slotHelpTechnical()));
helpTechnical->addAction(helpTechnicalActions);
}
}
//Fill submenu's with filenames of PDF documents
QDir ReportDir = QDir(QucsSettings.DocDir);
if(ReportDir.cd("report"))
{
helpReport = new QMenu(tr("Technical &Reports"));
helpMenu->addMenu(helpReport);
ReportDir.setFilter(QDir::Files);
QStringList entries = ReportDir.entryList();
for(int i=0;i<entries.size();i++)
{
QAction* helpReportActions = new QAction(entries[i], this);
helpReportActions->setStatusTip(tr("Open ")+entries[i]);
helpReportActions->setWhatsThis(tr(entries[i]+"\n\nOpen "+entries[i]));
connect(helpReportActions, SIGNAL(activated()), SLOT(slotHelpReport()));
helpReport->addAction(helpReportActions);
}
}
//Fill submenu's with filenames of PDF documents
QDir TutorialDir = QDir(QucsSettings.DocDir);
if(TutorialDir.cd("tutorial"))
{
helpTutorial = new QMenu(tr("T&utorials"));
helpMenu->addMenu(helpTutorial);
TutorialDir.setFilter(QDir::Files);
QStringList entries = TutorialDir.entryList();
for(int i=0;i<entries.size();i++)
{
QAction* helpTutorialActions = new QAction(entries[i], this);
helpTutorialActions->setStatusTip(tr("Open ")+entries[i]);
helpTutorialActions->setWhatsThis(tr(entries[i]+"\n\nOpen "+entries[i]));
connect(helpTutorialActions, SIGNAL(activated()), SLOT(slotHelpTutorial()));
helpTutorial->addAction(helpTutorialActions);
}
}
helpMenu->insertSeparator();
helpMenu->addAction(helpAboutApp);
helpMenu->addAction(helpAboutQt);
menuBar()->addMenu(fileMenu);
menuBar()->addMenu(editMenu);
@ -996,3 +1065,4 @@ void QucsApp::slotHelpAboutQt()
{
QMessageBox::aboutQt(this, tr("About Qt"));
}