mirror of
https://github.com/ra3xdh/qucs_s
synced 2025-03-28 21:13:26 +00:00
Initial changes qucs-attenuator Qt4 only.
Trying to get rid of Qt3Support.
This commit is contained in:
parent
05ba4ef5e4
commit
e39a2b4cc3
@ -21,18 +21,17 @@
|
||||
|
||||
#include "helpdialog.h"
|
||||
|
||||
#include <qlayout.h>
|
||||
#include <q3hbox.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <q3textedit.h>
|
||||
//Added by qt3to4:
|
||||
#include <Q3VBoxLayout>
|
||||
#include <QLayout>
|
||||
#include <QPushButton>
|
||||
#include <QTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
|
||||
HelpDialog::HelpDialog(QWidget *parent)
|
||||
: QDialog(parent, 0, false, Qt::WDestructiveClose)
|
||||
: QDialog(parent)//, 0, false, Qt::WDestructiveClose)
|
||||
{
|
||||
setCaption(tr("Qucs Attenuator Help"));
|
||||
setWindowTitle(tr("Qucs Attenuator Help"));
|
||||
|
||||
|
||||
// -------- set help text into dialog ------------
|
||||
@ -51,25 +50,26 @@ HelpDialog::HelpDialog(QWidget *parent)
|
||||
// -------- create dialog widgets ------------
|
||||
resize(250, 230);
|
||||
|
||||
vLayout = new Q3VBoxLayout(this);
|
||||
vLayout = new QVBoxLayout();
|
||||
|
||||
Text = new Q3TextEdit(s, QString::null, this);
|
||||
Text->setTextFormat(Qt::PlainText);
|
||||
Text = new QTextEdit(s, this);//?QString::null, this);
|
||||
//Text->setTextFormat(Qt::PlainText);
|
||||
Text->setReadOnly(true);
|
||||
// Text->setWordWrap(QTextEdit::NoWrap);
|
||||
//Text->setWordWrap(QTextEdit::NoWrap);
|
||||
Text->setMinimumSize(200,200);
|
||||
vLayout->addWidget(Text);
|
||||
|
||||
Q3HBox *h = new Q3HBox(this);
|
||||
vLayout->addWidget(h);
|
||||
QHBoxLayout *h = new QHBoxLayout();
|
||||
h->addLayout(vLayout);
|
||||
|
||||
h->setStretchFactor(new QWidget(h),5); // stretchable placeholder
|
||||
//h->setStretchFactor(new QWidget(h),5); // stretchable placeholder
|
||||
|
||||
QPushButton *ButtonClose = new QPushButton(tr("Close"), h);
|
||||
QPushButton *ButtonClose = new QPushButton(tr("Close"));
|
||||
h->addWidget(ButtonClose);
|
||||
connect(ButtonClose, SIGNAL(clicked()), SLOT(slotClose()));
|
||||
ButtonClose->setFocus();
|
||||
|
||||
h->setStretchFactor(new QWidget(h),5); // stretchable placeholder
|
||||
//h->setStretchFactor(new QWidget(h),5); // stretchable placeholder
|
||||
}
|
||||
|
||||
HelpDialog::~HelpDialog()
|
||||
|
@ -18,12 +18,11 @@
|
||||
#ifndef HELPDIALOG_H
|
||||
#define HELPDIALOG_H
|
||||
|
||||
#include <qdialog.h>
|
||||
//Added by qt3to4:
|
||||
#include <Q3VBoxLayout>
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
class Q3TextEdit;
|
||||
class Q3VBoxLayout;
|
||||
class QTextEdit;
|
||||
class QVBoxLayout;
|
||||
|
||||
/**
|
||||
*@author Michael Margraf
|
||||
@ -39,8 +38,8 @@ private slots:
|
||||
void slotClose();
|
||||
|
||||
private:
|
||||
Q3VBoxLayout *vLayout;
|
||||
Q3TextEdit *Text;
|
||||
QVBoxLayout *vLayout;
|
||||
QTextEdit *Text;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <qtextcodec.h>
|
||||
#include <qtranslator.h>
|
||||
#include <qfile.h>
|
||||
#include <q3textstream.h>
|
||||
#include <QTextstream>
|
||||
#include <qmessagebox.h>
|
||||
#include <qdir.h>
|
||||
#include <qfont.h>
|
||||
@ -38,11 +38,11 @@ bool loadSettings()
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
QFile file(QDir::homeDirPath()+QDir::convertSeparators ("/.qucs/attenuatorrc"));
|
||||
QFile file(QDir::homePath()+QDir::convertSeparators ("/.qucs/attenuatorrc"));
|
||||
if(!file.open(QIODevice::ReadOnly))
|
||||
result = false; // settings file doesn't exist
|
||||
else {
|
||||
Q3TextStream stream(&file);
|
||||
QTextStream stream(&file);
|
||||
QString Line, Setting;
|
||||
while(!stream.atEnd()) {
|
||||
Line = stream.readLine();
|
||||
@ -57,16 +57,16 @@ bool loadSettings()
|
||||
file.close();
|
||||
}
|
||||
|
||||
file.setName(QDir::homeDirPath()+QDir::convertSeparators ("/.qucs/qucsrc"));
|
||||
file.setFileName(QDir::homePath()+QDir::convertSeparators ("/.qucs/qucsrc"));
|
||||
if(!file.open(QIODevice::ReadOnly))
|
||||
result = true; // qucs settings not necessary
|
||||
else {
|
||||
Q3TextStream stream(&file);
|
||||
QTextStream stream(&file);
|
||||
QString Line, Setting;
|
||||
while(!stream.atEnd()) {
|
||||
Line = stream.readLine();
|
||||
Setting = Line.section('=',0,0);
|
||||
Line = Line.section('=',1,1).stripWhiteSpace();
|
||||
Line = Line.section('=',1,1).trimmed();
|
||||
if(Setting == "Font")
|
||||
QucsSettings.font.fromString(Line);
|
||||
else if(Setting == "Language")
|
||||
@ -86,7 +86,7 @@ bool saveApplSettings(QucsAttenuator *qucs)
|
||||
return true; // nothing has changed
|
||||
|
||||
|
||||
QFile file(QDir::homeDirPath()+QDir::convertSeparators ("/.qucs/attenuatorrc"));
|
||||
QFile file(QDir::homePath()+QDir::convertSeparators ("/.qucs/attenuatorrc"));
|
||||
if(!file.open(QIODevice::WriteOnly)) {
|
||||
QMessageBox::warning(0, QObject::tr("Warning"),
|
||||
QObject::tr("Cannot save settings !"));
|
||||
@ -94,7 +94,7 @@ bool saveApplSettings(QucsAttenuator *qucs)
|
||||
}
|
||||
|
||||
QString Line;
|
||||
Q3TextStream stream(&file);
|
||||
QTextStream stream(&file);
|
||||
|
||||
stream << "Settings file, Qucs Attenuator " PACKAGE_VERSION "\n"
|
||||
<< "AttenuatorWindow=" << qucs->x() << ',' << qucs->y() << '\n';
|
||||
@ -133,12 +133,13 @@ int main( int argc, char ** argv )
|
||||
QTranslator tor( 0 );
|
||||
QString lang = QucsSettings.Language;
|
||||
if(lang.isEmpty())
|
||||
lang = QTextCodec::locale();
|
||||
lang = QString(QLocale::system().name());
|
||||
tor.load( QString("qucs_") + lang, QucsSettings.LangDir);
|
||||
a.installTranslator( &tor );
|
||||
|
||||
QucsAttenuator *qucs = new QucsAttenuator();
|
||||
a.setMainWidget(qucs);
|
||||
//a.setMainWidget(qucs);
|
||||
qucs->raise();
|
||||
qucs->move(QucsSettings.x, QucsSettings.y); // position before "show" !!!
|
||||
qucs->show();
|
||||
int result = a.exec();
|
||||
|
@ -16,47 +16,61 @@
|
||||
|
||||
#include "attenuatorfunc.h"
|
||||
#include "qucsattenuator.h"
|
||||
//Added by qt3to4:
|
||||
#include <Q3GridLayout>
|
||||
#include <QPixmap>
|
||||
#include <Q3VBoxLayout>
|
||||
#include "helpdialog.h"
|
||||
|
||||
#include <q3vgroupbox.h>
|
||||
#include <q3vbox.h>
|
||||
#include <qmenubar.h>
|
||||
#include <q3popupmenu.h>
|
||||
#include <qmessagebox.h>
|
||||
#include <qlayout.h>
|
||||
#include <qlabel.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qvalidator.h>
|
||||
#include <qtimer.h>
|
||||
#include <qclipboard.h>
|
||||
#include <qapplication.h>
|
||||
#include <qimage.h>
|
||||
#include <QGridLayout>
|
||||
#include <QPixmap>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <Q3VBoxLayout>
|
||||
#include <Q3VBox>
|
||||
#include <Q3GroupBox>
|
||||
#include <Q3GridLayout>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QMenu>
|
||||
#include <QMenuBar>
|
||||
#include <QMessageBox>
|
||||
#include <QLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QLineEdit>
|
||||
#include <QComboBox>
|
||||
#include <QValidator>
|
||||
#include <QTimer>
|
||||
#include <QClipboard>
|
||||
#include <QApplication>
|
||||
#include <QImage>
|
||||
|
||||
QucsAttenuator::QucsAttenuator()
|
||||
{
|
||||
setIcon(QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
|
||||
setCaption("Qucs Attenuator " PACKAGE_VERSION);
|
||||
setWindowIcon(QPixmap(QucsSettings.BitmapDir + "big.qucs.xpm"));
|
||||
setWindowTitle("Qucs Attenuator " PACKAGE_VERSION);
|
||||
|
||||
Q3PopupMenu *fileMenu = new Q3PopupMenu();
|
||||
fileMenu->insertItem(tr("E&xit"), this, SLOT(slotQuit()), Qt::CTRL+Qt::Key_Q);
|
||||
QMenu *fileMenu = new QMenu(tr("&File"));
|
||||
|
||||
Q3PopupMenu *helpMenu = new Q3PopupMenu();
|
||||
helpMenu->insertItem(tr("Help..."), this, SLOT(slotHelpIntro()), Qt::Key_F1);
|
||||
helpMenu->insertSeparator();
|
||||
helpMenu->insertItem(
|
||||
tr("&About QucsAttenuator..."), this, SLOT(slotHelpAbout()), 0);
|
||||
helpMenu->insertItem(tr("About Qt..."), this, SLOT(slotHelpAboutQt()), 0);
|
||||
QAction *fileQuit = new QAction(tr("&Quit"), this);
|
||||
fileQuit->setShortcut(Qt::CTRL+Qt::Key_Q);
|
||||
connect(fileQuit, SIGNAL(activated()), SLOT(slotQuit()));
|
||||
|
||||
fileMenu->addAction(fileQuit);
|
||||
|
||||
QMenu *helpMenu = new QMenu(tr("&Help"));
|
||||
QAction *helpHelp = new QAction(tr("&Help"), this);
|
||||
helpHelp->setShortcut(Qt::Key_F1);
|
||||
helpMenu->addAction(helpHelp);
|
||||
connect(helpHelp, SIGNAL(activated()), SLOT(slotHelpIntro()));
|
||||
|
||||
helpMenu->addSeparator();
|
||||
|
||||
QAction *about = new QAction(tr("About Qt..."), this);
|
||||
helpMenu->addAction(about);
|
||||
connect(about, SIGNAL(activated()), SLOT(slotHelpAboutQt()));
|
||||
|
||||
QMenuBar *bar = new QMenuBar(this);
|
||||
bar->insertItem(tr("&File"), fileMenu);
|
||||
bar->insertSeparator ();
|
||||
bar->insertItem(tr("&Help"), helpMenu);
|
||||
bar->addMenu(fileMenu);
|
||||
bar->addSeparator();
|
||||
bar->addMenu(helpMenu);
|
||||
|
||||
Q3VBoxLayout * v2 = new Q3VBoxLayout (this);
|
||||
Q3VBox * vm = new Q3VBox (this);
|
||||
|
@ -14,13 +14,14 @@
|
||||
#ifndef QUCSATTENUATOR_H
|
||||
#define QUCSATTENUATOR_H
|
||||
|
||||
#include <qdialog.h>
|
||||
#include <QDialog>
|
||||
//Added by qt3to4:
|
||||
#include <Q3GridLayout>
|
||||
//#include <Q3GridLayout>
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
#include "attenuatorfunc.h"
|
||||
|
||||
class Q3GridLayout;
|
||||
class QGridLayout;
|
||||
class QComboBox;
|
||||
class QLineEdit;
|
||||
class QIntValidator;
|
||||
|
Loading…
x
Reference in New Issue
Block a user