summaryrefslogtreecommitdiff
path: root/noncore/apps
authordrw <drw>2005-05-16 18:56:02 (UTC)
committer drw <drw>2005-05-16 18:56:02 (UTC)
commit348314c7411500e23ca467289ed92e446be9121b (patch) (side-by-side diff)
treef2eea2bec6b6e49f66d4a373b94d2e73f6937c46 /noncore/apps
parent17b9be61d7de14dea0d662a496e3d08bc9b1662e (diff)
downloadopie-348314c7411500e23ca467289ed92e446be9121b.zip
opie-348314c7411500e23ca467289ed92e446be9121b.tar.gz
opie-348314c7411500e23ca467289ed92e446be9121b.tar.bz2
Resource -> OResource
Diffstat (limited to 'noncore/apps') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/function_keyboard.cpp9
-rw-r--r--noncore/apps/opie-console/function_keyboard.h5
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp42
3 files changed, 30 insertions, 26 deletions
diff --git a/noncore/apps/opie-console/function_keyboard.cpp b/noncore/apps/opie-console/function_keyboard.cpp
index 0abe0d9..389618c 100644
--- a/noncore/apps/opie-console/function_keyboard.cpp
+++ b/noncore/apps/opie-console/function_keyboard.cpp
@@ -62,49 +62,49 @@ void FunctionKeyboard::changeCols(int c) {
}
void FunctionKeyboard::load (const Profile& prof) {
keys.clear();
numRows = prof.readNumEntry("keb_rows", 2);
numCols = prof.readNumEntry("keb_cols", 10);
keyWidth = (double)width()/numCols; // have to reset this thing too
/* load all the keys to the keyboard */
for (ushort i = 0; i <= numRows - 1; i++)
for (ushort j = 0; j <= numCols - 1; j++) {
QString h = "r" + QString::number(i) + "c" + QString::number(j);
QString values = prof.readEntry("keb_" + h);
if (!values.isEmpty()) {
QStringList l = QStringList::split(QChar('|'), values, TRUE);
keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt());
// load pixmap if used
if (!l[1].isEmpty()) {
- keys[h].pix = new QPixmap( Resource::loadPixmap( "console/keys/" + l[1] ) );
+ keys[h].pix = new QPixmap( Opie::Core::OResource::loadPixmap( "console/keys/" + l[1] ) );
}
}
}
if (keys.isEmpty()) loadDefaults();
hide();
show();
}
void FunctionKeyboard::paintEvent(QPaintEvent *e) {
QPainter p(this);
p.setClipRect(e->rect());
p.fillRect(0, 0, width(), height(), QColor(255,255,255));
p.setPen(QColor(0,0,0));
/* those decimals do count! becomes short if use plain int */
for (double i = 0; i <= width(); i += keyWidth) {
p.drawLine((int)i, 0, (int)i, height());
}
@@ -256,50 +256,49 @@ FunctionKeyboardConfig::FunctionKeyboardConfig(const QString& name, QWidget* par
: ProfileDialogKeyWidget(name, parent, na),
selectedRow(0), selectedCol(0)
{
kb = new FunctionKeyboard(this);
connect (kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)),
this, SLOT(slotKeyPressed(FKey,ushort,ushort,bool)));
QGroupBox *dimentions = new QGroupBox(2, Qt::Horizontal, tr("Dimensions"), this);
QLabel *l = new QLabel(tr("Rows"), dimentions);
m_rowBox = new QSpinBox(1, 15, 1, dimentions);
connect (m_rowBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeRows(int)));
l = new QLabel(tr("Columns"), dimentions);
m_colBox = new QSpinBox(1, 15, 1, dimentions);
connect (m_colBox, SIGNAL(valueChanged(int)), this, SLOT(slotChangeCols(int)));
QGroupBox *editKey = new QGroupBox(2, Qt::Horizontal, tr("Edit Key"), this);
l = new QLabel(tr("Label"), editKey);
m_labels = new QComboBox(true, editKey);
m_labels->setInsertionPolicy(QComboBox::AtCurrent);
m_labels->insertItem("");
QStringList files = QDir( QPEApplication::qpeDir() + "pics/console/keys/", "*.png").entryList();
for (uint i = 0; i < files.count(); i++) {
-
- m_labels->insertItem( Resource::loadPixmap("console/keys/" + files[i]), files[i]);
+ m_labels->insertItem( Opie::Core::OResource::loadPixmap("console/keys/" + files[i]), files[i]);
}
connect (m_labels, SIGNAL(activated(int)), this, SLOT(slotChangeIcon(int)));
connect (m_labels, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeLabelText(const QString&)));
l = new QLabel(tr("Q Keycode", "Qt Key Code for the OnScreen Keyboard"), editKey);
m_qvalues = new QComboBox(true, editKey);
m_qvalues->setInsertionPolicy(QComboBox::AtTop);
m_qvalues->setDuplicatesEnabled(false);
m_qvalues->insertItem("");
connect (m_qvalues, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeQCode(const QString&)));
l = new QLabel(tr("Unicode Value", "The Unicode value of the key"), editKey);
m_uniValues = new QComboBox(true, editKey);
m_uniValues->setInsertionPolicy(QComboBox::AtTop);
m_uniValues->setDuplicatesEnabled(false);
m_uniValues->insertItem("");
connect (m_uniValues, SIGNAL(textChanged(const QString&)), this, SLOT(slotChangeUnicode(const QString&)));
QVBoxLayout *root = new QVBoxLayout(this, 2);
root->addWidget(kb);
root->addWidget(dimentions);
root->addWidget(editKey);
}
FunctionKeyboardConfig::~FunctionKeyboardConfig() {
@@ -307,49 +306,49 @@ FunctionKeyboardConfig::~FunctionKeyboardConfig() {
}
void FunctionKeyboardConfig::load (const Profile& prof) {
kb->keys.clear();
kb->loadDefaults();
m_rowBox->setValue(prof.readNumEntry("keb_rows", 2));
m_colBox->setValue(prof.readNumEntry("keb_cols", 10));
/* load all the keys to the keyboard */
for (int i = 0; i <= m_rowBox->value() -1; i++)
for (int j = 0; j <= m_colBox->value() -1; j++) {
QString h = "r" + QString::number(i) + "c" + QString::number(j);
QString values = prof.readEntry("keb_" + h);
if (!values.isEmpty()) {
QStringList l = QStringList::split(QChar('|'), values, TRUE);
kb->keys[h] = FKey(l[0], l[1], l[2].toInt(), l[3].toInt());
// load pixmap if used
if (!l[1].isEmpty()) {
- kb->keys[h].pix = new QPixmap( Resource::loadPixmap( "console/keys/" + l[1] ) );
+ kb->keys[h].pix = new QPixmap( Opie::Core::OResource::loadPixmap( "console/keys/" + l[1] ) );
}
}
}
}
void FunctionKeyboardConfig::save (Profile& prof) {
prof.writeEntry("keb_rows", m_rowBox->value());
prof.writeEntry("keb_cols", m_colBox->value());
QMap<QString, FKey>::Iterator it;
for ( it = kb->keys.begin(); it != kb->keys.end(); it++) {
FKey k = it.data();
QString entry = k.label + "|"
+ k.pixFile + "|"
+ QString::number(k.qcode) + "|"
+ QString::number(k.unicode);
prof.writeEntry("keb_" + it.key(), entry);
}
}
@@ -382,42 +381,42 @@ void FunctionKeyboardConfig::slotKeyPressed(FKey k, ushort r, ushort c, bool pre
// any better way to select the pixmap?
m_labels->setCurrentItem((m_labels->listBox())->index((m_labels->listBox())->findItem(kb->keys[selectedHandle].pixFile)));
m_labels->setEditable(false);
}
m_qvalues->changeItem(QString::number(k.qcode), 0);
m_uniValues->changeItem(QString::number(k.unicode), 0);
}
void FunctionKeyboardConfig::slotChangeIcon(int index) {
if (index == 0) {
// is text
m_labels->setEditable(true);
// why tf does the text get erased unless i do this?
m_labels->changeItem(m_labels->text(0), 0);
kb->keys[selectedHandle].pixFile = "";
delete kb->keys[selectedHandle].pix;
} else {
// is a pixmap
m_labels->setEditable(false);
kb->keys[selectedHandle].pixFile = m_labels->currentText();
- kb->keys[selectedHandle].pix = new QPixmap( Resource::loadPixmap( "console/keys/" + m_labels->currentText() ) );
+ kb->keys[selectedHandle].pix = new QPixmap( Opie::Core::OResource::loadPixmap( "console/keys/" + m_labels->currentText() ) );
}
kb->paintKey(selectedRow, selectedCol);
}
void FunctionKeyboardConfig::slotChangeLabelText(const QString &label) {
kb->keys[selectedHandle].label = label;
kb->paintKey(selectedRow, selectedCol);
}
void FunctionKeyboardConfig::slotChangeQCode(const QString& qcode) {
kb->keys[selectedHandle].qcode = qcode.toUInt();
}
void FunctionKeyboardConfig::slotChangeUnicode(const QString& uni) {
kb->keys[selectedHandle].unicode = uni.toUInt();
}
diff --git a/noncore/apps/opie-console/function_keyboard.h b/noncore/apps/opie-console/function_keyboard.h
index a60ff4b..b7e211c 100644
--- a/noncore/apps/opie-console/function_keyboard.h
+++ b/noncore/apps/opie-console/function_keyboard.h
@@ -1,49 +1,50 @@
#ifndef OPIE_FUNCTION_KEYBOARD_H
#define OPIE_FUNCTION_KEYBOARD_H
+#include <opie2/oresource.h>
+
#include <qpe/config.h>
-#include <qpe/resource.h>
#include <qpe/qpeapplication.h>
#include <qframe.h>
#include <qpainter.h>
#include <qvbox.h>
#include <qgroupbox.h>
#include <qmap.h>
#include <qspinbox.h>
#include <qcombobox.h>
#include "profiledialogwidget.h"
struct FKey {
FKey(): qcode(0), unicode(0) {};
FKey(const QString &l, const QString &f, ushort q, ushort u):
label(l), pixFile(f), qcode(q), unicode(u) {
if (!f.isEmpty()) {
- pix = new QPixmap ( Resource::loadPixmap("console/keys/" + f ) );
+ pix = new QPixmap ( Opie::Core::OResource::loadPixmap("console/keys/" + f ) );
}
};
QString label;
QPixmap *pix;
QString pixFile;
ushort qcode;
ushort unicode;
};
class FunctionKeyboard : public QFrame {
Q_OBJECT
public:
FunctionKeyboard(QWidget *parent = 0);
~FunctionKeyboard();
friend class FunctionKeyboardConfig;
void changeRows(int);
void changeCols(int);
void load(const Profile &);
void loadDefaults();
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index eaa78c8..45a662c 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -1,39 +1,40 @@
#include "TEmulation.h"
#include "profileeditordialog.h"
#include "configdialog.h"
#include "default.h"
#include "profilemanager.h"
#include "mainwindow.h"
#include "tabwidget.h"
#include "transferdialog.h"
#include "function_keyboard.h"
#include "emulation_handler.h"
#include "script.h"
#include "fixit.h"
/* OPIE */
#include <opie2/ofiledialog.h>
+#include <opie2/oresource.h>
#include <qpe/filemanager.h>
using namespace Opie::Ui;
/* QT */
#include <qaction.h>
#include <qmenubar.h>
#include <qtoolbar.h>
#include <qmessagebox.h>
#include <qwhatsthis.h>
#include <qfileinfo.h>
/* STD */
#include <assert.h>
#include <opie2/oconfig.h>
MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
#ifdef FSCKED_DISTRI
FixIt fix;
fix.fixIt();
#endif
setCaption(QObject::tr("Opie Console") );
@@ -55,128 +56,131 @@ MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(
populateScripts();
}
void MainWindow::initUI() {
setToolBarsMovable( FALSE );
/* tool bar for the menu */
m_tool = new QToolBar( this );
m_tool->setHorizontalStretchable( TRUE );
m_bar = new QMenuBar( m_tool );
m_console = new QPopupMenu( this );
m_scripts = new QPopupMenu( this );
m_sessionsPop= new QPopupMenu( this );
m_scriptsPop = new QPopupMenu( this );
/* add a toolbar for icons */
m_icons = new QToolBar(this);
/*
* the settings action
*/
m_setProfiles = new QAction(tr("Configure Profiles"),
- Resource::loadPixmap( "SettingsIcon" ),
- QString::null, 0, this, 0);
+ Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0);
m_setProfiles->addTo( m_console );
connect( m_setProfiles, SIGNAL(activated() ),
this, SLOT(slotConfigure() ) );
m_console->insertSeparator();
/*
* new Action for new sessions
*/
QAction* newCon = new QAction(tr("New Profile"),
- Resource::loadPixmap( "new" ),
- QString::null, 0, this, 0);
+ Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0);
newCon->addTo( m_console );
connect( newCon, SIGNAL(activated() ),
this, SLOT(slotNew() ) );
m_console->insertSeparator();
QAction *saveCon = new QAction( tr("Save Profile" ),
- Resource::loadPixmap( "save" ), QString::null,
- 0, this, 0 );
+ Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ), QString::null,
+ 0, this, 0 );
saveCon->addTo( m_console );
connect( saveCon, SIGNAL(activated() ),
this, SLOT(slotSaveSession() ) );
m_console->insertSeparator();
/*
* connect action
*/
- m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"),
- QString::null, 0, this, 0 );
+ m_connect = new QAction( tr("Connect"), Opie::Core::OResource::loadPixmap("console/connected",
+ Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
m_connect->addTo( m_console );
connect(m_connect, SIGNAL(activated() ),
this, SLOT(slotConnect() ) );
/*
* disconnect action
*/
- m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"),
- QString::null, 0, this, 0 );
+ m_disconnect = new QAction( tr("Disconnect"), Opie::Core::OResource::loadPixmap("console/notconnected",
+ Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
m_disconnect->addTo( m_console );
connect(m_disconnect, SIGNAL(activated() ),
this, SLOT(slotDisconnect() ) );
m_console->insertSeparator();
#ifndef EAST
- m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 );
+ m_quickLaunch = new QAction( tr("QuickLaunch"),
+ Opie::Core::OResource::loadPixmap("console/konsole_mini", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0 );
m_quickLaunch->addTo( m_icons );
connect( m_quickLaunch, SIGNAL( activated() ),
this, SLOT( slotQuickLaunch() ) );
#endif
QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) );
- m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null,
- 0, this, 0 );
+ m_transfer = new QAction( tr("Transfer file..."), Opie::Core::OResource::loadPixmap("pass", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0 );
m_transfer->addTo( m_console );
connect(m_transfer, SIGNAL(activated() ),
this, SLOT(slotTransfer() ) );
/*
* immediate change of line wrap policy
*/
m_isWrapped = true;
- m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0, true );
+ m_wrap = new QAction( tr("Line wrap"), Opie::Core::OResource::loadPixmap( "linewrap", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0, true );
m_wrap->addTo( m_console );
m_wrap->setOn( true );
connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) );
/*
* fullscreen
*/
m_isFullscreen = false;
- m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" )
- , QString::null, 0, this, 0 );
+ m_fullscreen = new QAction( tr("Full screen"), Opie::Core::OResource::loadPixmap( "fullscreen",
+ Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
m_fullscreen->addTo( m_console );
connect( m_fullscreen, SIGNAL( activated() ),
this, SLOT( slotFullscreen() ) );
m_console->insertSeparator();
m_recordLog = new QAction();
m_recordLog->setText( tr("Start log") );
m_recordLog->addTo( m_console );
connect(m_recordLog, SIGNAL(activated() ),
this, SLOT( slotSaveLog() ) );
m_recordingLog = false;
QAction *a = new QAction();
a->setText( tr("Save history") );
a->addTo( m_console );
connect(a, SIGNAL(activated() ),
this, SLOT(slotSaveHistory() ) );
/*
* terminate action
*/
m_terminate = new QAction();
m_terminate->setText( tr("Terminate") );
m_terminate->addTo( m_console );
@@ -190,89 +194,89 @@ void MainWindow::initUI() {
this, SLOT(slotClose() ) );
/*
* script actions
*/
m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0);
connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int)));
m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0);
m_recordScript->addTo(m_scripts);
connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript()));
m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0);
m_saveScript->addTo(m_scripts);
connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript()));
/*
* action that open/closes the keyboard
*/
m_openKeys = new QAction (tr("Open Keyboard..."),
- Resource::loadPixmap( "console/keys/keyboard_icon" ),
+ Opie::Core::OResource::loadPixmap( "console/keys/keyboard_icon", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0);
m_openKeys->setToggleAction(true);
connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool)));
/* insert the submenu */
m_console->insertItem(tr("New from Profile"), m_sessionsPop,
-1, 0);
/* insert the connection menu */
m_bar->insertItem( tr("Connection"), m_console );
/* the scripts menu */
#ifdef EAST
Opie::Core::OConfig cfg("opie-console");
cfg.setGroup("10east");
if( !cfg.readEntry("scripthide",0) ) {
m_bar->insertItem( tr("Scripts"), m_scripts );
}
#endif
/* and the keyboard */
m_keyBar = new QToolBar(this);
addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
m_keyBar->setHorizontalStretchable( TRUE );
m_keyBar->hide();
m_kb = new FunctionKeyboard(m_keyBar);
connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)),
this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool)));
a = new QAction(tr("Copy"),
- Resource::loadPixmap("copy"), QString::null,
+ Opie::Core::OResource::loadPixmap("copy", Opie::Core::OResource::SmallIcon ), QString::null,
0, this, 0 );
//a->addTo( m_icons );
connect( a, SIGNAL(activated() ),
this, SLOT(slotCopy() ) );
QAction *paste = new QAction(tr("Paste"),
- Resource::loadPixmap("paste"), QString::null,
+ Opie::Core::OResource::loadPixmap("paste", Opie::Core::OResource::SmallIcon ), QString::null,
0, this, 0 );
connect( paste, SIGNAL(activated() ),
this, SLOT(slotPaste() ) );
newCon->addTo( m_icons );
//m_setProfiles->addTo( m_icons );
paste->addTo( m_icons );
m_openKeys->addTo(m_icons);
m_fullscreen->addTo( m_icons );
m_connect->setEnabled( false );
m_disconnect->setEnabled( false );
m_terminate->setEnabled( false );
m_transfer->setEnabled( false );
m_scripts->setItemEnabled(m_runScript_id, false);
m_recordScript->setEnabled( false );
m_saveScript->setEnabled( false );
m_fullscreen->setEnabled( false );
m_closewindow->setEnabled( false );
m_wrap->setEnabled( false );
/*
* connect to the menu activation