summaryrefslogtreecommitdiff
authorzecke <zecke>2004-02-29 15:40:12 (UTC)
committer zecke <zecke>2004-02-29 15:40:12 (UTC)
commitf8e1f2c5201f7e86abaa7365040d919e2afcd2ae (patch) (side-by-side diff)
treea0ef1ee60b28c4918d31d947c303103fc2a447b3
parenta731ace5bdbef2354209c655805ebac5298dc2df (diff)
downloadopie-f8e1f2c5201f7e86abaa7365040d919e2afcd2ae.zip
opie-f8e1f2c5201f7e86abaa7365040d919e2afcd2ae.tar.gz
opie-f8e1f2c5201f7e86abaa7365040d919e2afcd2ae.tar.bz2
Hehe Fix the #ifdef properly.... gives me my fonts back
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index 2c0001f..eafc12e 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -305,258 +305,256 @@ void Konsole::initCommandList()
}
}
items.sort();
int n = items.count();
if (n > 40)
{
n = 40;
}
for(int i=0; i<n; i++)
{
// should insert start of command, but keep whole thing
if (items.at(items.count()-i-1)->line.length() < 30)
{
commonCombo->insertItem(items.at(items.count()-i-1)->line);
}
}
histfile.close();
}
}
if (cfg.readEntry("Commands Set","FALSE") == "FALSE")
{
for (int i = 0; commonCmds[i] != NULL; i++)
{
commonCombo->insertItem(commonCmds[i]);
}
}
else
{
for (int i = 0; i < 100; i++)
{
if (!(cfg.readEntry( QString::number(i),"")).isEmpty())
commonCombo->insertItem(cfg.readEntry( QString::number(i),""));
}
}
}
static void sig_handler(int x)
{
printf("got signal %d\n",x);
}
void Konsole::init(const char* _pgm, QStrList & _args)
{
#if 0
for(int i=1; i<=31; i++)
{
if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV
&& i != SIGINT && i != SIGILL && i != SIGTERM
&& i != SIGBUS)
signal(i,sig_handler);
}
#endif
signal(SIGSTOP, sig_handler);
signal(SIGCONT, sig_handler);
signal(SIGTSTP, sig_handler);
b_scroll = TRUE; // histon;
n_keytab = 0;
n_render = 0;
startUp=0;
fromMenu = FALSE;
fullscreen = false;
setCaption( tr( "Konsole" ) );
setIcon( Resource::loadPixmap( "konsole/Terminal" ) );
Config cfg( "Konsole" );
cfg.setGroup("Font");
QString tmp;
// initialize the list of allowed fonts ///////////////////////////////////
QString cfgFontName = cfg.readEntry("FontName","Lcfont");
int cfgFontSize = cfg.readNumEntry("FontSize",18);
cfont = -1;
// this code causes repeated access to all the font files
// which does slow down startup
QFontDatabase fontDB;
QStringList familyNames;
familyNames = fontDB.families( FALSE );
QString s;
int fontIndex = 0;
int familyNum = 0;
fontList = new QPopupMenu( this );
for(uint j = 0; j < (uint)familyNames.count(); j++)
{
s = familyNames[j];
if ( s.contains('-') )
{
int i = s.find('-');
s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]";
}
s[0] = s[0].upper();
QValueList<int> sizes = fontDB.pointSizes( familyNames[j] );
printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(),
sizes.count());
if (sizes.count() > 0)
{
QPopupMenu *sizeMenu;
QFont f;
int last_width = -1;
sizeMenu = NULL;
for(uint i = 0; i < (uint)sizes.count() + 4; i++)
{
// printf("family %s size %d ", familyNames[j].latin1(), sizes[i]);
// need to divide by 10 on the Z, but not otherwise
int size;
if (i >= (uint)sizes.count())
{
// try for expandable fonts
size = sizes[sizes.count()-1] + 2 * (i - sizes.count() + 1);
}
else
{
printf("sizes[%d] = %d\n", i, sizes[i]);
size = sizes[i];
}
- // a hack, sizes on Z seem to be points*10
- size /= 10;
f = QFont(familyNames[j], size);
f.setFixedPitch(true);
QFontMetrics fm(f);
// don't trust f.fixedPitch() or f.exactMatch(), they lie!!
if (fm.width("l") == fm.width("m")
&& (i < (uint)sizes.count()
|| fm.width("m") > last_width))
{
if (i < (uint)sizes.count())
{
last_width = fm.width("m");
}
if (sizeMenu == NULL)
{
sizeMenu = new QPopupMenu();
}
int id = sizeMenu->insertItem(QString("%1").arg(size), fontIndex);
sizeMenu->setItemParameter(id, fontIndex);
sizeMenu->connectItem(id, this, SLOT(setFont(int)));
QString name = s + " " + QString::number(size);
fonts.append(new VTFont(name, f, familyNames[j], familyNum, size));
if (familyNames[j] == cfgFontName && size == cfgFontSize)
{
cfont = fontIndex;
}
printf("FOUND: %s family %s size %d\n", name.latin1(), familyNames[j].latin1(), size);
fontIndex++;
}
}
if (sizeMenu)
{
fontList->insertItem(s, sizeMenu, familyNum + 1000);
familyNum++;
}
}
}
if (cfont < 0 || cfont >= (int)fonts.count())
{
cfont = 0;
}
// create terminal emulation framework ////////////////////////////////////
nsessions = 0;
tab = new EKNumTabWidget(this);
// tab->setMargin(tab->margin()-5);
connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*)));
// create terminal toolbar ////////////////////////////////////////////////
setToolBarsMovable( FALSE );
menuToolBar = new QToolBar( this );
menuToolBar->setHorizontalStretchable( TRUE );
QMenuBar *menuBar = new QMenuBar( menuToolBar );
bool c7xx = false;
if (qApp->desktop()->width() > 600 || qApp->desktop()->height() > 600)
{
c7xx = true;
}
QFont menuFont;
menuFont.setPointSize(c7xx? 18 : 10);
qApp->setFont(menuFont, true);
setFont(cfont);
configMenu = new QPopupMenu( this);
colorMenu = new QPopupMenu( this);
scrollMenu = new QPopupMenu( this);
editCommandListMenu = new QPopupMenu( this);
configMenu->insertItem(tr("Command List"), editCommandListMenu);
bool listHidden;
cfg.setGroup("Menubar");
if( cfg.readEntry("Hidden","FALSE") == "TRUE")
{
ec_cmdlist = editCommandListMenu->insertItem( tr( "Show command list" ));
listHidden=TRUE;
}
else
{
ec_cmdlist = editCommandListMenu->insertItem( tr( "Hide command list" ));
listHidden=FALSE;
}
cfg.setGroup("Tabs");
tabMenu = new QPopupMenu(this);
tm_bottom = tabMenu->insertItem(tr("Bottom" ));
tm_top = tabMenu->insertItem(tr("Top"));
tm_hidden = tabMenu->insertItem(tr("Hidden"));
configMenu->insertItem(tr("Tabs"), tabMenu);
tmp=cfg.readEntry("Position","Top");
if(tmp=="Top")
{
tab->setTabPosition(QTabWidget::Top);
tab->getTabBar()->show();
tabPos = tm_top;
}
else if (tmp=="Bottom")
{
tab->setTabPosition(QTabWidget::Bottom);
tab->getTabBar()->show();
tabPos = tm_bottom;
}
else
{
tab->getTabBar()->hide();
tab->setMargin(tab->margin());
tabPos = tm_hidden;
}
cm_bw = colorMenu->insertItem(tr( "Black on White"));
cm_wb = colorMenu->insertItem(tr( "White on Black"));
cm_gb = colorMenu->insertItem(tr( "Green on Black"));
// cm_bt = colorMenu->insertItem(tr( "Black on Transparent"));
cm_br = colorMenu->insertItem(tr( "Black on Pink"));
cm_rb = colorMenu->insertItem(tr( "Pink on Black"));
cm_gy = colorMenu->insertItem(tr( "Green on Yellow"));
cm_bm = colorMenu->insertItem(tr( "Blue on Magenta"));
cm_mb = colorMenu->insertItem(tr( "Magenta on Blue"));