Skip to content

Commit

Permalink
DropDown mode
Browse files Browse the repository at this point in the history
  • Loading branch information
SokoloffA committed Jan 9, 2012
1 parent d20d44f commit e1f40d7
Show file tree
Hide file tree
Showing 21 changed files with 1,626 additions and 14 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ subdirs( src )


install(FILES qterminal.desktop DESTINATION share/applications)
install(FILES qterminal_drop.desktop DESTINATION share/applications)


# make dist custom target
Expand Down
49 changes: 49 additions & 0 deletions qterminal_drop.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[Desktop Entry]
Type=Application
Exec=qterminal --drop
Terminal=false
Categories=Accessories;System Tools;Utilities;System
Icon=terminal

Name=QTerminal drop down
GenericName=Drop-down Terminal

GenericName[bg]=Падащ терминал
GenericName[ca]=Terminal desplegable
GenericName[ca@valencia]=Terminal desplegable
GenericName[cs]=Vysouvací terminál
GenericName[da]=Terminal der ruller ned
GenericName[de]=Aufklapp-Terminal
GenericName[en_GB]=Drop-down Terminal
GenericName[es]=Terminal de menú desplegable
GenericName[et]=Lahtikeriv terminal
GenericName[fr]=Terminal déroulant
GenericName[hr]=Spuštajući terminal
GenericName[hu]=Legördülő terminál
GenericName[it]=Terminale a discesa
GenericName[ja]=ドロップダウン式ターミナル
GenericName[km]=ស្ថានីយ​ទម្លាក់​ចុះ
GenericName[ko]=위에서 내려오는 터미널
GenericName[nb]=Nedtrekksterminal
GenericName[nds]=Utklapp-Konsool
GenericName[nl]=Uitvouwbare terminalemulator
GenericName[pa]=ਲਟਕਦਾ ਟਰਮੀਨਲ
GenericName[pt]=Terminal Deslizante
GenericName[pt_BR]=Terminal suspenso
GenericName[ro]=Terminal derulant

GenericName[ru]=Выпадающий терминал
Comment[ru]=Вападающий эмулятор терминала.

GenericName[sk]=Rozbaľovací terminál
GenericName[sv]=Rullgardinsterminal
GenericName[th]=เทอร์มินัลแบบหย่อนลง
GenericName[tr]=Yukarıdan Açılan Uçbirim
GenericName[uk]=Спадний термінал
GenericName[x-test]=xxDrop-down Terminalxx
GenericName[zh_CN]=拉幕式终端
GenericName[zh_TW]=下拉式終端機

Comment=A drop-down terminal emulator.


19 changes: 19 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,33 @@ set( QTERM_SRC
termwidgetholder.cpp
properties.cpp
propertiesdialog.cpp
third-party/globalshortcutmanager.cpp
)

if(WIN32)
set(QTERM_SRC
${QTERM_SRC}
third-party/globalshortcutmanager_win.cpp
)
elseif(APPLE)
set(QTERM_SRC
${QTERM_SRC}
third-party/globalshortcutmanager_mac.cpp
)
else()
set(QTERM_SRC
${QTERM_SRC}
third-party/globalshortcutmanager_x11.cpp
)
endif()

set( QTERM_MOC_SRC
mainwindow.h
tabwidget.h
termwidget.h
termwidgetholder.h
propertiesdialog.h
third-party/globalshortcuttrigger.h
)

set( QTERM_UI_SRC
Expand Down
78 changes: 77 additions & 1 deletion src/forms/propertiesdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
<string>Shortcuts</string>
</property>
</item>
<item>
<property name="text">
<string>DropDown</string>
</property>
</item>
</widget>
</item>
<item row="0" column="1">
Expand All @@ -67,7 +72,7 @@
<enum>QFrame::Box</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>5</number>
</property>
<widget class="QWidget" name="fontPage">
<layout class="QGridLayout" name="gridLayout_2">
Expand Down Expand Up @@ -362,6 +367,77 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="dropShowOnStartCheckBox">
<property name="text">
<string>Show on start</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Size</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="dropHeightLabel">
<property name="text">
<string>Height %:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="dropHeightSpinBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="dropWidthLabel">
<property name="text">
<string>Width %:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="dropWidthSpinBox"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="dropShortCutLabel">
<property name="text">
<string>Shortcut:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="dropShortCutEdit"/>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>78</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0" colspan="2">
Expand Down
2 changes: 2 additions & 0 deletions src/icons.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
<file>icons/document-close.png</file>
<file>icons/application-exit.png</file>
<file>icons/qterminal.png</file>
<file>icons/locked.png</file>
<file>icons/notlocked.png</file>
</qresource>
</RCC>
Binary file added src/icons/locked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icons/notlocked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 18 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@

#define out

const char* const short_options = "vhw:e:";
const char* const short_options = "vhw:e:d";

const struct option long_options[] = {
{"version", 0, NULL, 'v'},
{"help", 0, NULL, 'h'},
{"workdir", 1, NULL, 'w'},
{"execute", 1, NULL, 'e'},
{"drop", 0, NULL, 'd'},
{NULL, 0, NULL, 0}
};

Expand All @@ -48,6 +49,7 @@ void print_usage_and_exit(int code)
puts("-v|--version Prints application version and exits");
puts("-w|--workdir <dir> Start session with specified work directory");
puts("-e|--execute <command> Execute command instead of shell");
puts("-d|--drop Start in Drop Mode, like Yakuake or Tilda");
puts("\nHomepage: http://qterminal.sourceforge.net/");
puts("Feature requests, bug reports etc please send to: <petr@scribus.info>\n");
exit(code);
Expand All @@ -59,9 +61,10 @@ void print_version_and_exit(int code=0)
exit(code);
}

void parse_args(int argc, char* argv[], QString& workdir, QString & shell_command)
void parse_args(int argc, char* argv[], QString& workdir, QString & shell_command, out bool& dropMode)
{
int next_option;
dropMode = false;
do{
next_option = getopt_long(argc, argv, short_options, long_options, NULL);
switch(next_option)
Expand All @@ -74,6 +77,9 @@ void parse_args(int argc, char* argv[], QString& workdir, QString & shell_comman
case 'e':
shell_command = QString(optarg);
break;
case 'd':
dropMode = true;
break;
case '?':
print_usage_and_exit(1);
case 'v':
Expand All @@ -88,13 +94,20 @@ int main(int argc, char *argv[])
setenv("TERM", "xterm", 1);
QApplication app(argc, argv);
QString workdir, shell_command;
parse_args(argc, argv, workdir, shell_command);
bool dropMode;
parse_args(argc, argv, workdir, shell_command, dropMode);

if (workdir.isEmpty())
workdir = QDir::homePath();

MainWindow widget(workdir, shell_command);
widget.show();
MainWindow widget(workdir, shell_command, dropMode);
if (!widget.dropMode() ||
Properties::Instance()->dropShowOnStart
)
{
widget.show();
}

return app.exec();
qDebug() << Q_FUNC_INFO;
}
Loading

0 comments on commit e1f40d7

Please sign in to comment.