diff options
author | Michael Koch <konqueror@gmx.de> | 2009-08-19 21:21:46 +0200 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2018-02-26 20:23:11 +0100 |
commit | 73ec78d75b4a803e56ed910f32639f94dc30a1e0 (patch) | |
tree | 5f29fcdfa71b567ecd94aa017950e0c06dd8642f |
Import Debian version 1
hannah-foo2zjs (1:1) unstable; urgency=low
* Initial release. Separated out from foo2zjs package.
(Closes: #449497, #503813, #503814).
-rw-r--r-- | Makefile | 209 | ||||
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | debian/compat | 1 | ||||
-rw-r--r-- | debian/control | 19 | ||||
-rw-r--r-- | debian/copyright | 23 | ||||
-rw-r--r-- | debian/hannah-foo2zjs.dirs | 3 | ||||
-rw-r--r-- | debian/hannah-foo2zjs.menu | 6 | ||||
-rwxr-xr-x | debian/rules | 64 | ||||
-rw-r--r-- | gui.cpp | 265 | ||||
-rw-r--r-- | gui.h | 80 | ||||
-rwxr-xr-x | hannah | bin | 0 -> 57456 bytes | |||
-rw-r--r-- | hannah.desktop | 7 | ||||
-rw-r--r-- | hannah.pro | 12 | ||||
-rw-r--r-- | main.cpp | 27 |
14 files changed, 722 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5027f0e --- /dev/null +++ b/Makefile @@ -0,0 +1,209 @@ +############################################################################# +# Makefile for building: hannah +# Generated by qmake (2.01a) (Qt 4.5.2) on: Mi. Aug 19 20:56:33 2009 +# Project: hannah.pro +# Template: app +# Command: /usr/bin/qmake-qt4 -unix -o Makefile hannah.pro +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) +CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) +INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. +LINK = g++ +LFLAGS = -Wl,-O1 +LIBS = $(SUBLIBS) -L/usr/lib -lQtGui -lQtCore -lpthread +AR = ar cqs +RANLIB = +QMAKE = /usr/bin/qmake-qt4 +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -r +INSTALL_FILE = install -m 644 -p +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = install -m 755 -p +DEL_FILE = rm -f +SYMLINK = ln -sf +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +SOURCES = gui.cpp \ + main.cpp moc_gui.cpp +OBJECTS = gui.o \ + main.o \ + moc_gui.o +DIST = /usr/share/qt4/mkspecs/common/g++.conf \ + /usr/share/qt4/mkspecs/common/unix.conf \ + /usr/share/qt4/mkspecs/common/linux.conf \ + /usr/share/qt4/mkspecs/qconfig.pri \ + /usr/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/share/qt4/mkspecs/features/qt_config.prf \ + /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/share/qt4/mkspecs/features/default_pre.prf \ + /usr/share/qt4/mkspecs/features/release.prf \ + /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/warn_on.prf \ + /usr/share/qt4/mkspecs/features/qt.prf \ + /usr/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/share/qt4/mkspecs/features/moc.prf \ + /usr/share/qt4/mkspecs/features/resources.prf \ + /usr/share/qt4/mkspecs/features/uic.prf \ + /usr/share/qt4/mkspecs/features/yacc.prf \ + /usr/share/qt4/mkspecs/features/lex.prf \ + /usr/share/qt4/mkspecs/features/include_source_dir.prf \ + hannah.pro +QMAKE_TARGET = hannah +DESTDIR = +TARGET = hannah + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile $(TARGET) + +$(TARGET): $(OBJECTS) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) + +Makefile: hannah.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \ + /usr/share/qt4/mkspecs/common/unix.conf \ + /usr/share/qt4/mkspecs/common/linux.conf \ + /usr/share/qt4/mkspecs/qconfig.pri \ + /usr/share/qt4/mkspecs/features/qt_functions.prf \ + /usr/share/qt4/mkspecs/features/qt_config.prf \ + /usr/share/qt4/mkspecs/features/exclusive_builds.prf \ + /usr/share/qt4/mkspecs/features/default_pre.prf \ + /usr/share/qt4/mkspecs/features/release.prf \ + /usr/share/qt4/mkspecs/features/default_post.prf \ + /usr/share/qt4/mkspecs/features/warn_on.prf \ + /usr/share/qt4/mkspecs/features/qt.prf \ + /usr/share/qt4/mkspecs/features/unix/thread.prf \ + /usr/share/qt4/mkspecs/features/moc.prf \ + /usr/share/qt4/mkspecs/features/resources.prf \ + /usr/share/qt4/mkspecs/features/uic.prf \ + /usr/share/qt4/mkspecs/features/yacc.prf \ + /usr/share/qt4/mkspecs/features/lex.prf \ + /usr/share/qt4/mkspecs/features/include_source_dir.prf \ + /usr/lib/libQtGui.prl \ + /usr/lib/libQtCore.prl + $(QMAKE) -unix -o Makefile hannah.pro +/usr/share/qt4/mkspecs/common/g++.conf: +/usr/share/qt4/mkspecs/common/unix.conf: +/usr/share/qt4/mkspecs/common/linux.conf: +/usr/share/qt4/mkspecs/qconfig.pri: +/usr/share/qt4/mkspecs/features/qt_functions.prf: +/usr/share/qt4/mkspecs/features/qt_config.prf: +/usr/share/qt4/mkspecs/features/exclusive_builds.prf: +/usr/share/qt4/mkspecs/features/default_pre.prf: +/usr/share/qt4/mkspecs/features/release.prf: +/usr/share/qt4/mkspecs/features/default_post.prf: +/usr/share/qt4/mkspecs/features/warn_on.prf: +/usr/share/qt4/mkspecs/features/qt.prf: +/usr/share/qt4/mkspecs/features/unix/thread.prf: +/usr/share/qt4/mkspecs/features/moc.prf: +/usr/share/qt4/mkspecs/features/resources.prf: +/usr/share/qt4/mkspecs/features/uic.prf: +/usr/share/qt4/mkspecs/features/yacc.prf: +/usr/share/qt4/mkspecs/features/lex.prf: +/usr/share/qt4/mkspecs/features/include_source_dir.prf: +/usr/lib/libQtGui.prl: +/usr/lib/libQtCore.prl: +qmake: FORCE + @$(QMAKE) -unix -o Makefile hannah.pro + +dist: + @$(CHK_DIR_EXISTS) .tmp/hannah1.0.0 || $(MKDIR) .tmp/hannah1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/hannah1.0.0/ && $(COPY_FILE) --parents gui.h .tmp/hannah1.0.0/ && $(COPY_FILE) --parents gui.cpp main.cpp .tmp/hannah1.0.0/ && (cd `dirname .tmp/hannah1.0.0` && $(TAR) hannah1.0.0.tar hannah1.0.0 && $(COMPRESS) hannah1.0.0.tar) && $(MOVE) `dirname .tmp/hannah1.0.0`/hannah1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/hannah1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile + + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: moc_gui.cpp +compiler_moc_header_clean: + -$(DEL_FILE) moc_gui.cpp +moc_gui.cpp: gui.h + /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) gui.h -o moc_gui.cpp + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: +compiler_uic_clean: +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_header_clean + +####### Compile + +gui.o: gui.cpp gui.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o gui.o gui.cpp + +main.o: main.cpp gui.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp + +moc_gui.o: moc_gui.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_gui.o moc_gui.cpp + +####### Install + +install: FORCE + +uninstall: FORCE + +FORCE: + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..5fe50ee --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +hannah-foo2zjs (1:1) unstable; urgency=low + + * Initial release. Separated out from foo2zjs package. + (Closes: #449497, #503813, #503814). + + -- Michael Koch <konqueror@gmx.de> Wed, 19 Aug 2009 21:21:46 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +7 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..5ef90ee --- /dev/null +++ b/debian/control @@ -0,0 +1,19 @@ +Source: hannah-foo2zjs +Section: contrib/text +Priority: optional +Maintainer: Michael Koch <konqueror@gmx.de> +Build-Depends: debhelper (>= 7), libqt4-dev +Standards-Version: 3.8.2 + +Package: hannah-foo2zjs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, foo2zjs, gksu | kdebase-bin (<< 4:4.4.0-1) | kdebase-runtime | ktsuss | sux +Conflicts: foo2zjs (<= 20090301dfsg-4) +Replaces: foo2zjs (<= 20090301dfsg-4) +Description: Graphical firmware downloader for the foo2zjs package + Hannah is a graphical firmware downloader for the foo2zjs package. You + can select one or more firmware(s) from a list, and let hannah download + and install them. + . + With this software you can potentially install non-free software, so + beware of that. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..70e904b --- /dev/null +++ b/debian/copyright @@ -0,0 +1,23 @@ +This package was debianized by Michael Koch <konqueror@gmx.de> on +Tue, 11 Aug 2009 22:31:27 +0100. + +Upstream Authors: + Steffen Joeris + Michael Koch + +Copyright: 2007-2009 Steffen Joeris + Michael Koch + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 dated June, 1991. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL-2'. diff --git a/debian/hannah-foo2zjs.dirs b/debian/hannah-foo2zjs.dirs new file mode 100644 index 0000000..bb57840 --- /dev/null +++ b/debian/hannah-foo2zjs.dirs @@ -0,0 +1,3 @@ +usr/bin +usr/share/applications +usr/share/menu diff --git a/debian/hannah-foo2zjs.menu b/debian/hannah-foo2zjs.menu new file mode 100644 index 0000000..62abd0d --- /dev/null +++ b/debian/hannah-foo2zjs.menu @@ -0,0 +1,6 @@ +?package(hannah-foo2zjs):\ + needs="X11"\ + section="Applications/System/Administration"\ + title="Hannah-foo2zjs"\ + longtitle="Foo2ZJS Firmware Installer (Hannah)"\ + command="/usr/bin/su-to-root -X -c /usr/bin/hannah-foo2zjs" diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..7f4e118 --- /dev/null +++ b/debian/rules @@ -0,0 +1,64 @@ +#!/usr/bin/make -f +# -*- makefile -*- + + +configure: configure-stamp +configure-stamp: + dh_testdir + + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + + $(MAKE) + + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + + # Add here commands to clean up after the build process. + $(MAKE) clean + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + + install -m 755 hannah $(CURDIR)/debian/hannah-foo2zjs/usr/bin/hannah-foo2zjs + install -m 644 hannah.desktop $(CURDIR)/debian/hannah-foo2zjs/usr/share/applications/hannah-foo2zjs.desktop + +# Build architecture-independent files here. +binary-indep: install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_installmenu + dh_installman + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure @@ -0,0 +1,265 @@ +// Hannah, GUI for downloading specific printer firmware +// Copyright (C) 2007 Steffen Joeris <white@debian.org> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +#include "gui.h" + +MainWindow::MainWindow(QWidget *parent) + :QWidget(parent) +{ + int check = QMessageBox::question(this, tr("Hannah - Firmware downloader"), + tr("Do you want to download and install potential non-free printer firmware?"), tr("&Yes"), tr("&No"), + QString::null, 0, 1); + + + if (! check == 0 ) { + exit(0); + } + + createMainWidget(); + + connect(downloadButton, SIGNAL(clicked()), this, SLOT(callGetweb())); +}; + +void MainWindow::createMainWidget() +{ + setWindowTitle(tr("Hannah - Foo2zjs firmware downloader")); + QVBoxLayout *mainLayout = new QVBoxLayout; + hp2600Button = new QCheckBox(tr("Download firmware for HP2600")); + hp1600Button = new QCheckBox(tr("Download firmware for HP1600")); + hp1020Button = new QCheckBox(tr("Download firmware for HP1020")); + hp1018Button = new QCheckBox(tr("Download firmware for HP1018")); + hp1005Button = new QCheckBox(tr("Download firmware for HP1005")); + hp1000Button = new QCheckBox(tr("Download firmware for HP1000")); + minolta2530Button = new QCheckBox(tr("Download firmware for Minolta 2530")); + minolta2490Button = new QCheckBox(tr("Download firmware for Minolta 2490")); + minolta2480Button = new QCheckBox(tr("Download firmware for Minolta 2480")); + minolta2430Button = new QCheckBox(tr("Download firmware for Minolta 2430")); + minolta2300Button = new QCheckBox(tr("Download firmware for Minolta 2300")); + minolta2200Button = new QCheckBox(tr("Download firmware for Minolta 2200")); + minoltaproButton = new QCheckBox(tr("Download firmware for Minolta PageWorks/Pro L")); + samsung3160Button = new QCheckBox(tr("Download firmware for Samsung CLX-3160")); + samsung600Button = new QCheckBox(tr("Download firmware for Samsung CLP-600")); + samsung300Button = new QCheckBox(tr("Download firmware for Samsung CLP-300")); + xerox6115Button = new QCheckBox(tr("Download firmware for Xerox Phaser 6115")); + xerox6110Button = new QCheckBox(tr("Download firmware for Xerox Phaser 6110")); + allButton = new QCheckBox(tr("Mark all for download")); + downloadButton = new QPushButton(tr("Download marked firmwares")); + exitButton = new QPushButton(tr("Exit")); + + hp2600Button->setFont(QFont("Times", 18)); + hp1600Button->setFont(QFont("Times", 18)); + hp1020Button->setFont(QFont("Times", 18)); + hp1018Button->setFont(QFont("Times", 18)); + hp1005Button->setFont(QFont("Times", 18)); + hp1000Button->setFont(QFont("Times", 18)); + minolta2530Button->setFont(QFont("Times", 18)); + minolta2490Button->setFont(QFont("Times", 18)); + minolta2480Button->setFont(QFont("Times", 18)); + minolta2430Button->setFont(QFont("Times", 18)); + minolta2300Button->setFont(QFont("Times", 18)); + minolta2200Button->setFont(QFont("Times", 18)); + minoltaproButton->setFont(QFont("Times", 18)); + samsung3160Button->setFont(QFont("Times", 18)); + samsung600Button->setFont(QFont("Times", 18)); + samsung300Button->setFont(QFont("Times", 18)); + xerox6115Button->setFont(QFont("Times", 18)); + xerox6110Button->setFont(QFont("Times", 18)); + allButton->setFont(QFont("Times", 18)); + downloadButton->setFont(QFont("Times", 18)); + exitButton->setFont(QFont("Times", 18)); + + QMenuBar *menubar = new QMenuBar; + QMenu *menu = new QMenu; + menubar->addMenu(menu); + QAction *about = new QAction(tr("About Hannah"), this); + menu = menubar->addMenu(tr("Help")); + menu->addAction(about); + + statusBar = new QStatusBar; + + mainLayout->addWidget(menubar, 0, 0); + mainLayout->addWidget(hp2600Button, 1, 0); + mainLayout->addWidget(hp1600Button, 2, 0); + mainLayout->addWidget(hp1020Button, 3, 0); + mainLayout->addWidget(hp1018Button, 4, 0); + mainLayout->addWidget(hp1005Button, 5, 0); + mainLayout->addWidget(hp1000Button, 6, 0); + mainLayout->addWidget(minolta2530Button, 7, 0); + mainLayout->addWidget(minolta2490Button, 8, 0); + mainLayout->addWidget(minolta2480Button, 9, 0); + mainLayout->addWidget(minolta2430Button, 10, 0); + mainLayout->addWidget(minolta2300Button, 11, 0); + mainLayout->addWidget(minolta2200Button, 12, 0); + mainLayout->addWidget(minoltaproButton, 13, 0); + mainLayout->addWidget(samsung3160Button, 14, 0); + mainLayout->addWidget(samsung600Button, 15, 0); + mainLayout->addWidget(samsung300Button, 16, 0); + mainLayout->addWidget(xerox6115Button, 17, 0); + mainLayout->addWidget(xerox6110Button, 18, 0); + mainLayout->addWidget(allButton, 19, 0); + mainLayout->addWidget(statusBar, 20, 0); + mainLayout->addWidget(downloadButton, 21, 0); + mainLayout->addWidget(exitButton, 22, 0); + setMinimumSize(600, 700); + setLayout(mainLayout); + + buttonGroup = new QButtonGroup; + buttonGroup->setExclusive(false); + buttonGroup->addButton(hp2600Button, 0); + buttonGroup->addButton(hp1600Button, 1); + buttonGroup->addButton(hp1020Button, 2); + buttonGroup->addButton(hp1018Button, 3); + buttonGroup->addButton(hp1005Button, 4); + buttonGroup->addButton(hp1000Button, 5); + buttonGroup->addButton(minolta2530Button, 6); + buttonGroup->addButton(minolta2490Button, 7); + buttonGroup->addButton(minolta2480Button, 8); + buttonGroup->addButton(minolta2430Button, 9); + buttonGroup->addButton(minolta2300Button, 10); + buttonGroup->addButton(minolta2200Button, 11); + buttonGroup->addButton(minoltaproButton, 12); + buttonGroup->addButton(samsung3160Button, 13); + buttonGroup->addButton(samsung600Button, 14); + buttonGroup->addButton(samsung300Button, 15); + buttonGroup->addButton(xerox6115Button, 16); + buttonGroup->addButton(xerox6110Button, 17); + + connect(about, SIGNAL(triggered()), this, SLOT(showInfo())); + connect(allButton, SIGNAL(stateChanged(int)), this, SLOT(setCheckBoxes(int))); + connect(exitButton, SIGNAL(clicked()), qApp, SLOT(quit())); +}; + +void MainWindow::showInfo() +{ + QMessageBox::information(this, tr("Hannah-Foo2zjs Firmware Downloader"), + tr("This program is developed by the Debian Foo2ZJS maintainers.\n" + "It is offered as a convenient method to download the needed\n" + "firmware for one of the printers supported by Foo2ZJS. Please feel\n" + "free to report any bugs against the foo2zjs package\n" + "to the Debian BTS (http://bugs.debian.org).\n" + "The program's name is Hannah:\n" + "(grapHical interfAce for dowNloading your priNter's firmwAre at Home).\n"), + QMessageBox::Ok); +}; + +void MainWindow::setCheckBoxes(int state) +{ + switch (state) { + case 2: + hp2600Button->setCheckState(Qt::Checked); + hp1600Button->setCheckState(Qt::Checked); + hp1020Button->setCheckState(Qt::Checked); + hp1018Button->setCheckState(Qt::Checked); + hp1005Button->setCheckState(Qt::Checked); + hp1000Button->setCheckState(Qt::Checked); + minolta2530Button->setCheckState(Qt::Checked); + minolta2490Button->setCheckState(Qt::Checked); + minolta2480Button->setCheckState(Qt::Checked); + minolta2430Button->setCheckState(Qt::Checked); + minolta2300Button->setCheckState(Qt::Checked); + minolta2200Button->setCheckState(Qt::Checked); + minoltaproButton->setCheckState(Qt::Checked); + samsung3160Button->setCheckState(Qt::Checked); + samsung600Button->setCheckState(Qt::Checked); + samsung300Button->setCheckState(Qt::Checked); + xerox6115Button->setCheckState(Qt::Checked); + xerox6110Button->setCheckState(Qt::Checked); + break; + case 0: + hp2600Button->setCheckState(Qt::Unchecked); + hp1600Button->setCheckState(Qt::Unchecked); + hp1020Button->setCheckState(Qt::Unchecked); + hp1018Button->setCheckState(Qt::Unchecked); + hp1005Button->setCheckState(Qt::Unchecked); + hp1000Button->setCheckState(Qt::Unchecked); + minolta2530Button->setCheckState(Qt::Unchecked); + minolta2490Button->setCheckState(Qt::Unchecked); + minolta2480Button->setCheckState(Qt::Unchecked); + minolta2430Button->setCheckState(Qt::Unchecked); + minolta2300Button->setCheckState(Qt::Unchecked); + minolta2200Button->setCheckState(Qt::Unchecked); + minoltaproButton->setCheckState(Qt::Unchecked); + samsung3160Button->setCheckState(Qt::Unchecked); + samsung600Button->setCheckState(Qt::Unchecked); + samsung300Button->setCheckState(Qt::Unchecked); + xerox6115Button->setCheckState(Qt::Unchecked); + xerox6110Button->setCheckState(Qt::Unchecked); + break; + default: + break; + } +} + +void MainWindow::callGetweb() +{ + QAbstractButton *temporary_button; + int count = 0; + QStringList current_list; + current_list << "2600n" << "1600" << "1020" << "1018" << "1005" << "1000" << "2530" << "2490" << "2480" << "2430" << "2300" << "2200" << "cpwl" << "3160" << "600" << "300" << "6115" << "6110"; + QStringList arguments; + + foreach( temporary_button, buttonGroup->buttons() ) { + if ( temporary_button->isChecked() ) { + arguments << current_list.at(count); + } + count++; + } + + QString program = "/usr/bin/getweb"; + string = arguments.join(" "); + callProgram = new QProcess; + + switch (callProgram->state()) { + case 2: + QMessageBox::warning(this, tr("Hannah - Firmware downloader 'getweb'"), + tr("There is already a firmware download in progress. \n" + "Refuse to start another one."), QMessageBox::Ok); + break; + case 1: + QMessageBox::warning(this, tr("Hannah - Firmware downloader 'getweb'"), + tr("There is already a firmware download in progress. \n" + "Refuse to start another one."), QMessageBox::Ok); + break; + case 0: + callProgram->start(program, arguments); + QString message = QString(tr("Downloading firmware for %1").arg(string)); + statusBar->showMessage(message); + connect(callProgram, SIGNAL(finished(int)), this, SLOT(checkProgram())); + break; + } +}; + +void MainWindow::checkProgram() +{ + switch ( callProgram->exitCode() ) { + case 0: + QMessageBox::information(this, tr("Hannah - Firmware downloader"), + tr("The firmware for the following printers was downloaded and installed successfully:\n" + "%1\n").arg(string), QMessageBox::Ok); + statusBar->showMessage(tr("Download and installation finished.")); + break; + default: + QMessageBox::critical(this, tr("Hannah - Firmware downloader"), + tr(callProgram->readAllStandardError())); + QMessageBox::critical(this, tr("Hannah - Firmware downloader"), + tr("Something went wrong during the download and installation process for the following printers:\n" + "%1\n").arg(string), QMessageBox::Ok); + statusBar->showMessage(tr("An error occured during download and installation process.")); + break; + } +}; @@ -0,0 +1,80 @@ +// Hannah, GUI for downloading specific printer firmware +// Copyright (C) 2007 Steffen Joeris <white@debian.org> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +#ifndef GUI_H +#define GUI_H + +#include <QMainWindow> +#include <QWidget> +#include <QVBoxLayout> +#include <QPushButton> +#include <QMessageBox> +#include <QApplication> +#include <QProcess> +#include <QCheckBox> +#include <QAbstractButton> +#include <QButtonGroup> +#include <QAction> +#include <QMenu> +#include <QMenuBar> +#include <QStatusBar> + +class MainWindow : public QWidget +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = 0); + +private: + int state; + void createMainWidget(); + QCheckBox *hp2600Button; + QCheckBox *hp1600Button; + QCheckBox *hp1020Button; + QCheckBox *hp1018Button; + QCheckBox *hp1005Button; + QCheckBox *hp1000Button; + QCheckBox *minolta2530Button; + QCheckBox *minolta2490Button; + QCheckBox *minolta2480Button; + QCheckBox *minolta2430Button; + QCheckBox *minolta2300Button; + QCheckBox *minolta2200Button; + QCheckBox *minoltaproButton; + QCheckBox *samsung3160Button; + QCheckBox *samsung600Button; + QCheckBox *samsung300Button; + QCheckBox *xerox6115Button; + QCheckBox *xerox6110Button; + QCheckBox *allButton; + QButtonGroup *buttonGroup; + QPushButton *downloadButton; + QPushButton *exitButton; + QStatusBar *statusBar; + QProcess *callProgram; + QString string; + +private slots: + void callGetweb(); + void setCheckBoxes(int); + void showInfo(); + void checkProgram(); +}; + +#endif // GUI_H Binary files differdiff --git a/hannah.desktop b/hannah.desktop new file mode 100644 index 0000000..859d80d --- /dev/null +++ b/hannah.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Name=Foo2ZJS Firmware Installer (Hannah) +Exec=/usr/bin/su-to-root -X -c /usr/bin/hannah-foo2zjs +Type=Application +Comment=Foo2ZJS Firmware Downloader and Installer +Terminal=0 +Categories=System;Settings; diff --git a/hannah.pro b/hannah.pro new file mode 100644 index 0000000..64d3fcb --- /dev/null +++ b/hannah.pro @@ -0,0 +1,12 @@ +###################################################################### +# Automatically generated by qmake (2.01a) Thu Sep 27 01:13:29 2007 +###################################################################### + +TEMPLATE = app +TARGET = +DEPENDPATH += . +INCLUDEPATH += . + +# Input +HEADERS += gui.h +SOURCES += gui.cpp main.cpp diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..1ecfd55 --- /dev/null +++ b/main.cpp @@ -0,0 +1,27 @@ +// Hannah, GUI for downloading specific printer firmware +// Copyright (C) 2007 Steffen Joeris <white@debian.org> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this program; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +#include "gui.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + MainWindow window; + window.show(); + return app.exec(); +} |