Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac port updates and general cleanups and fixes #2

Merged
merged 4 commits into from
Aug 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions extra/mac/Makefile.dependencies
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BUILD_DIR=$(shell pwd)
SRC_DIR=$(BUILD_DIR)
SRC_DIR=$(dir $(abspath $(MAKEFILE_LIST)))
PATCH_DIR=$(SRC_DIR)

CURL=curl
Expand All @@ -8,27 +8,27 @@ CURL_OPTS=-L

PREFIX=$(BUILD_DIR)/deps

SDK=macosx10.11
SDK=macosx10.13
SDK_PATH=$(shell xcrun --sdk $(SDK) --show-sdk-path)

QT_MINOR=5.5
QT_MINOR=5.11
QT_VER=$(QT_MINOR).1
QT_BN=qt-everywhere-opensource-src-$(QT_VER)
QT_SOURCE_FILE=$(QT_BN).tar.gz
QT_URL=http://download.qt-project.org/official_releases/qt/$(QT_MINOR)/$(QT_VER)/single/$(QT_SOURCE_FILE)
QT_BN=qt-everywhere-src-$(QT_VER)
QT_SOURCE_FILE=$(QT_BN).tar.xz
QT_URL=http://download.qt.io/official_releases/qt/$(QT_MINOR)/$(QT_VER)/single/$(QT_SOURCE_FILE)
QT_DIR=$(BUILD_DIR)/qt
QT_SOURCE=$(QT_DIR)/$(QT_SOURCE_FILE)
QT_SOURCE_DIR=$(QT_DIR)/$(QT_BN)

PGSQL_VER=9.5.1
PGSQL_VER=10.4
PGSQL_BN=postgresql-$(PGSQL_VER)
PGSQL_SOURCE_FILE=$(PGSQL_BN).tar.bz2
PGSQL_URL=http://ftp.postgresql.org/pub/source/v$(PGSQL_VER)/$(PGSQL_SOURCE_FILE)
PGSQL_DIR=$(BUILD_DIR)/postgres
PGSQL_SOURCE=$(PGSQL_DIR)/$(PGSQL_SOURCE_FILE)
PGSQL_SOURCE_DIR=$(PGSQL_DIR)/$(PGSQL_BN)
PGSQL_COMMON_CFLAGS=-isysroot $(SDK_PATH) -mmacosx-version-min=10.11
PGSQL_COMMON_LDFLAGS=-Wl,-syslibroot,$(SDK_PATH) -mmacosx-version-min=10.11
PGSQL_COMMON_CFLAGS=-isysroot $(SDK_PATH) -mmacosx-version-min=10.13
PGSQL_COMMON_LDFLAGS=-Wl,-syslibroot,$(SDK_PATH) -mmacosx-version-min=10.13
PGSQL_CONFIGURE_FLAGS=--without-openssl --without-perl --without-python --without-tcl --without-bonjour --without-pam --with-gssapi --without-libxml

.PHONY: all clean mrproper clean.destdir \
Expand Down Expand Up @@ -62,10 +62,13 @@ $(QT_DIR)/configured: $(QT_DIR)/patched $(PGSQL_DIR)/installed
./configure -release \
-opensource -confirm-license \
-sdk "$(SDK)" \
-qt-sql-psql \
-sql-psql \
-prefix "$(PREFIX)" \
-verbose \
-skip qtwebkit \
-skip qtwebengine \
-skip qt3d \
-skip qtlocation \
-skip qtvirtualkeyboard \
-nomake examples \
-nomake tests \
-I"$(PREFIX)"/include \
Expand All @@ -75,7 +78,7 @@ $(QT_DIR)/configured: $(QT_DIR)/patched $(PGSQL_DIR)/installed
$(QT_DIR)/patched: $(QT_DIR)/unpacked
cd "$(QT_SOURCE_DIR)" && \
for i in "$(PATCH_DIR)"/qt-*.patch ; do \
[ "$$i" != "$(PATCH_DIR)"/qt-"*".patch ] && \
[ "$$i" = "$(PATCH_DIR)"/qt-"*".patch ] || \
patch -p0 < "$$i" ; \
done && \
touch "$@"
Expand Down
2 changes: 1 addition & 1 deletion extra/mac/README.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Content:

Create a build directory for the dependencies, go there and run:

make -f <path to sctime source tree>/extra/mac/Makefile.dependencies SRC_DIR=<path to sctime source tree>/extra/mac/
make -f <path to sctime source tree>/extra/mac/Makefile.dependencies

You can also build directly inside the sctime source tree by changing into
extra/mac and running:
Expand Down
11 changes: 0 additions & 11 deletions extra/mac/qt-5.0.1-popen-feof.patch

This file was deleted.

35 changes: 35 additions & 0 deletions extra/mac/qt-5.11.1-fontmanager.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Revert
https://github.com/qt/qtbase/commit/c7eb2c173e79f2936985cd7589347e59b6005c7c
because it breaks the dialog: The font never updates and always returns the
initial font.

--- qtbase/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm.orig 2018-06-15 09:29:31.000000000 +0200
+++ qtbase/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm 2018-08-03 14:49:38.000000000 +0200
@@ -73,6 +74,8 @@
return newFont;
}

