diff -r e8292658d5b3 -r c1941114ca88 as_reportpanel.cpp --- a/as_reportpanel.cpp Fri Nov 28 14:20:00 2008 +0100 +++ b/as_reportpanel.cpp Fri Dec 05 23:14:02 2008 +0100 @@ -1,12 +1,12 @@ // // OSSP asgui - Accounting system graphical user interface -// Copyright (c) 2002-2004 The OSSP Project (http://www.ossp.org/) -// Copyright (c) 2002-2004 Ralf S. Engelschall -// Copyright (c) 2002-2004 Michael Schloh von Bennewitz -// Copyright (c) 2002-2004 Cable & Wireless Telecommunications Services GmbH +// Copyright (c) 2002-2008 The OSSP Project (http://www.ossp.org/) +// Copyright (c) 2002-2008 Ralf S. Engelschall +// Copyright (c) 2002-2008 Michael Schloh von Bennewitz +// Copyright (c) 2002-2008 Cable & Wireless Telecommunications Services GmbH // // This file is part of OSSP asgui, an accounting system graphical user -// interface which can be found at http://www.ossp.org/pkg/tool/asgui/. +// interface which can be found at http://asgui.europalab.com/. // // Permission to use, copy, modify, and distribute this software for // any purpose with or without fee is hereby granted, provided that @@ -29,23 +29,30 @@ // as_reportpanel.cpp: ISO C++ implementation // +#define QT3_SUPPORT + #include #include -#include +#include #include -#include -#include +#include +#include #include #include -#include -#include -#include +#include +#include +#include #include -#include +#include #include #include #include +//Added by qt3to4: +#include +#include +#include + #include "as_reportpanel.h" #include "as_numdial.h" #include "as_table.h" @@ -71,7 +78,7 @@ // Reportpanel::Reportpanel(TiTable *pTable, Preferences *pPreferences, QWidget *pParent, const char *kszName, - bool bModal, WFlags Flags) + bool bModal, Qt::WFlags Flags) : QDialog(pParent, kszName, bModal, Flags) { // Boilerplate code to initialize the panel @@ -93,13 +100,13 @@ m_nMonths = m_pReprefs->getNumber(TITRAQ_PREFREPORTMONTHS, TITRAQ_DEFREPORTMONTHS); // Build panel using already constructed widgets and layouts - m_pFormlay = new QVBoxLayout(this, 11, 6, "Formlayout"); - m_pToolay = new QHBoxLayout(0, 0, 6, "Toolbuttonlay"); - m_pPushlay = new QHBoxLayout(0, 0, 6, "Pushbuttonlay"); + m_pFormlay = new Q3VBoxLayout(this, 11, 6, "Formlayout"); + m_pToolay = new Q3HBoxLayout(0, 0, 6, "Toolbuttonlay"); + m_pPushlay = new Q3HBoxLayout(0, 0, 6, "Pushbuttonlay"); // Groupbox and its text display - m_pBrowser = new QTextEdit(this, "Reportbrowser"); - m_pBrowser->setTextFormat(PlainText); + m_pBrowser = new Q3TextEdit(this, "Reportbrowser"); + m_pBrowser->setTextFormat(Qt::PlainText); m_pBrowser->setReadOnly(true); m_pBrowser->setFont(QFont("Courier", 10)); m_pFormlay->addWidget(m_pBrowser); @@ -109,26 +116,26 @@ m_pFormlay->addLayout(m_pPushlay); // Tool button suite - m_pWeekmonthgroup = new QButtonGroup(this, "Weekmonthgroup"); + m_pWeekmonthgroup = new Q3ButtonGroup(this, "Weekmonthgroup"); m_pWeekmonthgroup->setColumnLayout(0, Qt::Horizontal); m_pWeekmonthgroup->layout()->setSpacing(11); m_pWeekmonthgroup->layout()->setMargin(0); - m_pWeekmonthlay = new QHBoxLayout(m_pWeekmonthgroup->layout()); - m_pWeekmonthgroup->setFrameShape(QFrame::NoFrame); + m_pWeekmonthlay = new Q3HBoxLayout(m_pWeekmonthgroup->layout()); + //m_pWeekmonthgroup->setFrameShape(QFrame::NoFrame); m_pWeekmonthgroup->setExclusive(true); m_pWeeklybutt = new QToolButton(m_pWeekmonthgroup, "Weeklybutton"); // m_pWeeklybutt->setPaletteBackgroundColor(QColor(198, 196, 186)); - m_pWeeklybutt->setFocusPolicy(QWidget::TabFocus); + m_pWeeklybutt->setFocusPolicy(Qt::TabFocus); m_pWeeklybutt->setCursor(QCursor(13)); m_pWeeklybutt->setToggleButton(true); m_pMonthlybutt = new QToolButton(m_pWeekmonthgroup, "Monthlybutton"); // m_pMonthlybutt->setPaletteBackgroundColor(QColor(198, 196, 186)); - m_pMonthlybutt->setFocusPolicy(QWidget::TabFocus); + m_pMonthlybutt->setFocusPolicy(Qt::TabFocus); m_pMonthlybutt->setCursor(QCursor(13)); m_pMonthlybutt->setToggleButton(true); // Popup for number of weeks - m_pWeekpop = new QPopupMenu(this); + m_pWeekpop = new Q3PopupMenu(this); if (m_pWeekpop == NULL) // Sanity check throw Genexcept("Weekly toolbutton popup creation failed."); m_pWeekpop->insertItem(trUtf8("One week"), this, SLOT(reportWeeks(int))); @@ -146,7 +153,7 @@ } // Popup for number of months - m_pMonthpop = new QPopupMenu(this); + m_pMonthpop = new Q3PopupMenu(this); if (m_pMonthpop == NULL) // Sanity check throw Genexcept("Monthly toolbutton popup creation failed."); m_pMonthpop->insertItem(trUtf8("One month"), this, SLOT(reportMonths(int))); @@ -525,15 +532,16 @@ Tempstring = m_pReptable->text(nIter, TITRAQ_IDXTASK); Tempdate = QDate::fromString(m_pReptable->text(nIter, TITRAQ_IDXDATE), Qt::ISODate); if (!Tempstring.isEmpty() && Firstday <= Tempdate && Tempdate < Lastday) { - string Convstring = Tempstring; // Convert to string (can't cast?) + string Convstring = Tempstring.toStdString(); // Convert to string (can't cast?) QTime Intable = QTime::fromString(m_pReptable->text(nIter, TITRAQ_IDXAMOUNT), Qt::ISODate); - int nTothours = QString(Hashtasks[Convstring]).section(':', 0, 0).toInt() + Intable.hour(); - int nTotminut = QString(Hashtasks[Convstring]).section(':', 1, 1).toInt() + Intable.minute(); + string Gethashed = Hashtasks[Convstring]; + int nTothours = QString::fromStdString(Gethashed).section(':', 0, 0).toInt() + Intable.hour();; + int nTotminut = QString::fromStdString(Gethashed).section(':', 1, 1).toInt() + Intable.minute(); nTothours += nTotminut / 60; nTotminut %= 60; QString Hours = QString::number(nTothours).rightJustify(3, ' '); QString Mins = QString::number(nTotminut).rightJustify(2, '0'); - string Timestring = Hours + ':' + Mins; // Convert to string (can't cast?) + string Timestring = Hours.toStdString() + ':' + Mins.toStdString(); // Convert to string (can't cast?) Hashtasks[Convstring] = Timestring; // Finally store in hashtable } } @@ -544,7 +552,7 @@ // Write the actual data totals to the outgoing string in reverse order for (Houriter = Hashhours.begin(); Houriter != Hashhours.end(); Houriter++) - Totals = Houriter->first + ' ' + Houriter->second + '\n' + Totals; + Totals = QString::fromStdString(Houriter->first + ' ' + Houriter->second + '\n' + Totals.toStdString()); // Write some quick header text to the outgoing string in reverse order Totals = QString("------ ----------------------------------------\n") + Totals; @@ -631,16 +639,17 @@ Tempstring = m_pReptable->text(nIter, TITRAQ_IDXTASK); Tempdate = QDate::fromString(m_pReptable->text(nIter, TITRAQ_IDXDATE), Qt::ISODate); if (!Tempstring.isEmpty() && Firstday <= Tempdate && Tempdate < Lastday) { - string Convstring = Tempstring; // Convert to string (can't cast?) + string Convstring = Tempstring.toStdString(); // Convert to string (can't cast?) QTime Intable = QTime::fromString(m_pReptable->text(nIter, TITRAQ_IDXAMOUNT), Qt::ISODate); - int nTothours = QString(Hashtasks[Convstring]).section(':', 0, 0).toInt() + Intable.hour(); - int nTotminut = QString(Hashtasks[Convstring]).section(':', 1, 1).toInt() + Intable.minute(); + string Gethashed = Hashtasks[Convstring]; + int nTothours = QString::fromStdString(Gethashed).section(':', 0, 0).toInt() + Intable.hour();; + int nTotminut = QString::fromStdString(Gethashed).section(':', 1, 1).toInt() + Intable.minute(); nTothours += nTotminut / 60; nTotminut %= 60; QString Hours = QString::number(nTothours).rightJustify(3, ' '); QString Mins = QString::number(nTotminut).rightJustify(2, '0'); - string Timestring = Hours + ':' + Mins; // Convert to string (can't cast?) - Hashtasks[Convstring] = Timestring; // Finally store in hashtable + QString Timestring = Hours + ':' + Mins; // Convert to string (can't cast?) + Hashtasks[Convstring] = Timestring.toStdString(); // Finally store in hashtable } } @@ -650,7 +659,7 @@ // Write the actual data totals to the outgoing string in reverse order for (Houriter = Hashhours.begin(); Houriter != Hashhours.end(); Houriter++) - Totals = Houriter->first + ' ' + Houriter->second + '\n' + Totals; + Totals = QString::fromStdString(Houriter->first + ' ' + Houriter->second + '\n' + Totals.toStdString()); // Write some quick header text to the outgoing string in reverse order Totals = QString("------ ----------------------------------------\n") + Totals; @@ -670,7 +679,7 @@ QString Openas = m_pReprefs->getString(TITRAQ_PREFHOME, TITRAQ_DEFHOME); // And then get the name of the selected file to save to - Filestring = QFileDialog::getSaveFileName(Openas, trUtf8("Text files (*.txt);;All Files (*)"), this, trUtf8("ChooserDialog"), trUtf8("Choose a file to save"), NULL, false); + Filestring = Q3FileDialog::getSaveFileName(Openas, trUtf8("Text files (*.txt);;All Files (*)"), this, trUtf8("ChooserDialog"), trUtf8("Choose a file to save"), NULL, false); if (!Filestring.isEmpty()) { if (QFile::exists(Filestring)) { nResult = QMessageBox::warning(this, QString(TITRAQ_APPTITLE) @@ -678,16 +687,16 @@ trUtf8("&Yes"), trUtf8("&No"), NULL, 1, 1); if (nResult = QMessageBox::Ok) { // Overwrite a file Report.setName(Filestring); // User wished name - Report.open(IO_WriteOnly | IO_Truncate); // Open report file - QTextStream Outstream(&Report); // Convert to stream + Report.open(QIODevice::WriteOnly | QIODevice::Truncate); // Open report file + Q3TextStream Outstream(&Report); // Convert to stream Outstream << m_pBrowser->text(); // Write the data Report.close(); // Finish by closing } } else { // User gave a file name, and there was no preexisting file there Report.setName(Filestring); // User wished name - Report.open(IO_WriteOnly | IO_Truncate); // Open report file - QTextStream Outstream(&Report); // Convert to stream + Report.open(QIODevice::WriteOnly | QIODevice::Truncate); // Open report file + Q3TextStream Outstream(&Report); // Convert to stream Outstream << m_pBrowser->text(); // Write the data Report.close(); // Finish by closing } @@ -707,7 +716,7 @@ Paint.begin(m_pPrinter); // Paint on printer Paint.setFont(m_pBrowser->font()); QFontMetrics Fontmetrics = Paint.fontMetrics(); - QPaintDeviceMetrics Devmetrics(m_pPrinter); // Need width/height of printer surface + Q3PaintDeviceMetrics Devmetrics(m_pPrinter); // Need width/height of printer surface const int knMargin = Devmetrics.logicalDpiX() / 2; // Half-inch margin int nYpos = knMargin; // Y position for each line int nPageno = 1; // The starting page number @@ -743,20 +752,20 @@ // Top level push buttons associated with accept and save slots m_pSavebutt->setText(trUtf8("Save As...", "Comment for Savebutton")); QToolTip::add(m_pSavebutt, trUtf8("Saves the report text", "Comment for tooltip Savebutton")); - QWhatsThis::add(m_pSavebutt, trUtf8("The save button saves the report text to a file", "Comment for whatsThis Savebutton")); + Q3WhatsThis::add(m_pSavebutt, trUtf8("The save button saves the report text to a file", "Comment for whatsThis Savebutton")); m_pPrintbutt->setText(trUtf8("Print...", "Comment for Printbutton")); QToolTip::add(m_pPrintbutt, trUtf8("Print the report text", "Comment for tooltip Printbutton")); - QWhatsThis::add(m_pPrintbutt, trUtf8("The print button prints the report text to a file", "Comment for whatsThis Printbutton")); + Q3WhatsThis::add(m_pPrintbutt, trUtf8("The print button prints the report text to a file", "Comment for whatsThis Printbutton")); m_pDismissbutt->setText(trUtf8("Dismiss", "Comment for Dismissbutton")); QToolTip::add(m_pDismissbutt, trUtf8("Closes the report panel", "Comment for tooltip Dismissbutton")); - QWhatsThis::add(m_pDismissbutt, trUtf8("The dismiss button dismisses the report panel", "Comment for whatsThis Dismissbutton")); + Q3WhatsThis::add(m_pDismissbutt, trUtf8("The dismiss button dismisses the report panel", "Comment for whatsThis Dismissbutton")); // Inner tool buttons for new local report generation m_pWeeklybutt->setText(trUtf8("Weekly", "Comment for Weeklybutt")); QToolTip::add(m_pWeeklybutt, trUtf8("Hold down for options", "Comment for tooltip Weeklybutt")); - QWhatsThis::add(m_pWeeklybutt, trUtf8("The Weekly button generates a new weekly report.\nHold this button down to specify many weeks.", "Comment for whatsThis Weeklybutt")); + Q3WhatsThis::add(m_pWeeklybutt, trUtf8("The Weekly button generates a new weekly report.\nHold this button down to specify many weeks.", "Comment for whatsThis Weeklybutt")); m_pMonthlybutt->setText(trUtf8("Monthly", "Comment for Monthlybutt")); QToolTip::add(m_pMonthlybutt, trUtf8("Hold down for options", "Comment for tooltip Monthlybutt")); - QWhatsThis::add(m_pMonthlybutt, trUtf8("The Monthly button makes a new monthly report.\nHold this button down to specify how many months.", "Comment for whatsThis Monthlybutt")); + Q3WhatsThis::add(m_pMonthlybutt, trUtf8("The Monthly button makes a new monthly report.\nHold this button down to specify how many months.", "Comment for whatsThis Monthlybutt")); } } // namespace AS