--- as_assist.cpp 2002/11/19 20:29:08 1.5
+++ as_assist.cpp 2002/11/20 11:06:32 1.6
@@ -11,38 +11,14 @@
#include "titrex.h" // Exception classes
// Icon pixel maps
-#include "gfx/cwlogo.xpm" // static const char *s_kpcCwlogo_xpm[]
-#include "gfx/osspicon.xpm" // static const char *s_kpcOsspicon_xpm[]
-#include "gfx/ossplogo.xpm" // static const char *s_kpcOssplogo_xpm[]
-#include "gfx/qticon.xpm" // static const char *s_kpcQticon_xpm[]
#include "gfx/filenew.xpm" // static const char *s_kpcFilenew_xpm[]
#include "gfx/fileopen.xpm" // static const char *s_kpcFileopen_xpm[]
#include "gfx/filesave.xpm" // static const char *s_kpcFilesave_xpm[]
+#include "gfx/osspicon.xpm" // static const char *s_kpcOsspicon_xpm[]
#include "gfx/whatsthis.xpm" // static const char *s_kpcWhatsthis_xpm[]
//
-// Construct the icon images
-//
-void Titraqform::setupIcons(void)
-{
- // Initialize icon images
- m_pCwlogo = new QImage(s_kpcCwlogo_xpm);
- m_pOsspicon = new QImage(s_kpcOsspicon_xpm);
- m_pOssplogo = new QImage(s_kpcOssplogo_xpm);
- m_pQticon = new QImage(s_kpcQticon_xpm);
- m_pNewicon = new QImage(s_kpcFilenew_xpm);
- m_pOpenicon = new QImage(s_kpcFileopen_xpm);
- m_pSaveicon = new QImage(s_kpcFilesave_xpm);
- m_pWhatsicon = new QImage(s_kpcWhatsthis_xpm);
-
- // Lets test out our sanity
- if (!(m_pOsspicon && m_pQticon && m_pNewicon && m_pNewicon && \
- m_pOpenicon && m_pSaveicon && m_pWhatsicon))
- throw Genexcept("Main window icon creation failed.");
-}
-
-//
// Construct the menu bar
//
void Titraqform::setupMenubar(void)
@@ -101,12 +77,13 @@
if (pHelppopup == NULL) // Sanity check
throw Genexcept("Main window help popup creation failed.");
m_pMenubar->insertItem(trUtf8("&Help"), pHelppopup);
- pHelppopup->insertItem(trUtf8("&About"), this, SLOT(about()), Key_F1);
+ pHelppopup->insertItem(trUtf8("&Contents"), this, SLOT(helpContents()), Key_F1);
pHelppopup->insertSeparator();
- pHelppopup->insertItem(QPixmap(*m_pOsspicon), trUtf8("About &OSSP"), this, SLOT(aboutOSSP()));
- pHelppopup->insertItem(QPixmap(*m_pQticon), trUtf8("About &Qt"), this, SLOT(aboutQt()));
+ pHelppopup->insertItem(trUtf8("About &Titraq"), this, SLOT(aboutTitraq()));
+ pHelppopup->insertItem(trUtf8("About &OSSP"), this, SLOT(aboutOSSP()));
+ pHelppopup->insertItem(trUtf8("About &Qt"), this, SLOT(aboutQt()));
pHelppopup->insertSeparator();
- pHelppopup->insertItem(QPixmap(*m_pWhatsicon), trUtf8("What's &This"), this, SLOT(whatsThis()), SHIFT+Key_F1);
+ pHelppopup->insertItem(QPixmap(s_kpcWhatsthis_xpm), trUtf8("What's &This"), this, SLOT(whatsThis()), SHIFT+Key_F1);
}
//
@@ -114,12 +91,17 @@
//
void Titraqform::setupActions(void)
{
+ // First associate the graphics with MIME types
+ QMimeSourceFactory::defaultFactory()->setPixmap("osspicon", QPixmap(s_kpcOsspicon_xpm));
+ QMimeSourceFactory::defaultFactory()->setPixmap("filenew", QPixmap(s_kpcFilenew_xpm));
+ QMimeSourceFactory::defaultFactory()->setPixmap("fileopen", QPixmap(s_kpcFileopen_xpm));
+ QMimeSourceFactory::defaultFactory()->setPixmap("filesave", QPixmap(s_kpcFilesave_xpm));
+
// File new action
m_pFilenewact = new QAction(trUtf8("New File"), QPixmap(s_kpcFilenew_xpm), trUtf8("&New..."), CTRL+Key_N, this, "New");
if (m_pFilenewact == NULL) // Sanity check
throw Genexcept("Main window file new action creation failed.");
connect(m_pFilenewact, SIGNAL(activated()), this, SLOT(newDoc()));
- QMimeSourceFactory::defaultFactory()->setPixmap("filenew", m_pFilenewact->iconSet().pixmap());
const char *kszFilenewtext = trUtf8("<p><img source=\"filenew\"> "
"Click this button to make a <em>blank file</em>."
"You can also select the <b>New</b> command "
@@ -131,7 +113,6 @@
if (m_pFileopenact == NULL) // Sanity check
throw Genexcept("Main window file open action creation failed.");
connect(m_pFileopenact, SIGNAL(activated()), this, SLOT(choose()));
- QMimeSourceFactory::defaultFactory()->setPixmap("fileopen", m_pFileopenact->iconSet().pixmap());
const char *kszFileopentext = trUtf8("<p><img source=\"fileopen\"> "
"Click this button to open a <em>new file</em>."
"You can also select the <b>Open</b> command "
@@ -143,7 +124,6 @@
if (m_pFilesaveact == NULL) // Sanity check
throw Genexcept("Main window file save action creation failed.");
connect(m_pFilesaveact, SIGNAL(activated()), this, SLOT(save()));
- QMimeSourceFactory::defaultFactory()->setPixmap("filesave", m_pFilesaveact->iconSet().pixmap());
const char *kszFilesavetext = trUtf8("<p><img source=\"filesave\"> "
"Click this button to <em>save</em> the file you "
"are editing. You will be prompted for a file name.\n"
@@ -171,11 +151,10 @@
connect(m_pFilequitact, SIGNAL(activated()), qApp, SLOT(quit()));
// Add data row action
- m_pAddrowact = new QAction(trUtf8("Add Row"), QPixmap(s_kpcOssplogo_xpm), trUtf8("Add &row"), 0, this, "Addrow");
+ m_pAddrowact = new QAction(trUtf8("Add Row"), trUtf8("Add &row"), 0, this, "Addrow");
if (m_pAddrowact == NULL) // Sanity check
throw Genexcept("Main window add row action creation failed.");
connect(m_pAddrowact, SIGNAL(activated()), this, SLOT(addEntry()));
- QMimeSourceFactory::defaultFactory()->setPixmap("ossplogo", m_pAddrowact->iconSet().pixmap());
const char *kszAddrowtext = trUtf8("<p><img source=\"ossplogo\"> "
"Click this button to add a <em>new row</em>."
"You can also select the <b>Add row</b> command "
@@ -183,11 +162,10 @@
m_pAddrowact->setWhatsThis(kszAddrowtext);
// Delete data row action
- m_pDeleterowact = new QAction(trUtf8("Add Row"), QPixmap(s_kpcOssplogo_xpm), trUtf8("Add &row"), 0, this, "Deleterow");
+ m_pDeleterowact = new QAction(trUtf8("Add Row"), trUtf8("Add &row"), 0, this, "Deleterow");
if (m_pDeleterowact == NULL) // Sanity check
throw Genexcept("Main window delete row action creation failed.");
connect(m_pDeleterowact, SIGNAL(activated()), this, SLOT(delEntry()));
- QMimeSourceFactory::defaultFactory()->setPixmap("ossplogo", m_pDeleterowact->iconSet().pixmap());
const char *kszDeleterowtext = trUtf8("<p><img source=\"ossplogo\"> "
"Click this button to delete a <em>row</em>."
"You can also select the <b>Delete row</b> command "
@@ -195,11 +173,10 @@
m_pDeleterowact->setWhatsThis(kszDeleterowtext);
// Write data action
- m_pWritedataact = new QAction(trUtf8("Add Row"), QPixmap(s_kpcOssplogo_xpm), trUtf8("Add &row"), 0, this, "Writedata");
+ m_pWritedataact = new QAction(trUtf8("Add Row"), trUtf8("Add &row"), 0, this, "Writedata");
if (m_pWritedataact == NULL) // Sanity check
throw Genexcept("Main window write data action creation failed.");
connect(m_pWritedataact, SIGNAL(activated()), this, SLOT(writeEntry()));
- QMimeSourceFactory::defaultFactory()->setPixmap("ossplogo", m_pWritedataact->iconSet().pixmap());
const char *kszWritedatatext = trUtf8("<p><img source=\"ossplogo\"> "
"Click this button to <em>write out</em> your accounting data."
"You can also select the <b>Write data</b> command "
|