+@class QT_MANGLE_NAMESPACE(QNSFontPanelDelegate);
+
@interface QT_MANGLE_NAMESPACE(QNSFontPanelDelegate) : NSObject<NSWindowDelegate, QNSPanelDelegate>
{
@public
@@ -109,8 +112,8 @@
[mFontPanel setRestorable:NO];
[mFontPanel setDelegate:self];

- [NSFontManager sharedFontManager].target = self; // Action is changeFont:
+ [[NSFontManager sharedFontManager] setDelegate:self];

[mFontPanel retain];
return self;
}
@@ -119,7 +123,7 @@
{
[mStolenContentView release];
[mFontPanel setDelegate:nil];
- [NSFontManager sharedFontManager].target = nil;
+ [[NSFontManager sharedFontManager] setDelegate:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self];

[super dealloc];
11 changes: 0 additions & 11 deletions extra/mac/qt-5.4.1-right-mouse-button.patch

This file was deleted.

20 changes: 0 additions & 20 deletions extra/mac/qt-5.5.1-tbd-libs.patch

This file was deleted.

2 changes: 1 addition & 1 deletion extra/mac/sctime-mac-dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ patchqtdir="Resources/Qt"
echo "Copying qt plugins into application bundle..."
rm -rf "$appqtdir"/plugins && \
mkdir -p "$appqtdir"/plugins && \
cp -R "$qtdir"/plugins/platforms "$appqtdir"/plugins && \
cp -R "$qtdir"/plugins/{platforms,sqldrivers,styles} "$appqtdir"/plugins && \
rm -f "$appqtdir"/plugins/*/*_debug.dylib || \
exit 1

Expand Down
35 changes: 22 additions & 13 deletions src/kontotreeview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ KontoTreeView::KontoTreeView(QWidget *parent, AbteilungsListe* abtlist, const st
setDropIndicatorShown( true );
setSortingEnabled( true );
sortItems(0,Qt::AscendingOrder);
setContextMenuPolicy(Qt::CustomContextMenu);

// make sure we see all right mouse button events
setContextMenuPolicy(Qt::PreventContextMenu);

#ifndef Q_OS_MAC
setSelectionMode(QTreeWidget::NoSelection);
Expand Down Expand Up @@ -101,19 +102,32 @@ void KontoTreeView::keyPressEvent(QKeyEvent *event)

void KontoTreeView::mousePressEvent(QMouseEvent * event)
{
//Only to detect in timemainwindow.cpp which mousebutton was clicked.
currentButton = event->button();
QPoint pos = event->pos();

//Do only Drag n Drop if a time column is selected
if( currentButton == Qt::LeftButton )//&& currentColumn() == 3 || currentColumn() == 4)
{
dragStartPosition = event->pos();
}
if (event->button() == Qt::LeftButton)
dragStartPosition = pos;

// signal itemClicked() of QTreeWidget only fires on left button clicks
// (based on QAbstractItemView's clicked() signal). Track right clicks as
// well to implement our own itemRightClicked() signal
if (event->button() == Qt::RightButton)
rightPressedIndex = indexAt(pos);

//Put event to the parentwidget
QTreeWidget::mousePressEvent(event);
}

void KontoTreeView::mouseReleaseEvent(QMouseEvent *event) {
QTreeWidget::mouseReleaseEvent(event);

// emit itemRightClicked if we saw a right button press matching this release
QModelIndex index = indexAt(event->pos());
if (event->button() == Qt::RightButton &&
index == rightPressedIndex &&
index.isValid())
emit itemRightClicked(itemFromIndex(index));
}

void KontoTreeView::mouseMoveEvent(QMouseEvent * event )
{
if (!(event->buttons() & Qt::LeftButton))
Expand Down Expand Up @@ -1041,8 +1055,3 @@ void KontoTreeView::refreshAllItemsInDepartment(const QString& department)
refreshAllItemsInKonto(department, subAccountPos->first);
}
}

Qt::MouseButton KontoTreeView::getCurrentButton()
{
return currentButton;
}
9 changes: 6 additions & 3 deletions src/kontotreeview.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,22 @@ class KontoTreeView: public QTreeWidget

int getItemDepth( QTreeWidgetItem* );

Qt::MouseButton getCurrentButton();

void updateColumnWidth();

public slots:
virtual void refreshItem(const QString& abt, const QString& ko,const QString& uko, int idx);
void refreshAllItemsInUnterkonto(const QString& abt, const QString& ko,const QString& uko);
void refreshAllItemsInKonto(const QString& abt, const QString& ko);
void refreshAllItemsInDepartment(const QString&);

signals:
void itemRightClicked(QTreeWidgetItem *item);

protected:
virtual bool eventFilter ( QObject* obj, QEvent * e );
virtual void mouseMoveEvent(QMouseEvent *event);
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event);
virtual void dragMoveEvent(QDragMoveEvent *event);
Expand All @@ -106,8 +109,8 @@ class KontoTreeView: public QTreeWidget
bool m_showPersoenlicheKontenSummenzeit;
AbteilungsListe* abtList;
QPoint dragStartPosition;
Qt::MouseButton currentButton;
Qt::KeyboardModifiers keyboardModifier;
QPersistentModelIndex rightPressedIndex;
};

#endif
35 changes: 8 additions & 27 deletions src/timemainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,6 @@ TimeMainWindow::TimeMainWindow():QMainWindow(), startTime(QDateTime::currentDate
QAction* preferenceAction = new QAction(tr("&Settings..."),this);
preferenceAction->setMenuRole(QAction::PreferencesRole);
connect(preferenceAction, SIGNAL(triggered()), this, SLOT(callPreferenceDialog()));
#if defined(Q_OS_MAC) && QT_VERSION >= 0x050000
/* ugly workaround: Qt 5.0 does not automatically hide the menu emptied by
* merging the actions into the system menu */
settingsmenu->menuAction()->setVisible(false);
#endif

QAction* helpAction = new QAction(tr("&Manual..."), this);
helpAction->setShortcut(Qt::Key_F1);
Expand Down Expand Up @@ -309,7 +304,6 @@ TimeMainWindow::TimeMainWindow():QMainWindow(), startTime(QDateTime::currentDate
connect(this,SIGNAL(unterkontoSelected(bool)), bereitschaftsAction, SLOT(setEnabled(bool)));

connect(this,SIGNAL(aktivierbarerEintragSelected(bool)), eintragActivateAction, SLOT(setEnabled(bool)));
connect(kontoTree,SIGNAL(customContextMenuRequested(const QPoint & )), this, SLOT(showContextMenu( const QPoint & )));

toolBar->addAction(editUnterKontoAction);
toolBar->addAction(saveAction);
Expand Down Expand Up @@ -437,20 +431,23 @@ void TimeMainWindow::showAdditionalButtons(bool show)

void TimeMainWindow::configClickMode(bool singleClickActivation)
{
disconnect(kontoTree, SIGNAL(itemClicked ( QTreeWidgetItem * , int )),
this, SLOT(mouseButtonInKontoTreeClicked(QTreeWidgetItem * , int )));
disconnect(kontoTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int )),
this, SLOT(callUnterKontoDialog(QTreeWidgetItem *)) );
disconnect(kontoTree, SIGNAL(itemRightClicked(QTreeWidgetItem *)),
this, SLOT(callUnterKontoDialog(QTreeWidgetItem *)));
disconnect(kontoTree, SIGNAL(itemClicked(QTreeWidgetItem *, int )),
this, SLOT(setAktivesProjekt(QTreeWidgetItem *)));
disconnect(kontoTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int )),
this, SLOT(setAktivesProjekt(QTreeWidgetItem *)));

