*/
#ifdef MYDEF_GTK_EXISTS
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
+extern "C"
+{
+ #include <gdk/gdk.h>
+ #include <gtk/gtk.h>
+}
#endif
#include <QtCore>
#include <QtMaemo5>
#endif
-#include <sys/vfs.h>
+extern "C"
+{
+ #include <sys/vfs.h>
+}
#include "mainwindow.h"
#include "version.h"
Phonon::createPath(iMediaObject, aout);
showFreeSpace();
+
+ show();
+ orientationChanged();
}
MainWindow::~MainWindow()
// save "need repo refresh" status
iSettings->qsettings()->setValue("need_repo_refresh", iAptInterface->needRepoRefresh());
- delete iWinPackageView;
- delete iWinRepoView;
- delete iAptInterface;
- delete iDpkgInterface;
- delete iDimmer;
- delete iSettings;
- delete ui;
+ delete iWinPackageView; iWinPackageView=0;
+ delete iWinRepoView; iWinRepoView=0;
+ delete iAptInterface; iAptInterface=0;
+ delete iDpkgInterface; iDpkgInterface=0;
+ delete iDimmer; iDimmer=0;
+ delete iSettings; iSettings=0;
+ delete ui; ui=0;
+ //iMediaObject and aout automatically deleted by their parent
}
void MainWindow::changeEvent(QEvent *e)
void MainWindow::orientationChanged()
{
- //ui->centralWidget->adjustSize();
- //ui->listWidget->adjustSize();
+ if( QApplication::desktop()->width() > QApplication::desktop()->height() )
+ ui->listWidget->setGridSize( QSize((ui->listWidget->width()-12)/5, (ui->listWidget->height()-12)/2) );
+ else
+ ui->listWidget->setGridSize( QSize((ui->listWidget->width()-12)/3, (ui->listWidget->height()-12)/3) );
}
struct statfs opt_stat;
statfs("/",&root_stat);
statfs("/opt",&opt_stat);
- quint64 free_root = root_stat.f_bavail * root_stat.f_bsize / 1024;
- quint64 free_opt = opt_stat.f_bavail * opt_stat.f_bsize / 1024;
- quint64 total_root = root_stat.f_blocks * root_stat.f_bsize / 1024;
- quint64 total_opt = opt_stat.f_blocks * opt_stat.f_bsize / 1024;
+ quint64 free_root = static_cast<quint64>(root_stat.f_bavail) * static_cast<quint64>(root_stat.f_bsize) / 1024;
+ quint64 free_opt = static_cast<quint64>(opt_stat.f_bavail) * static_cast<quint64>(opt_stat.f_bsize) / 1024;
+ quint64 total_root = static_cast<quint64>(root_stat.f_blocks) * static_cast<quint64>(root_stat.f_bsize) / 1024;
+ quint64 total_opt = static_cast<quint64>(opt_stat.f_blocks) * static_cast<quint64>(opt_stat.f_bsize) / 1024;
qDebug() << "rootfs" << free_root << "/" << total_root << "kB free";
qDebug() << "opt fs" << free_opt << "/" << total_opt << "kB free";
void MainWindow::on_listWidget_itemClicked(QListWidgetItem* item)
{
- if( item->text() == "Manage repositories" ) {
+ qDebug() << "main menu:" << item->statusTip();
+
+ if( item->statusTip() == "manage_repos" ) {
on_btnRepos_clicked();
}
- else if( item->text() == "Update catalogs" ) {
+ else if( item->statusTip() == "update_catalogs" ) {
on_btnUpdate_clicked();
}
- else if( item->text() == "Install applications" ) {
+ else if( item->statusTip() == "install_apps" ) {
on_btnListInstallable_clicked();
}
- else if( item->text() == "Remove applications" ) {
+ else if( item->statusTip() == "remove_apps" ) {
on_btnListInstalled_clicked();
}
- else if( item->text() == "Upgrade applications" ) {
+ else if( item->statusTip() == "upgrade_apps" ) {
on_btnUpgrade_clicked();
}
else {