if (!singleClickActivation) {
connect(kontoTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int )),
this, SLOT(setAktivesProjekt(QTreeWidgetItem *)));
}
else {
connect(kontoTree, SIGNAL(itemRightClicked(QTreeWidgetItem *)),
this, SLOT(callUnterKontoDialog(QTreeWidgetItem *)) );
} else {
connect(kontoTree, SIGNAL(itemClicked ( QTreeWidgetItem * , int )),
this, SLOT(mouseButtonInKontoTreeClicked(QTreeWidgetItem * , int )));
this, SLOT(setAktivesProjekt(QTreeWidgetItem *)));
connect(kontoTree, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int )),
this, SLOT(callUnterKontoDialog(QTreeWidgetItem *)) );
}
Expand Down Expand Up @@ -504,14 +501,6 @@ void TimeMainWindow::copyNameToClipboard()
cb->setText( kontoTree->currentItem()->text(KontoTreeItem::COL_ACCOUNTS), QClipboard::Clipboard );
}

void TimeMainWindow::mouseButtonInKontoTreeClicked(QTreeWidgetItem * item, int)
{
if ( (kontoTree->getCurrentButton() == Qt::LeftButton) &&(item)) {

setAktivesProjekt(item);
}
}

void TimeMainWindow::driftKorrektur() {
int drift = startTime.secsTo(lastMinuteTick) - sekunden;
if (abs(drift) < 60) return;
Expand Down Expand Up @@ -1123,14 +1112,6 @@ void TimeMainWindow::flagsChanged(const QString& abt, const QString& ko, const Q
updateCaption();
}

void TimeMainWindow::showContextMenu(const QPoint& pos)
{
if (!settings->singleClickActivation())
{
callUnterKontoDialog(kontoTree->itemAt(pos));
}
}

void TimeMainWindow::resizeToIfSensible(QDialog* dialog, const QPoint& pos, const QSize& size)
{
if (size.isNull())
Expand Down
2 changes: 0 additions & 2 deletions src/timemainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,8 @@ class TimeMainWindow: public QMainWindow

void refreshKontoListe();
void configClickMode(bool singleClickActivation);
void mouseButtonInKontoTreeClicked(QTreeWidgetItem * item, int column );
void copyNameToClipboard();
void copyEntryAsText();
void showContextMenu(const QPoint& pos);
void showArbeitszeitwarning();
void checkComment(const QString& abt, const QString& ko , const QString& uko,int idx);
void commitKontenliste(DSResult data);
Expand Down